New answers tagged

0

In order to back to colorscheme, I use this: " Toggle background transparency let t:isTransparent = 0 function! BGToggleTransparency() if t:isTransparent == 0 hi Normal guibg=#111111 ctermbg=black set background=dark let t:isTransparent = 1 else hi Normal guibg=NONE ctermbg=NONE let t:isTransparent = 0 endif endfunction


3

There's a conceptual misunderstanding here. What Vim routinely calls "a plugin" is rather "a configuration extension". Once a script file was loaded, it is cached into RAM and never forgotten until application ends. (It still could be overwritten but it's not the same thing as "removing"). Some "plugin managers" may ...


1

You can save and restore the current tab around the :tabdo operation. You can use tabpagenr() to get the position of the current tab and later you can pass that number to :tabnext to change back to this tab. This is better done in a function, since you can easily run multiple commands and also use a local variable to store the current tab number. function! ...


0

There is no way to do that. Indeed, using an external tool to format the message is the way to go. The tool can be simple, sed is more than enough. Another option is including the whole line in the message by ab-using %+ operator, like: let &errorformat='%+G%\d%\+/%\d%\+ Test #%l: %f %[.*]%#Failed %m' will result in: testname|1 error| 1/1 Test #1: ...


0

The second approach is needed in case Vim don't know the file type. For tab-separated values I use this on my vimrc: au BufNewFile,BufRead *.tsv set ft=tsv And then use FileType as normal. As in the case of using filetype plugin files.


1

To make something work in visual mode, you need a visual-mode mapping (usually :x[nore]map). In this case, we need to do these steps Save the register Restore the selection and do the cut (x or d or whatever) Restore the register if whitespace This is reminiscent of your original function, so let's modify it to take a visual arg: if truthy, do gv before ...


0

The file that is associated with the currently executing autocommand can be retrieved with this function call: expand('<afile>') Somewhat contrived but easy to understand test... augroup AfileTest autocmd! autocmd BufWritePost * echom "I saved file " . expand('<afile>') augroup END After loading this and running :w the message ...


1

You already have all details needed to solve your issue -- zz. Add it to the exe "normal! g`\"" Where exe executes a string as ex commands (here it is needed to overcome vimscript limitations with | and autocommand). Normal commands could be executed as ex commands using normal ex command... anyway this line jumps to a mark " without ...


0

That plugin samoshkin/vim-find-files uses cexpr to create the quickfix list. :cexpr will always jump to the first error. I believe, you can simply replace :cexpr by :cgetexpr and it will just create a quickfix buffer, without jumping to the error. You could create a PR for that.


1

I think you need to change " Comment the line execute 'silent s/\v^(\s*)/\1' . comment_leader . ' /' to " Comment the line execute 'silent s/^/\1' . comment_leader . '/' so that it substitutes at the beginning of the line rather than after any space. The uncomment pattern needs similar modifications:...


0

I do something similar using mappings (note: I prefer the local window location list as opposed to global quickfix for this. If you prefer the quickfix list, just switch 'grep' for 'lgrep', 'copen' for 'lopen', and 'cgetexpr' for 'lgetexpr') map <M-g> :lgrep!<Space><BAR>:lopen<C-Left> -- or, better yet -- map <M-g> :...


1

The linked question in the comments provides some options for what you're looking to achieve. In particular, without any plugins, one can use the solution from this answer inoremap ( ()<Left> inoremap [ []<Left> inoremap { {}<Left> This accomplishes the automatic closing of parenthesis and brackets when you type (,[,{, in insert mode. For ...


Top 50 recent answers are included