VanLaser
  • Member for 6 years, 9 months
  • Last seen more than a month ago
How move cursore "past the first paired delimiter" (quote, parentheses, etc) - searchpair()?
2 votes

This is a simple one, you can add more delimiters in the [ ] group, but it won't check for the "inside" of anything: inoremap <C-x><C-x> <Esc>/[\])}"]/e<CR>a, It just ...

View answer
Get index of search in substitute expression
Accepted answer
3 votes

Here's a way to do it (maybe not the simplest way), using a recent Vim8 feature: closures (*): In your vimrc, add the following (reusable) function - a function that returns a reference to another ...

View answer
Shortcut for applying a command between the last two marks
3 votes

Using 2 marks to operate on the text between those lines is the 'vi'-compatible way of the more modern and (literally) visual way of operating in Vim (and probably why visual mode was invented in the ...

View answer
Vim-easy-align: how to align delimeter on right
0 votes

I don't get what the difficulty is, unless you are not aligning using Space as delimiter, and/or you don't specify the region to align. Nobody forces you to use : as delimiter. Steps: Visually select ...

View answer
How do I check the version of NeoVim in vimscript?
7 votes

There is probably a direct way (?); if not, here's a function that parses :version to extract and return the actual value (as string): function! GetNVimVersion() redir => s silent! version ...

View answer
Ability to make vim run commands in background and only show the final result on screen
Accepted answer
5 votes

To avoid "seeing" the effect of each command run from a map or macro, use: set lazyredraw .. so that the screen is only redrawn once at the end - which makes the whole process (much) faster (see :h ...

View answer
What is the current 'best practice' for persistent preferences for a plugin?
Accepted answer
6 votes

One way to do it is to have your plugin define a global variable storing the path to that specific "persistent settings/enabled filters" file. This is similar to how various plugins that have to '...

View answer
Defining my own key
1 votes

Here's an interesting usage that I first saw (and wandered about) in Shougo's Unite plugin, which creates an artificial leader key "placeholder" (I'm quoting directly from the Unite's help file): " ...

View answer
Cursor to last edit works, last position doesn't
6 votes

(just for completness) I use this, adapted from Vim's help: " restore cursor position, if known, and unfold the area autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") ...

View answer
Move cursor from surrounds
Accepted answer
3 votes

You could start from this map (and improve it according to your taste): inoremap <C-x><C-x> <Esc>/[[({,]\_s*/e<CR>a .. which maps Ctrl-x Ctrl-x in insert mode to jump after a ...

View answer
Can't get deoplete plugin working in Neovim
Accepted answer
6 votes

Vim uses Ctrl-n (next item) and Ctrl-p (previous item), Ctrl-y (accept match) or Ctrl-e (cancel) and so on for completion. See :h ins-completion-menu and :h popupmenu-keys for details. The following ...

View answer
Text expansion for LaTeX editing
Accepted answer
3 votes

You can change any set of numbers (e.g. 24,10,4 to $24\ux,10uy,4uz$) with something like this: :%s/\v(\d+)(,\d+)(,\d+)/$\1\\ux\2\\uy\3\\uz$/g

View answer
How to stop quitting vim but close windows?
7 votes

If it's windows you're after, use :close or ctrl-w c to close windows one by one (except the last one - it won't let you do it). You also have :only to keep just the current window and close all ...

View answer
How do you indent > < without leaving visual mode and losing your current selection?
Accepted answer
21 votes

I have this in my vimrc: "keep visual mode after indent vnoremap > >gv vnoremap < <gv Note that you could also simply use . (dot) to repeat the last indent action.

View answer
Motion remap to select function doesn't work with v
3 votes

You (also) need to address the visual mode map (onoremap doesn't do that): :xnoremap <silent> f( :<C-U>normal! f)vF(b<CR> See also: http://vim.wikia.com/wiki/...

View answer
Replacing last comma on each line
3 votes

An alternative, just for the sake of it :) %s/\v.*\zs,\ze[^,]*/| This can be translated as: go search (s) on each line (%) for any number of chars (.*) followed by "a comma not followed by another ...

View answer
Visual block yank to end of line
Accepted answer
8 votes

Maybe this? xnoremap Y :yank<cr> Being an ex command, :yank will automatically copy whole lines.

View answer
How to automatically lower case the second letter of a word?
1 votes

Another way to do it (not so automatic, and not so universal; just shorter): since you are writing sentences/prose, not code, have Vim activate spell checking in your text buffers create a fast ...

View answer
Quick search, limited to a C++ function
3 votes

Another way: use ctags etc. to find the target function, go there move cursor forward inside the function body use Osyo Manga's search operator (depends on vim-operator-user) to only search inside ...

View answer
Why does replace not accept a motion?
Accepted answer
4 votes

Actually. There is no reason, apart from things being as they are, that would be against an r operator. The simple fact that viwra works means that riwa could work. The reason is simply a historical ...

View answer
Same vimrc, customized per machine
7 votes

Provided that you (or your system) can export the environmental variables that you need, you can do something like this in your .vimrc (here I use the vim-plug plugin manager as an example, and ...

View answer
Line completion disregarding line prefix
Accepted answer
4 votes

It's ... built-in. It's just not line completion, because, you're saying it, it's not an entire line you want to complete. If we start from your example: ; A sentence I would like to auto complete. ...

View answer
Neosnippet expands to "options head"
2 votes

It's because you indent the snippet options ('keywords'), by not following the help example (:h neosnippet-snippet-syntax). So, you need: snippet stdlib options head alias std #include<stdlib....

View answer
Executing a command on delimited lines
5 votes

A more specific answer (since you seem to be editing a TeX file): if you use the vimtex plugin (although LaTeX-Box also has this IIRC), you can easily select the whole environment (without the \begin ...

View answer
How can I really have some fun in Vim?
7 votes

Imagine a file format for another hobby you have, and write a Vim plugin for it, just for you. For example, let's say you like to compose crosswords / puzzles. In this case, you could use/create a ...

View answer
Vim Pandoc & Headers
Accepted answer
2 votes

If you read vim-pandoc's help (:h pandoc.txt) you will see, in the section called *vim-pandoc-keyboard-module*, this line: <localleader>#* apply header (accepts a count) [n] Notice the [n] ...

View answer
Source vim session file: Track down unexpected sourcing of other file
Accepted answer
6 votes

See :h :mksession, the 10th point: If a file exists with the same name as the Session file, but ending in "x.vim" (for eXtra), executes that as well. You can use *x.vim files to specify ...

View answer
Smart word completion when in the middle of a word
Accepted answer
5 votes

The following is only a quick mock-up answer (i.e. functional until it doesn't, or until it breaks something :) ), but it shows that "it is possible": augroup completion autocmd! autocmd ...

View answer
Join multiple lines
3 votes

What you do is almost .. graphical, so I'd use the mouse! (of course you need :set mouse+=a) Select a block with the mouse, then Ctrl-v y to yank the selection in "control-block" mode (<- that's ...

View answer
What does an `autocmd User` do?
Accepted answer
4 votes

In my understanding, that example creates a User autocommand named YouCompleteMe which will be fired by vim-plug itself, in order to load the plugin on demand. If I'm not mistaken, here's the place ...

View answer
1
2 3 4 5