Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
1answer
25 views

Match pattern and highlight it in modeline for a specific filetype

I need to match Issue in .conf filetype and highlight it with custom color but set in mode line instead of a fix in syntax/conf.vim file. The use-case is for each kind of document I need to highlight ...
0
votes
0answers
10 views

Terminal Vim scrolls up once when I release the scroll wheel after having scrolling down

It is a weird behavior, and it's only happening on one of my laptop (they're both provisioned with the same script) which is the reason I'm having troubles identifying where does this come from. I ...
1
vote
0answers
27 views

Neovim not showing correct background color

I'm running neovim from a uxterm on arch linux with the solarized color scheme. The issue is that on scrolling only the characters which are non-whitespace are displaying the correct background. ...
0
votes
1answer
29 views

Vim multi-line substitute/insert once on selected text

I tried to make a function function! WrapSelect (front, back) "puts characters around the selected text. execute '''<, ''>s/\%V\(\_.*\)\%V\(\_.\)/'.a:front.'\1\2'.a:back.'/' nohl ...
1
vote
1answer
25 views

how to know if the current file in the buffer is a (.)dotfile using vimscript?

I changed vim backup directory to be stored on .backup folder in my dotfiles local repo set undodir=$HOME/.dotfiles/backup//. it works well as expected but i want to separate actual dotfiles ...
1
vote
0answers
16 views

CursorLineNR highlight not working

I have a vim configuration file (~/.vimrc) with the following settings: colo delek syntax on highlight clear CursorLine highlight clear CursorLineNR highlight clear LineNR highlight LineNR cterm=...
1
vote
1answer
10 views

Do not apply settings for non-modifiable popup windows

I have the following in my .vimrc: :set colorcolumn=81 This sets the background color of every window's 81st column to red. I would like to disable this for "pop-up" windows like syntastic's error ...
1
vote
0answers
21 views

Set different values for non-current and current statuslines

When vim is split into different panes horizontally, each pane has its own statusline. It's easy to highlight the statuslines differently based on current and non-current panes. BUT, I cannot figure ...
0
votes
1answer
24 views

How to isolate what is changing `set noshowmode` to `showmode` upon startup?

In my .vimrc file I have set noshowmode However, upon starting vim, :set noshowmode? returns showmode. Something must be adjusting this setting upon startup (perhaps a plugin?). What's the best way ...
0
votes
1answer
22 views

Option set in vimrc is overwritten - nvim

I'm trying to disable autochdir in nvim by adding the following in init.vim: set autochdir! but when I start nvim, I check the value of this option by echo &autochdir and find it equals to 1. I ...
2
votes
1answer
64 views

Expand all folds created by vim-latex when opening a LaTeX file

I want all my folds to be expanded when I open a LaTeX file. As per web search I added the following at the end of .vimrc set nofoldenable set foldlevelstart=99 set foldlevel=99 But even now its ...
0
votes
1answer
30 views

How to apply a custom highlight file?

I'm playing with Vim highlight, so I made the following (syntax.vim): hi Comment ctermfg=DarkGray hi LineNR ctermfg=DarkGray hi CursorLineNR ctermfg=Red hi String ctermfg=Gray hi PreProc ctermfg=...
1
vote
1answer
24 views

In visual mode, how do I bind a key so that the selected text generates “%s/<SELECTEDTEXT>/<CURSORHERE>/g”?

In visual mode, how do I bind a key so that the selected text generates %s/<SELECTEDTEXT>/<CURSORHERE>/g ? Preferably ; considering I never use it otherwise. Thanks.
0
votes
1answer
23 views

How to start recording a macro, using commandline mode?

If I wanted to start recording a macro using command-line mode, how would I do this? Additionally, if I wanted to bind this action to a key, how would I do that in my .vimrc?
2
votes
1answer
53 views

After closing a file, how do I remember/return to the previous line?

I'm not talking about the previous line I was on while still editing a file but after I close a file and then enter vim again, I want to go to that line. How do I enable this? Steps to 'reproduce': ...
1
vote
1answer
19 views

Put error into quickfix window

I can customize some error display in my file like highlight all white space at the end of each line by: :match ErrorMsg /\s\+$/ Can I put all the error I found into quickfix windows that I can go ...
1
vote
0answers
11 views

How to set up vim tags for JavaScript using vim-easytags

