Search by filetype in sublimetext3 - search

I know that it is possible to filter a search query in sublime to only look at/through certain filetypes, but I don't remember the syntax to do so. As far as I can recall, it was something like
..//filepath/ *.scss, *.css, *.xckv, -*.etc
Can anybody help me out here?

When you type 'MAJ+Ctrl+F'
You see the input at bottom of screen.
Line 1 : Find Input
Line 2 : Where Input
Line 3 : Replace Input
At right of Where Input, click on the three dots, and select 'add Include Filter'

Related

Sublime add text per 5000 lines

I have large .sql file with (multiple inserts).
I want using sublime 3 to add per 5000 lines , one command like :
commit;
Is it possible ?
Thanks ijn advance
Using regex you can capture a line using : (.+\s) .
Then add a quatifier to determine the number of lines you want to capture: {5000}
And replace the Group of N lines by : "[Group of N lines][My new Text][newLine]"
It give you : `$0newData\n
Here is an exemple on a simple text file, with "newData" every 3 lines. And an online exemple.
Nb: Click the .*, to activate the "Use regex in find search" option.

Vim GitGutter deletes unstaged hunks

I'm having some weird problems with my GitGutter.
If I have added some lines to my code:
1 oldline1
2+newline1
3+newline2
4 oldline2
and then I close the file (wq) and reopen it. it looks like this:
1 oldline1
2+---- 2 lines: newline 1-----------------------
4 oldline2
Why is it doing this and how can I prevent/resolve this problem in the future?
Thanks in advance for any tips!
Edvin
What you are seeing is called a "fold", it is a compressed view that shows multiple similar line into a single line. Nothing is deleted, it is only hidden.
You can read :help fold-commands from inside vim.
The most useful and basic commands are :
zo : to open a fold (while being on the active line)
zc : to close the fold again
Similarly if you want to apply it on the whole file you can use zO and zC.
I am not familiar with GitGutter but if you don't want to use any fold, search for that keyword in the configuration file (if there is any).

when using vim-latex gq causes overhangs in captions

When I am editing a LaTeX file using Vim-LaTeX and want to reformat a section of text that is in a \caption{} I get overhangs or underhangs - I am not sure what to call them. I first select the text in the caption then use "gq" to reformat it. After reformatting the caption looks like:
\caption{The problem is that when I reformat the text
in a caption the text on each successive line
begins further and further to the left until it begins
at the first space of the line.}
what I would hope the result would look like would be something like:
\caption{The problem is that when I reformat the text
in a caption the text on each successive line
begins further and further to the left until it
begins at the first space of the line.}
I hope the formatting in this post remains true to what I typed in, but I tried to describe the problem in the first example caption. The second should be left justified.
Does anyone know what I need to do to fix this? I am assuming that there is a setting that I need to change, but I have not been able to figure out what it is.
The gq command formats based on 'formatexpr' or 'formatprg'. You can start by checking the values of these options with :se fex? and :se fp?.
From looking through the vim-latex plugin it never sets these options, so this is likely set by your other plugins or vimrc. You can find out exactly where an option is set by using :verbose.

Vim folding : how to hide all the single lines not containing a search pattern (or fold zero line)?

I have text files which are simply lists with no paragraphs.
When I want to focus on an item, I am able to fold everything except for matches to my search, thanks to Vim Wikia (Tip 282 :"Simple Folding") :
:set foldexpr=getline(v:lnum)!~#/
:nnoremap <F8> :set foldmethod=expr<CR><Bar>zM
This proves to be useful : thus I can see very clearly the items I am looking for : they appear in white on a black background, whereas the folds are darkgrey (ctermfg) on grey (ctermbg).
But there is a - minor - glitch. It may happen (and, in fact, it often happens) that a single line not containing the pattern remains between two lines containing the pattern, eg :
1 pattern
2 not pattern
3 not pattern
4 pattern
5 not pattern
6 pattern
Simple foldind will fold away lines 2 and 3, not line 5.
How should I proceed to hide away this single line ?
Is there a way to fold zero line (this reminds me of the koan about one hand clapping…) ? I suppose that this is not possible.
So, is there a way to simply hide the line (e.g. with the same highlighting as the folds) with a function ?
try to set another option:
set fml=0
for details about this option:
:h 'fml'
relevant to your question:
With the default value of
one a fold can only be closed if it takes up two or more screen lines.
Set to zero to be able to close folds of just one screen line.

Vim - Select text in between parentheses, multiline

value(val_1)
value(val_100)
value(val_10)
I want to select text between parentheses and do it for multiline, for one line I can use f(va( but I don't know how to select for 2 remaining lines.
EDIT (SOLUTIONS)
What I want to is to change text inside parentheses with unique text every line, firstly, I was thinking to select the text, delete it then change the text manually, #rosipov tell there is a plugin to do the selection part and it's great, but #romainl gave me another direction that works too.
f(ci(foo<Esc>jci(bar<Esc>jci(baz<Esc>
Do you want to select this:
value([val_1])
value([val_100])
value([val_10])
or to select that:
value([val_1)]
[value(val_100)]
[value(val_10])
The first is unfortunately not doable. But depending on what you want to do with the selected text, change it for example, a reasonable approximation would be:
f(l<C-v>jj$cnew value)<Esc>
However I'm sure a lot of Vimmers would probably approach the problem with a substitution:
:,+2s/(.*/(new value)
The second is done simply with:
f(lv3/)h
or
f(ljjt)
You will probably be interested in EasyMotion plugin in this case: https://github.com/Lokaltog/vim-easymotion
With plugin it will be: f(vLeaderLeaderf)c
Or: LeaderLeaderf(avLeaderLeaderf)c
Where c is letter representing 3rd closing parentheses, a represents first opening p.
EDIT: Without plugin it is possible to do it by line number.
Assuming that you work with lines 1-3: f(v3Gf)
Where 3G stands for "go to line number 3", works in both visual and normal modes.

Resources