# All Questions

7,866 questions
Filter by
Sorted by
Tagged with
8 views

### Toggle terminal buffer vimscript function

I'm new to vimscript and writing a function to toggle a terminal buffer. Here is what I tried: let g:toggle_term = "<C-j>" let g:term_buf_nr = -1 function! ToggleTerminal() if g:...
12 views

### Sourcing vimrc duplicates statusline in nvim

I'm new to vim so I'm not sure if this is intended behavior or not, but it seems like a bug. Desired Behavior After sourcing vimrc from within nvim, don't duplicate the contents of my statusline. Or ...
6 views

### Change definition of “under the cursor” for ctags with C++ qualifiers

When jumping to a tag it seems that ":" are ignored for the purpose of "under the cursor" (I'm assuming it's "word" "under the cursor"). For example if I want to jump to myTree::Node something I ...
17 views

### Visual/Operator-pending autocommand?

Last week, I turned off 'number' and have been using only 'relativenumber', plus a line/column count in my status line. I don't really look at line numbers that much. But now I've had a radical idea. ...
18 views

### Is it possible to make a terminal frame to be appeared on the bottom, not on the top?

I'm using :term bash to show a terminal buffer as it is specified in :h terminal-use. But the problem is that it is appeared on the top of the currently active vim buffer. Is there a vimrc ...
17 views

### change fold sign character

I know per my question remove trailing dashes in foldtext that I can remove the trailing dashes from collapsed fold lines. When a fold is 'open', the sign column has pipe characters '|'. I looked at ...
14 views

### How to fold nested “if then else end if” statements

I try to write a vim syntax file for folding if-else statements with the syntax: if <condition> then <block to fold> [else <block to fold>] end if Current approach syn region Then ...
11 views

### How can I create a customized vim [in my own pc] and could install it on every server that I use in future?

I like my own plugin full vim that I use, but every time I ssh to a server I have to reinstall those plugins and customizations. Does anyone have an easy method to install my own customized vim on ...
16 views

### coc not working in latest vim

I've installed coc following the instruction, using Vim-Plug (before that I did it without installing yarn and with kite still (partially) installed. I got a 'javascript file not found' error So I ...
24 views

### Can I use feedkeys() inside of a keyloop implemented by getchar()

I implemented a fuzzy filter, which accept a list argument, open a window with a scratch buffer whose content set to the list, then waiting for use input and do filtering. Here is why I ask this ...
23 views

### remove trailing dashes in foldtext

When I set foldtext to a simple value like getline(v:foldstart), vim should show the current line, as opposed to the usual + and appropriate number of hyphens - for the foldlevel. However, vim fills ...
17 views

### Line position after quickfix jump

I'm using fzf's Rg command to populate QuickFix window with all search results. I also have my own mappings to :cn and :cp commands. Everything is fine except one thing when I press mapped key for :...
100 views

### Is it necessary to always add ! to function and command

I can't remember start from when and why, i always add ! to function and command: function! .. ... endfunction command! ... But :h E122 says: When a function by this name already ...
25 views

### “earlier 1f” broke if I save twice?

To reproduce it : make first change. save make second change. save save (I have a bad habit to save twice sometimes.) execute :earlier 1f , both changes lost. What's even weird is that you need to ...
16 views

### Interaction of object-select with double quotes

I'm trying to understand logic of text-object-selection in the presence of double qoutes. In the following lines * denotes cursor position, // denotes my comments. a"b(c*d)e"f //di) deletes ...
47 views

### Highlighting arbitrary text

When I'm writing, I often have 2-3 buffers open. My main body of text in the middle, and then supporting materials on the left and right. I often read a paragraph from one of the supporting buffers ...
18 views

### Numbers transferred from beginning to the end of a string REGEX [on hold]

tester.84tester:tester -> tester.84tester:tester84 this is what I need to be done, thank you for any help.
24 views

### Autoreload vimrc when writing to vimscript files

I wanted to have my vimrc automatically update when I write to a .vim file using this autocmd: autocmd BufWritePost *.vim,$MYVIMRC source$MYVIMRC But for some reason when I have this enabled and ...
28 views

### what is the purpose of the view folder in the .vim folder?

I got an error when opening my .vimrc with vim saying ".vimrc" 138L, 3781C Error detected while processing /home/fbence/.vim/view/~=+.vimrc=: line 117: E518: Unknown option: termkey= line 118: ...
26 views

### Move cursor and screen together

I am implementing a smooth scrolling function for <C-u> and <C-d>, which just sleeps for a few milliseconds and then moves the screen up (<C-y>) or down (<C-e>) one line: ...
50 views

### How to force overwriting ALL syntax highlighting in Vim?

Recently, I have tried to create my own colorscheme in only one color and no text decoration. That means Normal, Comment, ToolbarLine, Tooltip... are the same; Visual, Cursor... are reversed, of ...
15 views

This is my .vimrc set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle....
48 views

### Is there a way to paste at multiple locations/lines in vim?

I use :copy a fair bit. So like range :12,15 copy 20 will paste a block of text from 12 to 15 lines at 20th line. But when I want to paste a line at multiple places it doesn't work. For example :24 ...
47 views

### Highlight range for ex command

I'm trying to add more ex commands to my vim repertoire and I was wondering if there is setting or plugin that would allow to highlight the lines addressed by the command, if a range is give e.g., if ...
17 views

