Hot answers tagged

5

Yes, using :h :windo: nnoremap <C-a> :windo set relativenumber!<CR>


4

To specify the font size you need to prefix the size with an "h", so the correct command would be :set guifont=Courier:h14.


3

Yes, expand(.) with argument '<cfile>': expand({expr} [, {nosuf} [, {list}]]) *expand()* Expand wildcards and the following special keywords in {expr}. 'wildignorecase' applies. ... When {expr} starts with '%', '#' or '<', the expansion is done like for the |cmdline-special| variables with their ...


3

My version of the mapping (which mostly works, unless the replacement made the text longer, in which case you end up in the wrong spot), is as follows (<C-g>u used to break up the undo sequence): inoremap <C-L> <C-g>u<Esc>[s1z=gi<C-g>u gi should work slightly better than the ] mark, which is the last-changed text.


3

You need to add a literal newline (displayed as ^M). You can type this character into your _vimrc by holding down Ctrl and typing v followed by m, and then releasing Ctrl. So for each line you would have: normal i __ __ __^M normal i / | / |/ |^M " etc... where ^M is not the characters "^M" literally, but the result of typing Ctrl+...


3

com! -nargs=+ PS let @/ = printf('\v%s(\W+\w+){,%d}\W+%s', <f-args>) The way this is intended to work is to act as if you entered, after hitting /, the same search term that was provided in the answer to your question. So when you run the command you just need to use n and N to go forward and back to any matches. The / register always contains the ...


2

Setting the MYVIMRC environment variable does not affect what vimrc file is used for startup. I think you may have misinterpreted this bit of documentation: The $MYVIMRC environment variable is set to the file that was first found, unless $MYVIMRC was already set [...] This does not mean that Vim will use the file found in the MYVIMC environment variable ...


2

From my comment: You might want to try inoremap <A-w> <C-o>w and inoremap <A-b> <C-o>b Control-o is like a oneshot normal mode: you get one “operation”, and then you’re back in insert mode. I rarely use it except in mappings, though I don’t tend to move around much in insert mode.


2

Try this: :echo index(v:argv, '-u') != -1 ? get(v:argv, index(v:argv, '-u') + 1, '') : '' Require the patch 8.1.2233. See :h v:argv. At this moment, Neovim 0.4.4 does not have the patch and Neovim 0.5.0 has the patch.


2

To apply Ex command to an arbitrary selection you can do the following: Copy selection to the end of file Select those new lines and run the command Cut the result Replace old selection with the result Of course, it's no good in doing this manually, so the plugins exist. I know of VIS (written by DrChip), and vim-opera (that one is mine; it also provides ...


2

Let's look into vim source code: There is a function which is called when a change was made: https://github.com/vim/vim/blob/85629985b71035608a37ba3bde86968481490d46/src/change.c#L429 This function triggers foldUpdate: https://github.com/vim/vim/blob/85629985b71035608a37ba3bde86968481490d46/src/change.c#L537 Which does folding (including foldexpr): https://...


2

I remembered that I can load vim without any vimrc file using this command, which made the problem disappear. gvimdiff -u NONE file1 file2 I went to my vimrc and commented out the first 30 lines, then the first 60 lines, and so on until the problem disappeared. The offending line in my vimrc was cd c:\a\b. (I'm using dummy names for the file system of course....


2

It works for me. All I need to do is use :set spelllang+=it (to spell both English and Italian), Vim offers to download the spelling dictionaries for Italian, installs them in place and stops marking valid Italian words. :set spelllang+=it Cannot find spell file for "it" in utf-8 Do you want me to try downloading it? (Y)es [N]o: And so on... I'm ...


1

The problem you're having is that your file is being recognized as filetype=plaintex, which means TeX (or '"plain" TeX) and not LaTeX, and the latex-suite plug-ins only enable most of their commands on LaTeX files. LaTeX files are identified by filetype=tex (which can indeed seem quite confusing.) Since files with the extension *.tex can be TeX or ...


1

In vim, listchars is a global setting, so it is not possible to configure it per-window. It is possible however to turn on and off list, using setlocal list and setlocal nolist. In neovim, listchars is a global or local-to-window setting. So to configure it per window you merely need to use setlocal listchars=eol:c


1

Thanks @danidiaz and @Jake, You both seem to be heading down similar paths and I had not even thought of doing it that way. Here's what I came up with as a 2D .vimrc comment display format directly in the .vimrc file. Let me know what you think. " "= GENERIC CLIPBOARD YANK <F2>y (Y for Yank) "= Yank the entire contents of the file into ...


1

A Vim macro is just text stored in a register, which is taken to represent normal mode commands. Perhaps you could write commented Vimscript functions that constructed and returned a command string, like this: func MakeMacro() let l:m = "" " some comment let l:m .= "ifoo" " some other comment let l:m .= &...


1

I presume you run (g)Vim with a shortcut. there is current working directory in vim :lcd to see it and :lcd dir to change it. (if you run (g)vim.exe or shortcut it would be path to (g)vim executable) depending on how your python script is implemented, it might read this json file from current working directory (it is inherited by :!) not from your script ...


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