vim: netrw to skip searching directory - vim

When use :Ex to search files under a current project, I would like to search to skip certain directories. The netrm document says that "g:netrm_list_hide" option can be used to achieve this, but my experiments with the options shows it only applies to the filename but not the directory name.
The google search also yields no solution to this. Does anyone know a workaround?

Taken from http://vim.1045645.n5.nabble.com/Hiding-Subversion-directories-within-netrw-td1167827.html
To hide directory names just add a trailing slash when you list them. For example to hide the directory .git/ use the following.
let g:netrw_list_hide='^\.git/$'

Related

How to search a string in a specific file type in VSCode?

It should be quite simple, but sometimes I found that searches in VSCode do not work as expected.
In this below example, I just want to search the string stat in all the JavaScript files in the folder ./ocean-data-qc/ocean_data_qc_js. But, in the search results, I get files of all kind of types:
I also want to search in the subfolders files.
Am I doing anything wrong?
With the expression ./ocean-data-qc/ocean_data_qc_js,*.js it will search across all the files of the path ./ocean-data-qc/ocean_data_qc_js and then it will search on all the js files of the project. The result will be the union of both searches
Instead, the pattern should be ./ocean-data-qc/ocean_data_qc_js/**/*.js to make just one search in all the js files in the folder and subfolders. But it is not working as expected because the files in the .gitignore are included in the search. So, in some way, the pattern in the include section is overriding the excluded paths.
I have found an issue to answer why the .gitignore is not taken into account in that case. As I am working in multiroot mode, I found two solutions that work:
Just using the root folder of the project where I am searching: ./ocean-data-qc/**/*.js. Like this .gitignore is taken into account.
The other alternative is to use the search.exclude attribute in the VScode settings.
Note: The important sections in the VSCode docs: Multiroot search. Advanced search options

How to search only in currently open files in vscode?

I usually work on larger projects with many files that would contain the search query. So I would open the files I want to modify and do a find/replace across all currently opened files. Can this be done in vs code?
The feature I'm looking for is implemented in Notepad++, but I'd prefer not to have to switch editors for this task.
For me somehow it works just by typing ./ in the files to exclude field.
The ability to search only in the open editors is in the Stable Build v1.55.
As you can see, the icon is at the end of the files to include input so you will have to have that showing (click the three dots ... just below the search options if files to include is not already showing).
"Search: target particular set of files #20530" located here: https://github.com/Microsoft/vscode/issues/20530
Is tracking a search "scope" such as "all open files".
Hit Ctrl + Shift + F and enable the icon at the end of the 'file to include' text field
I don't think there's a way to do this. You can make a feature request on github. I think an extension could do it though.
There is a checkbox for this in the "files to include" field since version 1.55 (march 2021).
The answer was already mentioned (and accepted above) indeed typing ./ in the files to exclude box of the search window will allow you to only search in open files.
However the response mentioned that he was unsure why this worked. VSCode allows you to exclude all files in a directory by writing the directory in the exclude box. The directory . is the directory where VSCode is opened ie the root directory. The filter ./ excludes all files in the VSCodes root directory so all files are excluded. However opened files ignore any exclude filter. So if you exclude all files only the opened files will be searched.
The best way to find something you are searching for within a specific file in vs code would be:
Ctrl + p then pressing # on the search bar.
It will give you a list of all functions on the file, which makes it easier to track something down.
As an alternative to using Visual Studio Code itself, you can just search the file contents within the folder where unsaved files open in Visual Studio Code are located. This would be in one of these locations depending on which OS you are running:
Linux: /tmp/ (someone else running Linux can verify this)
macOS: ~/Library/Application\ Support/Code/Backups/
Windows: %APPDATA%\Code\User\
This extension is what I use for this purpose.
You may need to change the keybinding if there is a conflict.

IntelliJ File mask not working on simple excluding file pattern! Why?

