Hot answers tagged

3

:vimgrep can take multiple file globs. In simple cases that means you can potentially search only places you want instead of excluding (think white-listing vs black-listing) :vimgrep /foo/ bar/** baz/** Often :vimgrep isn't up to the task from performance and/or complex searching perspective. Instead you can use Vim's :grep command to use an external ...


3

Use the Cfilter plugin that comes with vim: :packadd cfilter :Cfilter! /xyz/ (more at :help cfilter-plugin) See :colder and :cnewer to move between different versions of the quickfix list.


3

ALE's readme says ALE offers support for fixing code with command line tools in a non-blocking manner with the :ALEFix feature so ALEFix is asynchronous and your yanking commands would need to wait for it to complete before they run. If you look further in the Readme in the FAQ there is How can I execute some code when ALE starts or stops linting? The ...


3

You can invert a boolean with !: let foo = 1 echo foo " will print 1 let foo = !foo echo foo " will print 0 I'm afraid I can't help much with the overall function as I am unfamiliar with minimap, but that might help you get started. Note that the syntax in your ternary operatory is incorrect. If you are doing it that way you want: let foo = foo =...


2

In Vim, if you look at the source code for buflist_new() which adds a filename to the buffer list you'll find the part where the b: dictionary is initialized // init b: variables buf->b_vars = dict_alloc(); if (buf->b_vars == NULL) { vim_free(ffname); vim_free(buf); return NULL; } init_var_dict(buf->b_vars, &buf->b_bufvar, ...


2

You have several ways to do it: You can use <bar> which is the key code for | to be used in a mapping (Do not use | directly in your mapping): nnoremap <leader>a :echo "fizz" <bar> echo "buzz"<CR> This is the equivalent of running :echo "fizz" | echo "buzz" in the command line. You can also ...


1

Mapping the escape key like this tends to break things because of the way certain special characters are handled (references needed/appreciated). I would also recommend avoiding <C-t> and <C-]> as they are pretty useful commands (:help CTRL-T, :help CTRL-]). You might want to know about gt and gT for navigating tabs. They also take a count. Here'...


1

A substitution like this works for all scenarios: %s/print(\(.*\))/log.info(" ".join([\1]))/ Grab everything within print brackets (.*) using regex replace the match with a join statement surrounding the match replace the print with log.info (or whatever is required) Here is the test script if anyone wants to try it for themselves: import logging,...


1

After some try-and-errors I resolved this problem. Btw, if I add to it, would the never be triggered? Yes. Change nnoremap <C-W> <NULL> to: nnoremap <C-W> <ESC> Since normally no key will follow <ESC>. (Remember when you were a newbie and wanted to escape from it) Result, done in 1 second:


1

Finally, I decided not to re-invent the wheel, and this problem seems to be more difficult than I think. So, I give Vem-Tabline a try and it works nicely, and the default settings of this plugin are good, so no need to put code into my .vimrc. Nice! Now my MacVim looks like this, the prefix of buffer names are now skipped by default:


1

You can pass a command when starting up with -c (or +): vim -c 'PlugUpdate' You may also want to pass qall if you are running this from a script.


1

Knowing from :help ale-python-pylint that we want to adjust g:ale_python_pylint_options to include --rcfile, I would drop let g:ale_python_pylint_options = '--rcfile '.<filename> in wherever the right place is for you. That could be wherever you configure ALE, if a single setting is right; or, it could be in an ftplugin (use b:…) if you need to change ...


1

You can only call plug#begin() and plug#end() once, so no this will not work. You can define all your plug-ins from the same place (such as the vimrc file) and use a conditional to detect whether you're running NeoVim to load plug-ins you only want on NeoVim: call plug#begin('~/.vim/vim-plug-in') " Vim + NeoVim plug-ins if has('nvim') " NeoVim-...


1

Just put the terminal colorscheme in your vimrc (usually ~/.vimrc or $HOME\_vimrc on Windows) and the gui colorscheme in your gvimrc. Create ~/.gvimrc / $HOME\_gvimrc if you don't already have that file. This works because gvimrc is only read when you run gvim and it is read in after vimrc


1

Here's a simple version, assuming fugitive or dispatch are installed: augroup update_vimrc autocmd! " for dispatch, automatically async " use a ! or other dispatch commands for more control autocmd VimEnter Dispatch git -c ~/dotfiles pull " or for fugitive, not so async autocmd VimEnter Git -c ~/dotfiles pull augroup END If those ...


1

The question is invalid. Maybe XY problem or something. If &indentexpr is set to some function then that function calculates on-the-fly the number of spaces to indent a line. If also &expandtab is not set then Vim is allowed to minimize that number by outputting tabs - one hard tab per &tabstop spaces. But if you set expandtab then you say: "...


1

Building uppon Lie Ryan's answer and the code provided above (it is described here) . Change your function parsing the git branch as follows: let g:gitparsedbranchname = ' ' function! UpdateGitBranch() let l:string = system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") let g:gitparsedbranchname = strlen(l:string) > 0?'['.l:...


1

A slightly neater looking alias: alias vimprivate='vim -u NONE -c "setlocal history=0 nobackup nomodeline noshelltemp noswapfile noundofile nowritebackup secure viminfo=\"\""'


Only top voted, non community-wiki answers of a minimum length are eligible