### Can I have a newline in balloonevalterm expressions?

I'm trying to use balloon text for my C macros, say, true and false as follows in the terminal version. function! MyBalloonExpr() let macros = { \ 'true':"true\n1", \ 'false':"false\n0", \ } ...
157 views

### How to insert text from a variable at current cursor position?

I am writing a vim script, and I need to insert the contents of a string variable at the current cursor position. What is an appropriate way to do this? let text = "Lorem ipsum sit dolor amet ..." " ...
37 views

### How to control .cache folder location?

Is there an option to control .cache folder location in Vim? Is there a setting or a variable for this?
89 views

### How can substitute() operate on a whole buffer?

In normal usage :%s/A/B/g is a simple way to substitute a pattern across the entire buffer. However the command mode implementation of :substitute is subject to many user configurable variables and as ...
30 views

### How do you read the contents of a macro into your buffer?

I know that you can use let @x = @w to copy the contents of a macro from one register to another, but how do you read the contents of your macro register into the buffer?
38 views

### Is there a 'toggle' :set option?

In my \$VIMRC I have: nnoremap <leader>A :set formatoptions+=a<cr> nnoremap <leader>a :set formatoptions-=a<cr> What I'm wondering is if there's something more like: nnoremap ...
61 views

### VimL/Vimscript: how to access local variable of outer function from its inner function?

I posted this question on stackoverflow already, but realized afterwards that it's probably better to ask here. So I have a function of the following form: function! s:my_function(dict_arg) let ...
15 views

### neovim and youcompleteme

Anyone know how to get rid of the file path segment of the completion list. I'm using youcompleteme with rust.
57 views

### how to change local directory of terminal buffer whenever its shell change directory

After :term ++curwin zsh, I use that buffer as an alternative of tmux window. But there is one caveat, if I cd in zsh, vim will not know. Which cause problem in below case In terminal normal mode, ...
48 views

### Highlight important words/lines permanently

I'm working on a plain text file. I'd like to highlight important words or lines so that they stand out. How can I change background color and/or text color for selected text or word under cursor? ...
39 views

Is there a way to open just the quickfix list without jumping to the first result when using :lt? I am using :lt to populate the location list with tags that match with the following binding: nmap &...
32 views

### Easily add/open a file in the same folder as the current file/buffer

I feel my current VIM setup is pretty sweet, but there is one thing that annoys me time and time again: how can I open a file or add a file to the same directory as the current file I am editing? If ...
43 views

### Is it possible to use colorcolumn on specific lines only

I am using a vimscript to "highlight" columns of interest in some text. However, using colorcolumn "highlights" the entire column on every row in the file. Is there a good way to define start and end ...
26 views

### Issues in changing font size in vim

I using konsole terminal emulator and I am facing some issue with changing the font size in vim. If I add the following snippet into my .vimrc. In the vim application, the font size will snap back to ...
399 views

### vim: (E)dit anyway without prompting

I work with many terminals, and very often hit the case where: a vim instance holds ~/sm/file I open another instance on the same file. My choice is always :(E)dit without prompting ... So I'd like ...
36 views

### Numpad behavior incorrect with vim.exe - Windows

On Windows with an installation of gvim 8.1, Numpad behavior is different between the GUI and the console. The GUI (gvim.exe) has a TERM of builtin_gui and the keypad (with Numlock On) works properly....
45 views

### viw breaks when i is remapped

I have the following in my init.vim (neovim): nnoremap i k nnoremap j h nnoremap k j xnoremap i k xnoremap j h xnoremap k j nnoremap h i nnoremap H I I find this arrow key-like configuration much ...
40 views

### C-N using try-catch

When using autocompletion with <C-n>, if no matching string is found, vim shows the message Pattern not found into the status bar. I tried something with this simple function: function! TestCN(...
21 views

### How to echo a message in BufWritePost so that it writes over the “~/.foo xxxL, xxC written” status message?

Say I write an autocommand for a particular file to do something when I save it, such as autocmd BufWritePost .Xresources silent! execute 'xrdb ~/.Xresources' I'm doing it with silent! execute, ...
39 views

### open coc-definition in new split in coc

I am using coc.vim in neovim. coc.vim suggests the following mapping for jumping to the definition of a class/method. nmap <silent> gd <Plug>(coc-definition) If there is only a single ...
21 views

Referring to answer from this link.. Adding two groups, :highlight MyGroup1 ctermbg=green guibg=green :highlight MyGroup2 ctermbg=blue guibg=blue Then adding two words foo and bar into specific ...
20 views

### How to fix this Omni completion (^O^N^P) Pattern not found error?

I am trying to set up syntax keyword based omnicompletion in vim. I have defined a few syntax keyword Constants in ~/.config/nvim/syntax/spl.vim They are correctly detected and highlighted. They are ...
32 views

### Is it possible to have the cursor follow a newly-created window?

When I split my window (C-w v), is it possible to have the cursor automatically go to the new split right away? (I looked up switchbuf but I think that's something else; having to do with buffers ...
42 views

### quickfix Menu Usage With :tselect and :vimgrep

I am currently using the following mapping to search for knows tags: nnoremap <expr> <Leader>t "<ESC>:tselect /" . input("") . "<ESC>" I also use this mapping to grep all ...