I only see "ignore_regexes" option in the Sublime SFTP config.json. Is there any way to include only certain files, for example, .h, .c and .cpp files alone from all the subfolders under the mapped folder?
Looking at the documentation for the package, the only setting that looks like it would do something like this is the ignore_regexes option that you've already found.
As such, I think the only way to do what you want would be to use a regular expression that matches everything but the files that you're interested in so that it ignores all files except the ones that you want to view.
An example of such a regular expression (which I only midly tested but seems to work) is the following (adapted from this question):
^(.(?!\.(c|h|cpp)))*$
In use, as mentioned in the documentation examples you should use \\ instead of \ in the config file since it's JSON and \ has special meaning in JSON data.
Related
I am using cpplint to check my sourcode agains the google style guide.
Cpplint's help says:
cpplint.py supports per-directory configurations specified in CPPLINT.cfg
files. CPPLINT.cfg file can contain a number of key=value pairs.
Currently the following options are supported:
"exclude_files" allows to specify a regular expression to be matched against
a file name. If the expression matches, the file is skipped and not run
through liner.
Example file:
filter=-build/include_order,+build/include_alpha
exclude_files=.*\.cc
The above example disables build/include_order warning and enables
build/include_alpha as well as excludes all .cc from being
processed by linter, in the current directory (where the .cfg
file is located) and all sub-directories.
How I use cpplint:
I use cpplint by this command to check all files in my source folder:
cpplint src/*.c
Well there is one special file foo.cc which must not be checked. So I tried to create a CPPLIN.cfg to use the exclude_files property. My file looks like this:
set noparent
filter=-build/include_dir
exclude_files=foo.cc
Nevertheless foo.cc is still checked.
What I have already tried to do:
I tried exclude_files=/.*\.cc/. This should exclude all files ending with *.cc. Nevertheless all files are still checked.
I tried to remove my filter from the file. This caused more errors than before. So I am now sure that my CPPLINT.cfg file is found by cpplint.
Question:
How to use the exclude_files regex in cpplint correctly?
Turns out apparently that the doc is wrong: exclude_files only excludes files in the same directory as CPPLINT.cfg, not in subdirectories. See https://github.com/google/styleguide/issues/220
So the solution would be to create src/CPPLINT.cfg and put exclude_files=.*\.cc in it.
I want to add a Resource Filter in Eclipse to exclude a folder named target including all it's files and subfolders except exactly one of this subfolders (target/scala-2.11/classes_managed).
Here is the regex I used for this (including examples for subdirectories):
https://regex101.com/r/aQ2qM1/1
In the referenced example it seems the regex works fine.
However when I apply this regex in Eclipse it does not work.
What's the correct way to write the regex so it works in Eclipse?
Thank you!
You don't need to get all fancy with regular expressions, you can tell eclipse to "Include only" the Folders with a Name matching:
target/scala-2.11/classes_managed
That will exclude all the files that you wish.
From Building OCaml code that uses list comprehension post, I can use _tags file to execute ocamlbuild with less build options.
$ cat _tags
<**/*> : package(camlp4),syntax(camlp4o),package(pa_comprehension)
From the Batteries introduction, I also need to have _tags file to use Batteries package.
<*>: package(batteries)
Why the first example uses <**/*> when the second example uses <*>? In general, what's the purpose of _tags file in ocamlbuild? Do you have some good tutorials on it?
A _tags file in addition to myocamlbuild.ml forms the root of the ocamlbuild compilation system.
ocamlbuild is a very generic tool, that can compile anything. It is driven by a solver, that according to the target, set by a user, finds a solution that can satisfy the target. The solution is a chain of rules that are applied to files. Files can be tagged by tags. Tags can alter rules. For example, it can add flags, like enabling profiling or linking to a library.
A _tags file provides a mechanism to assign tags to files and it has a simple grammar:
pattern ":" tag "," {tag}.
What is to the left of : is actually a pattern or regular expression. Each file that matches the expression will be assigned with all tags that occur to the right of :.
<**/*> means for all files in this folder, and all subfolders, there is a shortcut for this: true. <*> means for all files on this folder (without descending into subfolders). Other examples are <*.ml>, <*.cmx> or <**/*.cma> (btw or can also be used to build a pattern).
OCamlbuild is documented in OCaml Manual, also there is a dump of old wiki, with lots of information.
But the fun part is that usually you do not need to know this in order to use OCaml. There is an OASIS tool that will automate all tasks, and create _tags file for you from a simple and high-level definition.
on kdevelop, you can configure a file filter ( on top of project tree ). Normally, the project tree shows a lot of files with different extensions, e.g xy.conf, xy.prf, moc_xy.cpp, moc_xy.h and so on. I want hide all unnessary files with following regex: [^\moc][a-z]*\.(h|cpp). But if I use this regex, it shows me no files. Whats wrong with this regex?
I also, read this post but the answer: \.(h|c(pp)?)$ doesn't work.
Best regards, Chris
You can only show *.h/c/cpp files in your project by first excluding all files * and then adding these inclusive patterns for them.
Like this, e.g. add this to your .gitignore/.hgignore file:
*
!*.h
!*.c
!*.cpp
If you don't have such filter files, you can configure them in the kdevelop's project fileter by adding includes and excludes:
try this:
.(h|c(pp)?)$
it works when i tested it here
I would like to use the .hgignore file of Mercurial to ignore all files with file extension .tex, except those .tex files in one particular directory and whatever subdirectory of this directory.
I presume syntax: regexp will be required for this.
A brief explanation of the particular regular expression used, would also be very welcome, so that we can all learn a bit here.
Let's say you want to exclude the directory named exclude. The following regex would then match all files that end in .tex unless exclude/ comes somewhere before that:
^(?!.*\bexclude/).*\.tex$