Questions tagged [vimrc]

Vim reads initialization commands from a file called vimrc on startup. This can be used to set settings, define functions, execute autocommands, and more.

Filter by
Sorted by
Tagged with
2 votes
1 answer
4k views

NeoVim: colorscheme won't work in init.vim; requires command to be typed

I'm new to NeoVim and just getting started. My init.vim file under NeoVim\share\nvim\runtime\plugin\init.vim successfully sets everything except for the colorscheme and background. As seen in the ...
-1 votes
1 answer
55 views

How to Vim multiply symbol "a" with a number from clipboard?

I need to multiply symbol "a" with a number from clipboard. For example 3a = aaa In clipboard register is @+. May be to do that throw command line mode, but don't understand how.
0 votes
1 answer
135 views

How can I open a vim fold so that it is not affected by `foldclose=all`?

In my config file I have set foldclose=all so that folds get automatically closed upon cursor leaving them. However, sometimes, I want a specific fold not to close for a while. Because folds below ...
1 vote
2 answers
104 views

ALE Code Action for python

I have a working linter with the ALE plugin. Plugin 'dense-analysis/ale' let g:ale_virtualtext_cursor = 0 let g:ale_python_flake8_options = '--extend-ignore=E501' nnoremap <leader>ar :ALERename&...
3 votes
1 answer
2k views

Make YouCompleteMe open definition in vertical split even if buffer is not saved

