Atom - search by extension in selected folder - atom-editor

When I search for certain string ("Search in directory"), atom allows to do 2 things: specify directory or file extension (but then it searches in all directories in project). Is it possible to do both at the same time? E.g. I want to do recursive search in 'src' directory, but using only *.c and *.cpp files.

Try searching using src/**/*.c as file/directory pattern.

To search both *.c and *.cpp files, use ,:
src/**/*.c, src/**/*.cpp
To speed things up, use ! to exclude an unwanted directory:
src/**/*.c, src/**/*.cpp, !src/not_this_dir/

Related

Premake (lua) pch create /Yc Visual Studio

In the premake lua script for my solution. How do i set it to create "/Yc" the phc instead of being set to use "/Yu" on first initialisation.
I have searched the online documentation and tried other help sites. I can't find any help.
I assume it's a build option but have tried buildoptions { "/Yc" }
Some help would be much appritiated?
The solution was to set the correct path to the source file.
premake5.lua
pchheader "awepch.h"
pchsource "%{prj.name}/Src/awepch.cpp" // this is where the source file is located on disk
* Also it is mandatory that you use the correct case for the characters. If you use "pch.h" for a file name on disk that must be the file name in this section of your "premake5.lua" script
Sorry to take so long to deliver the answer :)
you need to specify
pchheader('StdAfx.h')
and
pchsource('StdAfx.cpp')
For the current version of premake v5. 0.0-beta1, you must do the following in order for the precompiled header to work across all IDEs (especially for Visual Studio):
Put both pch.h and pch.cpp under the root directory of your project (not solution/workspace).
Set the exact name (not a path) of the pch.h to pchheader().
Set the full path of pch.cpp relative to premake5.lua script in pchsource(). This is IMPORTANT. I don't know why, but if you do not specify the full relative path, then premake will Use (/Yu) (use precompiled header) to the phc.cpp instead of Create (/Yc) (create precompiled header), which results in not creating the precompiled header in Visual Studio.
Include the directory where pch.h and pch.cpp are located in includedirs()
#include "pch.h" IN EVERY .cpp file in your project, IN THE FIRST LINE of each .cpp file. Remember: #include "pch.h", "pch.h" must be excactly the same as the string you set in pchheader() in your premake5.lua script.
If you have .c files, you MUST rename them to .cpp instead, otherwise Visual Studio will complain about using a precompiled header that was compiled using a c++ compiler.
I know it's overcomplicated but this is how it is.
Example:
project "LearnGL"
location "Projects/LearnGL/"
kind "ConsoleApp"
language "C++"
targetdir "builds/"
objdir "obj/%{prj.name}_%{cfg.shortname}"
pchheader "pch.h" --Do not use paths here. Use directly the header file name
pchsource "Projects/LearnGL/src/pch.cpp" --Full path MUST be specified relative to the premake5.lua (this) script.
files {
"Projects/LearnGL/src/**.h",
"Projects/LearnGL/src/**.hpp",
"Projects/LearnGL/src/**.cpp"
}
includedirs {
"Projects/LearnGL/src/", --This is where pch.h and pch.cpp are located.
"Projects/LearnGL/src/external/glad/include/",
"Projects/LearnGL/src/external/stb_image/include/",
"External/glfw/include/",
"External/spdlog/include/"
}

Automatic toctree update

I'm not sure if this is possible. But I'm hoping to put multiple .rst files in a directory, and during compilation. I want these files to automatically be inserted in the toctree. How can I go about this?
You can use the glob option which enables wildcards. Like this:
.. toctree::
:glob:
*
This adds all other *.rst files in the same directory to the toctree.
Reference: "Use “globbing” in toctree directives"

Complete directory names using the end of the string on command completition

Let's say I have a directory with the following contents:
/Project.Presentation
/Project.Presentation.API
/Project.Presentation.Web
/Project.Presentation.Infra
/Project.Presentation.Util
I want to do this -> Project.Presentation: API and let it autocomplete to Project.Presentation.API. Inside Project.Presentation to type API and <tab>.
Is it possible to let zsh use this 'forgiving' way of ?
You're overcomplicating your solution.
If you want to execute a command with a file inside these directories, or just cd in one of these directories.
Just write cd (or other command) first, then press tab that will complete Project.Presentation. then you can either write API or write A and press tab.
By the way, you can have a way to navigate through the possibilities with an extra tab key.
Read man zshoptions for to discover options available in zsh.

Flex : Create new folder in zip file

I am using Flex, Flash Builder 4.5 and Extension Builder 2.0.0 and I use the "nochump ziplib" library to generate a ZIP file. I want to create a new folder in created ZIP file, but I can't find such function function in the "nochump" library.
Can anyone please tell me if there is any function to add new folder in a ZIP file or a library which can help me do this?
The directories are not first-class citizens in the ZIP format.
The archive is built from "entries" - plain files with their relative locations to the "central directory" (the "root" of the archive). This means that the ZIP file is composed from entries like "pictures/1.jpg", "doc/old/1.txt" etc. You don't have separate entries for the "pictures", "doc" or "doc/old" directories.
You can't create a new directory directly. Instead of creating a new directory first (such as "newDir") you may want to create a file (entry) inside instead (such as "newDir/1.txt") and "newDir" will appear as directory when you open the resulting ZIP file.
If you insist on having an empty directory in the archive, you may try the hacky way - adding entries like "newDir/." with zero length. But this may not work with your library.
The Wikipedia article for the ZIP format has all the theory explained pretty well.

Ignoring a directory using ack's .ackrc

I'm not sure what it's for, but the code I'm working on has a bunch of folders called "save.d," it looks like they're used for some sort of version control (we also have .svn folders).
How can I update my .ackrc file to ignore those directories by default?
My .ackrc is currently
--type-set=inc=.inc
--ignore-dir=pear
--type-set=tpl=.tpl
Our folder structure can look like:
program/parsers/save.d
program/modules/save.d
Adding another line --ignore-dir=save.d did the trick

Resources