Follows this page https://www.jetbrains.com/help/pycharm/2016.1/find-and-replace-in-path.html?origin=old_help#mask , it should be able to exclude many files using "!" symbol in front of the regular pattern like: *.java, when doing text search inside IntelliJ projects.
On my project, when I fired Ctrl + Shift + F to do text search for string xyz. There's over 100+ results return in both *.ftl and *.java files. I tried to reduce the results on only ftl files by changing the "File mask(s)"-Option to "!*.java" . But it did not work! The result list is empty!
Googling on the excluding file pattern results in creating custom file filters for each particular search, which I don't want to maintain!
Do I miss something here or IntelliJ is just bad on this function (I'm using IntelliJ 15)? With Eclipse, the "File mask" was amazing!
You have to use
!*.java instead of !.java
As for IDEA 2019.1 Ultimate, it works for me(exclude with !*.yml or anything else).
If it does not in yours, as you only as .ftl file to exclude, why not add mask as *.java?
PS: what does not work is exclude some path, like "all files under out/ folder". With !out/* or anything ales it does not work.
Forget about File Mask and use Scope:
In Scope the options are unlimited where you can select folder include/exclude files or folders.
Excluding file paths in the Find in Path dialogue was not added until IntelliJ 2016.1 per this IntelliJ forum response.

How can I show dotfiles in Textmate 2?

I recently upgraded to Textmate 2 and now my dotfiles are not showing up in the file browser. Obviously, this is important when working with stuff like .htaccess files.
Is there a way to enable this feature?
Quick solution
Move the focus to the file browser (⌥⌘⇥) and show invisibles (⌥⌘i)(key names: option/alt+command/windows+i/eye). All invisible files will appear in the file browser. Press ⌥⌘i again to hide them.
Permanent solution
If you want to always show some dotfiles (for instance .htaccess), you can either add them in Preferences > Projects > Include files matching…
or add the list of files you want to show to the include array in one of:
~/Library/Application Support/TextMate/Global.tmProperties (same as using Preferences)
~/.tm_properties (global)
.tm_properties (inside a specific directory/project)
You can add all dotfiles (.*) but I don't recommend it since it can be a lot of clutter.
That said, you can also exclude files with the exclude array.
You can modify the behavior of the file browser via the config file ~/.tm_properties
To list all dotfiles and directories, you can set:
include = "{$include,.*}"
If you want to exclude some of those, for example the .git directory, modify the exclude variable:
exclude = "{$exclude,.git}"
There are many more options, check the Textmate site as an entry point for whats possible: http://blog.macromates.com/2011/git-style-configuration/
You can do this in the preferences of Textmate 2.
Navigate to: Textmate -> Preferences -> Projects. You should see two fields, one for including files, and one for excluding. I replaced the value of "Include files matching" with {*,.*} so it includes all normal and hidden files. I then just add the hidden files I want to exclude to the "Exclude files matching" field, such as .git and .DS_Store.

vim fuzzy finder subdirectory search?

Is there anyway to ask Fuzzy Finder plugin for VIM search subdirectory as well? It appears to me that no matter what mode I am in, it either search current directory, or I have to be explicit on subdirectory name for it to dive in.
Another plugin folks here mentioned in fuzzy finder textmate plugin. Unfortunately, this plugin doesn't work with current version of vim-fuzzy finder, or so it appears to me.
Any suggestions?
TIA
Oliver
Use ** to have it recurse down directories.
I use tag mode provided by fuzzyfinder to simulate behavior of Textmate. in short, generate an extra tags file with file's base name as tag, then you can locate any files in the tags file directly by file's base name.
The only drawback is you need to update the file tags file, this is a script for that.
I have been using this method for several months and it works almost perfect.
I summarize my method here
I wanted to contribute to jamessan's answer.
It is true that using **/ before your search will do a recursive search in your directory. However, I've found that it's more useful to have the recursive search enabled by default.
In order to do that, you can add ** to your mapping (mine is ]) (you have to escape the * otherwise it won't work)
map <leader>] :FuzzyFinderFile \*\*\/<CR>
Haven't used Textmate, but LustyExplorer could be what you're looking for. Demo here.

Resources