There is something I cannot do with YouCompleteMe that I could do when just using tags to navigate to a definition or declaration. The desired behaviour is (taking into account that , is my leader ...
7 votes
1 answer
4k views

In what order does vim read ftplugin files, syntax files, and the .vimrc when `filetype plugin on` and `set syntax=filetype` are called?

I've had some issues reconciling my .vimrc with files in ftplugin and after/ftplugin. In what order are they all read? For example: When vim encounters the line plugin filetype on in a .vimrc file, is ...
0 votes
1 answer
227 views

Why are so many underscore lines in my file when to open it with Vim?

Everytime I opened a file with Vim,so many underscore lines in it such as below: How can remove all the underscore lines ? :colorsheme is desert. The highlight output: The terminal is LXTerminal. ...
0 votes
1 answer
52 views

How to always open the `:h` as a split from the current window?

As title. Say I have A|B and already called :h foo on B then if I call :h bar on A it will not create a new split under A but change the content of the split from B instead. What I expect is that I ...
1 vote
1 answer
327 views

When to use "set exrc" and local '.vimrc' in Vim, and how to manage plugins with multiple 'vimrc' files for large projects?

I'm using Vim for a project that has a lot of pages per chapter, and Vim is a little bit slow. I want to create a local '.vimrc' file for this project with only the plugins I need, and I'm trying to ...
0 votes
2 answers
34 views

How can I extend syntax highlighting with my own keywords?

I already have syntax highlighting for javascript, but what I'd like to do is extend it with some additional rules. What I've been trying to start, is using highlight "Prototype" with a cyan ...
0 votes
2 answers
103 views

How to jump to the last non-blank character in soft wrapped long line in vim?

I have those setting in .vimrc setlocal textwidth=0 wrap formatoptions=tc2n linebreak noremap <buffer> j gj noremap <buffer> k gk noremap <buffer> $ g$ noremap <buffer> ^ g^ ...
1 vote
1 answer
68 views

Simple way to go to definitions

I use this simple approach to jump to definitions in C++, which works fine for me. In my vimrc: autocmd BufRead,BufNewFile *.c,*.cpp,*.cc set path+=/Library/Developer/CommandLineTools/usr/include/c++/...
0 votes
1 answer
136 views

How to map Vim command and CTRL-W R together?

Problem I am trying to map the F10 key with theterminal bash % command so I can execute the current open file with bash in a split pane setup (this functions works). The problem is when I try to add ...
121 votes
8 answers
113k views

How to share config between Vim and Neovim

I started using Neovim and moved my .vimrc to .config/nvim/init.vim and other stuff is located in .local/share/nvim. What is the best way to share configs or even plugins between Vim and Neovim? ...
0 votes
0 answers
39 views

Why is key binding for CTRL-L key messed up?

I have run into a Vim key binding issue at the office recently. On the Linux system where I do my development work, while running Vim the CTRL-L key no longer redraws the screen. The .exrc file in my ...
0 votes
1 answer
71 views

vnoremap to sort highlighted lines by length not working as expected

I found a command that would sort highlighted lines by their length and wanted to make a mapping for it so that I could avoid typing it every time. vnoremap ,s :<C-U>'<,'> ! awk '{ print ...
1 vote
1 answer
90 views

Is user vimfiles/after/ftplugin supposed to be after system/indent?

Should user vimfiles/after/ftplugin scripts loaded after any system script?
0 votes
1 answer
208 views

How to pass an argument for glob in fzf.vim Rg to support searching in specific files?

I am using fzf.vim plugin with ripgrep. Fzf comes with the command :RG and :Rgright out of the box that lets me to search for keywords in files. However, often I need to search for keywords in ...
0 votes
1 answer
31 views

Is there an efficient way to delete the duplicated block with same start and end to keep unique?

Description I have many large size files may including the same function definition. The block description is start with .start .* and end with .end In this example there is one duplicate definition ....
0 votes
1 answer
204 views

Why doesn't vim-sneak's label-mode work even after enabling it?

I wanted lightspeed-like features in Vim (without having to install Neovim). I installed vim-sneak and followed the directions to enable "label-mode": let g:sneak#label = 1 But when ...
1 vote
1 answer
248 views

How to copy contents of wl-clipboard into a Vim register?

I would like to swap content between my system clipboard and a Vim register. I am missing one last piece of the puzzle, indicated below. Any thoughts? map <Leader>" :call SwapBuffer()<CR&...
1 vote
1 answer
49 views

How to save the files when global replace completed in one command line

I have so many huge size of files and always need to do search and replacement so I map the command as nnoremap aa :let i=1 \| g/regexp/ s/^/\=printf("%1d. ",i)/g \|let i =i+1\|:w! 1.txt ...
1 vote
1 answer
625 views

Opening recent files issue

TLDR: How can I open a file from the list of recent files without going to the end of the list to get to the prompt for file number? In order to open recent files, I do :bro ol and then when I see ...
0 votes
1 answer
89 views

When I use helpgrep, how can I highlight my search results?

I'm using :helpg session in my Vim. I would like to highlight the pattern in the results like :set hls does for normal search. Is there a way to do this?
1 vote
2 answers
182 views

inserting non-printables in vi

After a near-crash, the assistance has installed LINUX 20.4 instead of 16.04. When in vi, I try to insert a ^C using ^V^C I insert <ESC>[27;5;99~ Can someone tell me which initialization file ...
3 votes
2 answers
541 views

How do I undo the result of the remap of ( to ()?

If my vimrc file has the following: inoremap ( ()<Left> which essentially auto-closes a (, changing it to () whenever I type ( in insert mode. How do I undo the change when I don't want that ...
5 votes
1 answer
278 views

How can I decide whether a file can be opened in Vim or not?

I want to make a script with FZF (Fuzzy Finder) and I want to show only those file which can be opened with Vim. So, I don't want to list mp4, jpg, pdf etc files in FZF. So, is there any way to decide ...
2 votes
1 answer
407 views

Cannot open terminal ini nvim

I installed Plugin terminal using the vim-terminal plugin and try to execute :TerminalSplit bash but before the terminal open I got a warning message. Python 2 interface is not installed, using Python ...
0 votes
1 answer
52 views

Need help to make a by-default `:RunWithFile` of this toggle function

related to this post, How to make a toggle function in .vimrc that toggles multiple configs of almost same type? @BLayer's code func! MapRunCmd() abort if exists("b:rwfcmd1") && ...
2 votes
2 answers
85 views

Additional filetypes for different types of yaml files

Is it possible to create additional subcategories of filetypes? For example, it would be great if (neo)vim could pick up that the yaml file I'm editing is acutally a Kubernetes yaml file and set the ...
1 vote
1 answer
45 views

AutoPairsDelete() noise with vim plugins

I have been a vim user for years... I recently added a lot of plugins (see my ~/.vimrc) and I keep hitting a problem where I type a word (in this case, a string called cisco) and vim a) sees an ...
0 votes
2 answers
44 views

Change what Vim does by default when no files are given

When running vim with no command line arguments, it opens a splash screen describing Vim. I would like to control what vim does "by default", so I can make it do something more useful like ...
1 vote
1 answer
296 views

How to autocmd BufWritePost stdout to tidy upon :w?

tldr; How do pass stdout of BufWritePost to an external command? On command line I can run: cat index.html | tidy -indent -modify I'm trying to call tidy automatically when I :w This is what I have ...
1 vote
3 answers
1k views

Toggle Vim Terminal with Mapping like VS Code

I am trying to implement toggling of the Vim terminal like VS Code by doing <C-~>. But am not sure how to go about it. I find executing :term to open and to close tedious. I figured having a ...
2 votes
1 answer
1k views

Vim to highlight functions and user-defined types

I have two scenarios where I want vim to highlight those items. Currently my fix for these are to add the return types directly into the after/syntax/c.vim file, but this gets incredibly tedious. Here ...
1 vote
2 answers
118 views

jedi-vim prevents mapping [[ to * and ]] to #

jedi-vim appears to prevent mapping [[ to # and ]] to * mapping does not alter behaviour produced by [[ or ]] in .py files when jedi-vim in bundle folder (and does alter behaviour in .py files ...
2 votes
1 answer
306 views

How to tabdo all the visible buffers without changing view of the current tab?

My init.vim code: cd ~/Documents/cp nnoremap <leader>lcd :tabdo lcd %:p:h<cr> suppose, i have 4 tabs opened in nvim via using nvim -p A.cpp B.cpp C.cpp D.cpp A.cpp B.cpp C.cpp D.cpp ...
2 votes
2 answers
691 views

Plugin conflicts over BufWinEnter Autocommands

I have vim-markdown and nerdtree installed. And everything was working fine until I added the following to my .vimrc (verbatim from the nerdtree readme) " Open the existing NERDTree on each new ...
1 vote
2 answers
56 views

Conversion in Lua: how to tabdo all the visible buffers without changing view of the current tab?

Related to this post, how to tabdo all the visible buffers without changing view of the current tab? function! TabLcd() let current_tab = tabpagenr() tabdo <commands> execute '...
1 vote
3 answers
66 views

How do I configure Vim so that the color is different according to the first line, and the other lines wrap automatically?

For some context, I'm talking about Git commits specifically. The Linux server that I use for work changes the color of the first line starting from column 53 (since 52 is the recommend commit title ...
1 vote
1 answer
90 views

How to display multiple changed files on disk in Vim?

Related to this thread, How can Vim tell me which buffer is changed on disk among multiple buffers? This Vim configuration automatically checks for changes in opened buffers and notifies when a single ...
0 votes
1 answer
119 views

Can I make a new mode in Nvim?

I want to create a new mode other than normal, visual, or insert because I want to: change the functions of all keys at once allow remapping preserve the mappings of other modes and retrieve when go ...
2 votes
1 answer
902 views

Remapping Ctrl+backspace in insert mode to delete one word back

I want to bind Control+Backspace in insert mode to delete a word. I'm able to bind Control+Del in both insert and normal modes, but I can only seem to bind Control+Del in normal mode. I've checked ...
2 votes
1 answer
1k views

vim-airline tabs don't work. resetting airline theme when switching tabs

I faced an issue As you can see on the screenshot, vim does not show tabs with specified airline theme and it shows me this annoying X button at the end of the tabline. Here's my .vimrc: execute ...
0 votes
1 answer
103 views

My Linux server doesn't have a .vimrc file but Vim has a lot of configurations

Not sure if this is the appropriate place to ask, but at work I use a laptop to SSH into a remote Linux server and do some work from there. I want to use the server's .vimrc file for my own laptop as ...
0 votes
1 answer
49 views

Calling variables from SHELL and using them in Vim config (vimrc) [closed]

Question I am trying to use variables from SHELL inside my Vim configuration file, now, I have researched how to do this and asked ChatGPT about how as well. It is possibly due to the specific ...
1 vote
1 answer
45 views

How can I use Regex in helpgrep?

I would like to use Regex in helpgrep. For example, searching for lines or sections that contain two words. Something like :helpg 'word1' & 'word4' to find this line as my result: word1 word2 ...
0 votes
2 answers
62 views

Why doesn't echo % do anything in command mode?

I read the section of current-file in the document. (see :h current-file) And I have a question. if % stands for the current file name, why I can not use echo %?
1 vote
1 answer
138 views

Why so % does not work when vimrc changes with another editor?

I opened a file in Vim. Then opened vimrc file with another editor (VsCode) and made some changes. I would like those changes to be reflected in my Vim session. I tried :so % but it didn't work ...
1 vote
1 answer
46 views

What is the meaning of lbr in Vim?

I write set lbr in my vimrc file but I don't know the meaning of that. What does this option do? I know it's about line-breaking but I need more explanation. This is from the Vim document and I can ...

1
2 3 4 5
37