New answers tagged

2

This is perhaps not exactly what you're looking for, but setting the 'linebreak' option adds enough whitespace to the right margin to create enough of a visual buffer, when 'wrap' is enabled. Typically, it will insert at least one space before the end of a wrapped line. If a word would end exactly at the margin, adding a space will move it to the next line. ...


1

Do the :execute inside your mapping instead. You don't need to use <Space> in mappings, you can just use an actual space instead. You probably want to include a <cr> at the end, to actually execute the :Files command and not leave it pending on the command line waiting for you to press enter (but, again, maybe that's what you want?) Putting it ...


0

Quick thoughts: If the lines are too long, try set wrap You could also resize the window with the resizing commands (e.g. <C-w>>)


0

FileType autocommands are triggered when the filetype option is set. Hence to reload an autocmd you added/edited, after :so $MYVIMRC, you should do something like :set ft=<your filetype> on the target file. As a mapping to do that automatically : noremap <leader>rft :exe ':set filetype='.&filetype<CR>


1

You can use the writefile() function to write to an external file from a Vimscript function or mapping. (Using external shell commands through ! or the system() function would be another possibility, but sticking to a native feature of Vim is probably better.) Consider that you'll need to have permissions to write to the aforementioned file from Vim under ...


3

Typically what you want is for backspace to send ^? and not ^H. (I need a citation, but this is typically how modern terminals work.) It looks like MobaXterm has an option to have backspace send ^H, I imagine that option is currently set on your MobaXterm, perhaps start by trying to uncheck that option. Then you should look into why Vim has an impression ...


2

You can specify specific commands for some file as the following: autocmd BufEnter filename/pattern set commands I my case I have to explicitly hide the number column for the Tag List window: autocmd BufEnter __Tag_List__ set nonumber norelativenumber


1

If :Tlist comes from the taglist plugin, from the docs, I can see : To not display the Vim fold column in the taglist window, set the 'Tlist_Enable_Fold_Column' variable to zero. So in your .vimrc, do let Tlist_Enable_Fold_Column=0 Note that this column helps you see how the folds are applied. You can toggle folds with za. For more infos about folds, ...


0

:h xterm-function-keys An xterm can send function keys F1 to F4 in two modes: vt100 compatible or not. Because Vim may not know what the xterm is sending, both types of keys are recognized. The same happens for the <Home> and <End> keys. normal vt100 ~ <F1> t_k1 <Esc>[11~ <xF1> &...


1

As one of the maintainers of the dracula theme, I believe what you are seeing is dracula’s italics (which fallback to this highlighting in terminals not supporting italics). As noted in :help dracula, you can turn this off by doing let g:dracula_italic = 0 before you load dracula.


2

The FileType plugin for vim files sets the format options. It contains the following line: setlocal fo-=t fo+=croql If you want to overwrite this, create the file .vim/after/ftplugin/vim.vim and add your personal formatoptions to it. When Vim loads the .vimrc it will first load the global vim.vim FileType plugin and then load .vim/after/ftplugin/vim.vim. ...


0

UltiSnips#SnippetsInCurrentScope return all snippets whose trigger matches the current word, I think the match here means =~, not ==. You need to check word before cursor and the triggers by yourself: function! s:is_ultisnips_expandable() " get word before cursor let word = matchstr(getline('.'), printf('\v\w*%%%dc\w', col('.') - 1)) if(empty(word)) ...


3

You can surround the config/code in question with a conditional based on an environment variable. One good candidate is envvar HOSTNAME which is likely to be universally available and (locally) unique. For the example you mentioned we'd just need to add something like... if $HOSTNAME == "foo" au! redhat BufReadPost ... endif Of course, we can also ...


0

You might need to add <esc>a, especially if you are using YouCompleteMe plugin along with SnipMate. imap <tab> <esc>a<Plug>snipMateNextOrTrigger Also verify that tab key is working by pressing ctrl+i, as it is identical to <tab> in Vim. Finally, check your .vimrc if there is set paste, and remove that line if it exists or ...


1

The colorscheme in question, "monokai-tasty.vim" does not properly set g:colors_name: let g:colors_name = "vim-monokai-tasty" g:colors_name should be set to the file name of the colorscheme without the .vim. Correct: let g:colors_name = "monokai-tasty" When the two differ, setting colorscheme initially appears to work. However there are instances where ...


0

I think what you are looking for is the variable g:tex_flavor. Put this in your vimrc file: let g:tex_flavor = 'context' For more information, see :help g:tex_flavor.


1

autohide_types is a global variable, it should be declared like this let g:autohide_types='b' But if you want to add type to existing list it should be like this let g:autohide_types.='b' Unfortunetly this plugin works only with glob patterns and does not works with regexp. But it has public function Autohide_DoHide({file}). So workaround You must ...


4

They are likely overridden by your colorscheme of choice (even if it is default). My suggested fix is augroup colors au! au ColorScheme * hi whatever augroup


0

Try the following: hold down shift key before you press mouse button.


2

Try turning off the signcolumn: set signcolumn=no


3

When you register it this way, your new autocommand will be triggered after all other autocommands registered on the same event, in particular after the one that sources your ftplugin -- I suppose you define the mapping in an ftplugin (*). You could change that, probably by changing the order between this line and the :filetype xxxx in your .vimrc, but this ...


2

While mappings and abbreviations in insert mode should work, Vim has a large number of plugins -- some of them may have proven and largely tested solutions since what you are asking is probably a common feature. Some of the keywords you could try searching plugins for are complete and braces. This last search, for example, brings vim-c-cr: Finish braces, ...


1

If you want to use the clipboard directly from Vim, you'll need a version compiled with either the +clipboard or +xterm_clipboard features. On non-macOS Unix systems, those generally require at least X11 libraries. Without those features, Vim itself has no way of talking to the clipboard. You'll also need X forwarding enabled on your SSH connection (ssh -X). ...


4

Use remap to trigger expansion imap "prg prg<c-a> or exe printf('imap "prg prg%s', g:UltiSnipsExpandTrigger) But not this: imap <expr> "prg 'prg' . g:UltiSnipsExpandTrigger g:UltiSnipsExpandTrigger is a variable, map won't figure out special key code of it's value for you. Manual expansion inoremap "prg prg<c-r>=UltiSnips#...


Top 50 recent answers are included