New answers tagged

1

You seem to be under the impression that "exec" is used to execute external shell commands, but that's not the case. The :execute command is simply used to run a Vimscript from a string, and this is used in this case to assemble a shell command-line from a string, to include arguments for the contents of the current line and also the path to the figures/ ...


1

Set nocompatible When you use a separate vimrc through the -u command-line flag, the nocompatible option will not be automatically set, as it is when using the normal user vimrc file. See :help compatible-default for more details. You should either add set nocompatible to the top of your alternative vimrc file, or pass Vim the -N command-line option in ...


1

D. Ben"s answer is correct one but a bit terse. I also answered a similar question with detailed solution at How to set a colorscheme that still shows spelling errors? au is very useful!


4

Here is a bit more complete answer to address this annoyance: " Force to use underline for spell check results augroup SpellUnderline autocmd! autocmd ColorScheme * \ highlight SpellBad \ cterm=Underline \ ctermfg=NONE \ ctermbg=NONE \ term=Reverse \ gui=Undercurl \ guisp=Red autocmd ColorScheme * \ ...


1

3 options Restart vim (using sessions, e.g., with tpope’s obsession plugin, this isn’t really too bad) Source only your vimrc (if it changed)—you have this Load files with runtime (I use Runtime from tpope’s scriptease plugin).


0

Are your "modified files" not sourced by default of from within .vimrc? If you add the source /path/to/additional/config/file directive to your .vimrc, that would do the whole thing in one go. You can then even nnoremap <leader>r :source ~/.vimrc<CR> to have <leader>r (default <leader> is /, I believe) reload your config ...


1

According to Vim documentation (:help -c) there can only be a maximum of 10 +{command}, -c {command} and -S {file} option arguments combined when starting Vim, and they execute _after_ the first file is read. The --cmd {command} option allows an additional 10 commands to be executed before processing any vimrc file, but bear in mind that any settings can be ...


3

You can use counts in a mapping just as you can use them in normal mode. Of course, when you want to use the count you're not in normal mode: you're in command-line mode. A quick hack is to use the command-line window: :nnoremap <leader>gg :vimgrep // **/*.py \| clist<C-F>17<Left><C-C> You can also use repeat to create the series ...


3

This is not a direct answer to "moving the cursor a large number of times in a nnoremap" or to "another way to repeat 18 actions without such a long list of keystrokes in a mapping's definition", but it's a different approach to the problem you presented. Consider creating a new user-defined command for that operation. That way, you can have the command-...


1

UPDATE: It looks like you were trying to get help on plug-ins. For that, you can simply call :help. Vim will look for help files in the plug-in directories, so something like :help pymode will work. If you build the help tags for plug-ins (for instance, with the :Helptags command of pathogen, or :helptags ALL if you're simply using packages), then the ...


5

I screwed up slightly on which :verbose map to use. Since it's while editing, and the relevant mapping is imap or inoremap, :verbose imap/:verbose map! would be the right command. In this case, the reason I had such weird behavior is because of the function it's mapped to. It calls a function in a parentheses auto-completion/utility library, and ...


1

According to the documentation: (help speeddating) One can use the :SpeedDatingFormat command to list, add, and remove formats. A good place to place custom formats is in .vim/after/plugin/speeddating.vim For the formats you listed: SpeedDatingFormat %Y/%m/%d SpeedDatingFormat %Y/%m


1

It's possible to do this internally in Vimscript, without shelling out to an external executable. Vim's regular expressions include support for "equivalence classes" i.e. characters that "have almost the same meaning, e.g., when ignoring accents". (See :help /[[=.) For example, you can replace the first ş in the current line with s by running the :...


2

Marks are stored in viminfo not in a session and the viminfo file is only written when exiting vim. So if you are closing vim to switch projects then vim will only have marks for the previous project that you were working on. One would potentially have to come up with a plugin that separately reads and stores marks from viminfo when calling :mksession and ...


1

You can implement a mapping to translit a visual selection by using the system() function and passing the contents of the selection as the input to the system command. This mapping should work: xnoremap <leader>T ygv"=system('iconv -f utf-8 -t ascii//translit', @@)<cr>p Breaking it down: y: Yank the visual selection into the default register. ...


Top 50 recent answers are included