I use YouComplete plugin to do language completion but I can't seem to get tags to work for my own files/functions. I use xolox/vim-misc and xolox/vim-easytags and installed Exhuberant ctags. my ....
1
vote
1answer
47 views

Remap Esc key in Vim

Is it possible to remap the Esc key to another key in Vim? When I'm using Vim in a full screen VMware vSphere web client console window and I press the Esc key to exit edit mode, it also takes me out ...
0
votes
1answer
72 views

Vim/neoVim really slow startup

I am facing huge slowness when i start the neovim for the first time in a session, and then next time i open it the startup time is little better relatively but not as fast as vim is. I looked at the ...
-1
votes
0answers
40 views

Highlight value of a vimL variable

A function in vimrc that contains expansionString variable: let l:expansionString = repeat(' ', l:space) How can I highlight this string of spaces contained in expansionString? This is whole ...
1
vote
1answer
58 views

How to set VIM's background based on terminal's background colour?

I use CentOS 7 which has VIM 7.4 installed. By default the background property of VIM here is set to light irrespective of the colourscheme of my terminal. Although I can always force the desired ...
0
votes
1answer
24 views

Open and Close Syntastic window with one mapping

I have :SyntasticCheck mapped to F8 in my .vimrc. map <F8> :SyntasticCheck<CR> This open the Syntastic window on a split. I would like to close it with the same mapping. Closing is done ...
0
votes
2answers
29 views

Run command to disable a plugin in modeline

System: gvim 8.1 1-116 / windows10 A file that I'd like to use modeline (enabled): # vim: ft=python but disable ale plugin that will trigger on save - the file contains some python codes. Command ...
0
votes
1answer
12 views

What is making my configuration enter operator pending mode on new session? [duplicate]

I've been reading through Learn Vimscript the Hard Way and trying some exercises. When I got into the autocommands/autogroups part, I've thought of creating an autocommand to automatically trim ...
0
votes
1answer
17 views

importing skeleton on keybind

Task: on key press, lets say <C-G> print a basic skeleton, e.g.: 99 control '<++>' do 100 impact '<++>' 101 title '<++>' 102 desc '<++>' 103 describe <++>...
0
votes
1answer
37 views

Dein options to only load plugin if dependent program found

I'm trying to set up Dein to load the gen_tags plugin. However, if Universal/Exuberant Ctags or GNU Global aren't found on the path, I get the following error message when trying to start nvim: ...
0
votes
2answers
27 views

Can I add configuration to /etc/vimrc that takes effect after the configuration in /etc/vim/vimrc?

On my Raspberry Pi, I have a global configuration file at /etc/vim/vimrc. I also have a file at /etc/vimrc. I've tried modifying this second file, probably because I read somewhere that this is where ...
1
vote
2answers
37 views

Loading source file with :tabe

My .vimrc includes the following lines: if filereadable("my_source") :source my_source endif That is, if the file 'my_source' exists in the folder where I open vim and it is readable, it is ...
1
vote
0answers
30 views

Unable to install vim plugin in raspberry pi

I am trying to install plugin for python in vim,but i am unable to do that. I removed vi tiny from Raspberry pi and installed vi 8.0 I followed instruction from this site https://realpython.com/vim-...
1
vote
3answers
73 views

Open quickfix window without focusing it

I run my make commands asynchronously in vim with the asyncrun plugin. I use this code in my .vimrc to open the quickfix window automatically everytime I run an asynchronous make command in order to ...
0
votes
0answers
25 views

How do I disable <C-space>

I've tried doing the following to disable <C-space> but it doesn't seem to work. I am using neovim inside iTerm2 (on a mac). imap <Nul> <Space> map <Nul> <Nop> vmap <...
0
votes
0answers
20 views

Why my `<c-[>` bindings automatically reflect to `<esc>`? [duplicate]

i have this code in my config file: nnoremap <c-[> :call PrevFunc()<cr> nnoremap <c-]> :call NextFunc()<cr> vnoremap <c-[> :call PrevWord()<cr> vnoremap <c-]>...
0
votes
0answers
29 views

Why doesn't the `syntax match` command work when called from my .vimrc?

Suppose I want to show all instances of "epsilon" with "ε". So I make a .vimrc file with the following code set conceallevel=2 syntax match Entity "epsilon" conceal cchar=ε Unfortunately, this doesn'...
0
votes
0answers
24 views

configuration in .vimdir file are being ignored

