New answers tagged

0

I just did a binary search on my vimrc and plugins and discovered the following line in my vimrc that caused this strange behavior: set laststatus=3 When I commented this out, the silly behavior went away.


1

With your cursor between One and Two (in normal mode), type deep.


1

To overcome the lagging caused by naive mapping inoremap jk <ESC>. I have written a plugin called better-escape.vim. Here is how to use it: let g:better_escape_shortcut = 'jk' let g:better_escape_interval = 200 By default, the time interval threshold for the pressing of j and k is set to 150 ms. That is, if the time interval between pressing k and ...


1

From the wiki page, I've always used the other methods that leave the spaces the way they are. Since that time, my mappings have evolved into something like two 30-lines long functions: https://github.com/LucHermitte/lh-misc/blob/master/plugin/vim-tip-swap-word.vim Anyway, a 5 keys sequence isn't long. Moreover you can always define a mapping to shorten the ...


1

As @SibiCoder mentioned ggVG does the trick, but I like something closer to Ctrl+A. So I added this line to my .vimrc nnoremap <leader>a ggVG Now pressing <leader>a will select everything, in my case it's \a.


2

Off the top of my head perhaps something like this in your vimrc... let g:localconffile = '.myvimconf' func! LoadLocalConfig() abort let l:fname = expand('%:p:h') . '/' . g:localconffile if filereadable(l:fname) exe "source " . l:fname endif endfunc augroup localconf autocmd! au VimEnter * call LoadLocalConfig() augroup ...


1

I have not a direct way, but you can use a command as a workaround. I am assuming the <++> is the terminology you want to insert. autocmd Filetype tex inoremap :nx <Esc>:NX<Space> command! -nargs=1 NX execute "normal! i\\emph{".<q-args>."} \\index{".<q-args>."}".<q-args>."01k\<Esc>&...


2

Welcome to Vim :) In 3kA there are two "getting started with Vim" lessons in this, a path which @filbranden pointed you down, but to make this more explicit... #1 is "motions" and #2 is changing from 'normal mode' to 'insert mode'. Motions: :help k brings you to the "3. Up-down motions" section of the help manual, in which it ...


2

As the OP noted and can be found in What's the functional difference between the key notations "\<xxx>" and '<xxx>'?, we need :help expr-quote here: " note that I prefer nnoremap nnoremap <expr> <space>t ManageTerminal() function ManageTerminal() if bufname('terminal') ==# 'terminal' if expand('%:t') =...


1

This behavior is documented in :help recursive_mapping: There is one exception: If the {rhs} starts with {lhs}, the first character is not mapped again (this is Vi compatible). For example: :map ab abcd will execute the a command and insert "bcd" in the text. The ab in the {rhs} will not be mapped again.


0

Normally vim prevent a mapping to go crazy by limiting the maximum number of recursion. You can set the value of the maxmapdepth option (see :help maxmapdepth): 'maxmapdepth' 'mmd' E223 'maxmapdepth' 'mmd' number (default 1000) global Maximum number of times a mapping is ...


1

(First I think I have to say is that my environment is simply Terminal and zsh, all I use are built-in stuffs provided by macOS.) In INSERT MODE I typed option + ⌫ then strangely <S-Insert> appeared (I think this is because I modified the Terminal preferences to make option + ⌫ be mapped to \033[2;2~) , then I used the following and it works: imap <...


2

One option is instead of trying to bind a key combination to this action, just use the default key binding for it, which is Ctrl+W. See :help i_CTRL-W. This same key binding should be available by default in zsh (or bash, etc.) so you could just use it everywhere with no need for custom configuration. You could try to map Option+⌫ to do the same in Vim... ...


1

There are a few ways you can handle command-line editing in Vim mappings. For starters, there's CTRL-\ e which allow you to fully replace the contents of the command-line with the result of an expression. (The documentation at :help c_CTRL-\_e has example usage.) In general, you can use getcmdline() to find what is currently in the command-line, in order to ...


Top 50 recent answers are included