I've a project directory with a .vimdir at the root. I've set expandtab in my vimrc and set noexpandtab in .vimdir, but for some reason tabs are being expanded into spaces in the files in that project,...
1
vote
1answer
35 views

Make :f do the same thing as :find in Vim

I want to make :f do the same thing as :find so if I type :f abc.txt, it should run :find abc.txt. I tried to do something like cmap f find but that just make any f into find
1
vote
2answers
62 views

Vim autocommand based on username - print message

I have a function in my bashrc that checks if a file is writable with [ -w "$1" ]. If it is, I open it with vim normally. If it's not, I open with sudo via sudo env HOME="$HOME" vim -u ~/.vimrc "$1" ...
1
vote
1answer
30 views

Renaming an augroup in vimrc

Let's say I rename a augroup in my vimrc; what happens then? Do the autocmds inside that augroup get loaded twice? For example, let's say I rename the following augroup augroup testgroup autocmd! ...
0
votes
1answer
70 views

How can I enable the 256 colors on Vim?

I run Neovim on tmux on iTerm2, but now I'm struggling to change the color of my Python code. I use python-mode library to change the syntax of the Python code. However, many colors I try to set got ...
1
vote
1answer
37 views

How to source .vimrc inside a function in .vimrc?

This is part of my vimrc-- function! Abbreviations() let a:code=input("Which Abbreviation: ") "gen if(a:code=="gen") source ~/.vim/Abbreviations/GeneralAbbreviations.vim endif ...
1
vote
3answers
46 views

How to check if my .vim/buflist.txt file is empty or contains whitespace(s) in _vimrc

How to check if my .vim/buflist.txt file is empty or contains whitespace(s) in _vimrc of my gVim on Windows 10? I tried this: let BufferListFile = $HOME . "/.vim/buflist.txt" echo BufferListFile " ...
4
votes
1answer
44 views

Automatically apply indentation using spaces or tabs

I often edit different files in vim, some of which use tabs, and some and different amounts of spaces. With this, I have not found a combination of set expandtab, set shiftwidth, set softtabstop, and ...
1
vote
0answers
30 views

Strange behaviour when switching buffers in vim (syntax highlighting and keymaps cease to work until .vimrc source)

I have set up the following list of commands to switch buffers: (in a .vim file i source from my .vimrc to keep it organised) ...
0
votes
1answer
31 views

NerdTree Toggle seems to overwrite my set columns=80

This is my .vimrc configuration: set columns=80 set linebreak It works as expected but when call NerdTree Toggle the lines expand to fix the terminal window size. Even when NerdTree is deactivated ...
4
votes
1answer
40 views

Add ^M character in mapping without entering <CR>

I've run into the problem mentioned here, but in a context in which I don't have an easy alternative that I can think of. I'm trying to add a mapping to fix bad newline characters in a file. I would ...
0
votes
0answers
36 views

Is it possible to change the key with combination via langmap?

I use Dvorak so I must use the following langmap setting to make the cursor moving compatible with the QWERTY's: set langmap=dh,hj,tk,nl But then, I would like to use the following setting to move ...
1
vote
1answer
32 views

Question about autocompletion in Vim editor and html document

Why does one of Vim's autocomplete functions (ctrl+n) not work in html documents, while the other (ctrl+p) still does?
5
votes
1answer
75 views

Pasting emojis 🦄 in Vim or Neovim

Been to trying to figure out why pasting an emoji from the clipboard doesn't paste properly when using ⌘ + v on macOS. I have the following key bindings in my .vimrc vnoremap <M-c> "+y ...
1
vote
1answer
41 views

Is `width` a parameter of the Python object `vim.current.window`?

I am trying to use PYthon to interface with VIM in my vimrc. I am aware that this can be done in vimrc in VIML, but I don't want to learn VIML too much, and am already familiar with Python. I looked ...
1
vote
2answers
35 views

Applying vimrc to vimtutor in Windows

I'm using Git's MINGW64 bash shell to run vim and vimtutor. I managed to change the movement key bindings via e: $MYVIMRC, but the changes in keybindings do not apply to vimtutor. When I open ...
2
votes
1answer
24 views

Highlight `SquishedCommas`, except at end of line

Following up on this question on how to highlight commas not followed by a space; the accepted answer provides a nice solution for problems like: func(a, b,c,d) But it also highlights commas at the ...