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
0 votes
0 answers
24 views

Vim automatically inserts "* " add the start of every new line in css files

If theres a "* " at the start of the previous line Vim automatically inserts a "* " at the start of the next new line. I want Vim to not insert anything. examples: 1|* {margin: 0;} ...
  • 1
0 votes
0 answers
23 views

Is there any website for sharing vimrc? [closed]

Is there any website where we can send our .vimrc configuration and users can upload their files and we can see and download their files?
0 votes
1 answer
21 views

How do I add spaces to a file path in vimrc?

I am trying to set the shell to git bash in my vimrc. I have this: The code says: set shell=C:\Program Files\Git\git-bash.exe But because there's a whitespace in Program Files, it acts as a separate ...
2 votes
1 answer
145 views

Why "c" option in formatoptions makes Vim hard-wrap my lists in "text" files?

Here is my test .vimrc: unlet! skip_defaults_vim source $VIMRUNTIME/defaults.vim set textwidth=78 let &colorcolumn = &textwidth + 1 set linebreak breakindent set number augroup ...
2 votes
0 answers
20 views

How to use :PlugInstall intelligently

I have installed YouCompleteMe in the past, but don't remember how. I recently decided to sync my ~.vim directory over multiple computers via a cloud service and realized I was inadvertently ...
  • 131
0 votes
0 answers
11 views

BufReadPre only with vimdiff OR regex to ignore

I am trying to ignore hardcoded line numbers when running vimdiff on files. The regex ^\s*\d\+: properly identifies all the line numbers (which are only on some lines, not all lines). So far I've ...
0 votes
1 answer
10 views

Can you use a different mapping within another mapping?

In my _vimrc, Say I have a keybinding like this: noremap gm f<Space>a{{c<Esc>0ylfcpa::<Esc>A}}<Esc>2F{ And another keybinding like this: noremap m3 mckmbkma2j I have tested ...
2 votes
1 answer
36 views

What does runtime! debian.vim actually do?

The vimrc template I used had the message "Ensure options work with the Vim-related packages available in Debian." for runtime! debian.vim Here is the contents of /usr/share/vim/vim81/...
  • 183
0 votes
0 answers
17 views

How to add custom text to vi airline?

How can I add custom text to vim airline? For example the word evgenimba in the right botton of the picture below? I have tried to search with various keyword but could not find the solution.
4 votes
1 answer
93 views

How can I convert vim8 function mapping to vim9?

I have a function in vim8 as: function! BSkipQuickFix(command) let start_buffer = bufnr('%') execute a:command while &buftype ==# 'quickfix' && bufnr('%') != start_buffer execute ...
  • 447
0 votes
1 answer
33 views

Vimscript: how to overwrite a variable that is inside an if block?

I have some code in a function like so: let branch = substitute(system('git rev-list -1 HEAD'), '\n', '', 'g') let num_branches = system('echo `git branch --contains '.branch.'` | wc -l') if ...
  • 165
1 vote
1 answer
329 views

What does 'set setting^=value' really mean?

There is an old question here about best practices to store swap files, and there is an answer by flemingfleming (who haven't visited the site since 2018) where he suggested the following: set ...
2 votes
2 answers
100 views

How can I show the current keyboard layout in the statusline?

I use Vim with two keyboard layouts, English and Russian, and to be able to use Vim commands irrespective to the current layout, I have the following snippet in my .vimrc: " To switch between ...
0 votes
1 answer
27 views

vim status bar not consistent in all file

I recently set my vim status bar using this: " set status line set laststatus=2 set statusline= set statusline+=%#StatusLineFile# set statusline+=\ %F set statusline+=%m set statusline+=%= set ...
1 vote
1 answer
146 views

How do I :let a global variable in my vimrc in vim9script?

I am trying to change my vimrc to vim9script. For inbuilt fortran help, (:h fortran) we have: :let fortran_free_source=1 This is giving an error: E1126: Cannot use :let in Vim9 script If I remove ...
  • 447
8 votes
1 answer
279 views

Avoid breaking words before or after asterisk ('*')

If you have set wrap, sometimes you can see something like this: 5. A soft-wrapped line with an * italic* word. I would prefer Vim to not soft-wrap before or after asterisks, and so the same ...
1 vote
1 answer
39 views

'BufNewFile,BufFilePre,BufRead' or simply 'BufFilePre,BufRead' when detecting a filetype?

The following snippet is from the vim-pandoc-syntax plugin README: If you want to use vim-pandoc-syntax without vim-pandoc, you'll need to tell Vim to load it for certain files. Just add something ...
2 votes
0 answers
47 views

Disable underline for Markdown links

If you have set wrap and there is hyperlink that is located in the "bad" place, you may see a long trailing underline after it: Is it possible to disable underline for Markdown hyperlinks ...
1 vote
1 answer
60 views

How can I open netrw in a split when opening a directory?

I have figured out how to open a file browser in a split, using the following in vimrc: let g:netrw_liststyle = 3 let g:netrw_banner = 0 let g:netrw_browse_split = 4 let g:netrw_winsize = 25 let g:...
0 votes
0 answers
41 views

NerdTree... after using <m> bottom panel stays bigger and wont disappear

When using Menu in NERDTree to create a directory/file and toggle it off, will keep bottom window open.
0 votes
1 answer
30 views

How to change editor options when switching to diff mode?

I have a few options I like to apply both when Vim is opened in diff mode and when it is switched to diff mode, e.g., when calling diffsplit. I have the following lines in my ~/.vimrc: command! -nargs=...
  • 105
1 vote
1 answer
57 views

Certain commands in vimrc not being picked up anymore

I am having an issue where anything I enter into my .vimrc file is not being picked up, regardless of how many times I add it / close the file / re-open it, etc. Here is the most basic example of what ...
1 vote
1 answer
28 views

To not treat files like 'vimrc-tips.txt' as Vim Script files

There is a line in defaults.vim that enables Vim Script syntax for any .txt file with vimrc in its filename (for example, vimrc-tips.txt): au BufNewFile,BufRead *vimrc* call s:StarSetf('vim')...
0 votes
1 answer
54 views

'autocmd OptionSet' - How to make it work?

The following .vimrc snippet is by Martin Tournoij's answer posted here: How do I stop the colorcolumn from breaking into multiple pieces when there are wrapped lines? augroup wrappedcc autocmd! ...
1 vote
2 answers
56 views

Some settings don't work because of their arrangement. Is it possible to workaround this?

I try arrange settings in my .vimrc in the exact order and by using the same sectioning as if you click "Edit" (in the menu) and then "Settings Window". There is problem that when ...
0 votes
1 answer
34 views

To not wrap at 'textwidth' if 'filetype' is 'text'

I want to ask Vim to not auto-wrap text at the textwidth value. For this, I adopted a function from the following article: Vim: Set wrapping and indentation according to file type. The autocmd doesn't ...
0 votes
0 answers
98 views

Coc.nvim doesn't work correctly

Yesterday, I installed coc.nvim in vim on windows. I remember that it showed up the suggestion tab. But today, I removed go and visual studio, then it didn't show up anymore. I tried to reinstall Go, ...
0 votes
0 answers
24 views

Vimlsp and asyncomplete not displaying completion popups

Been trying for a couple days with no luck to get an lsp with autocompletion working in my Vim setup. My .vimrc file looks like this: let g:asyncomplete_log_file="/home/user/z_log" let g:...
1 vote
1 answer
38 views

"autocmd!" on a separate line vs. "autocmd! <the autocmd itself>"

From what I have read in a book by Steve Losh (chapter 14), it seems that to avoid performance issues, it is best practise to enclose autocommands, even the single ones, in autocommand groups: augroup ...
  • 99
5 votes
1 answer
72 views

Is it possible to wrap and properly align inline comments?

set textwidth=60 let &colorcolumn=&textwidth set linebreak Is there a relatively simple way (that is, with using formatoptions only) to make Vim format inline comments (gq) from this: ...
0 votes
2 answers
29 views

Avoid "cannot find spell file" window

I have set spelllang=en_us,ru_ru in my .vimrc, and when I enable spell check by typing :set spell, Vim shows me a pop-up window that says that the dictionary for the second language is not installed. ...
2 votes
2 answers
181 views

Is it possible to modify default statusline without resetting it to blank?

Normally, if you add something like set setting+=value into your .vimrc, the value will be appended to the existing ones. For example: set formatoptions+=j " => tcqj However, it seems it ...
1 vote
1 answer
27 views

Remap CTRL-x in insert mode

I want to remap <C-x> in insert mode (I do not use the completion commands via this key). This is what I tried: inoremap <C-x> <Esc> :x <Enter> inoremap <C-x> <C-o>...
  • 43
0 votes
3 answers
103 views

vim copy/paste from clipboard while keeping indentation

I am using Putty on Windows to connect to a Linux server. On the Linux server I am using vim to edit code files. I am using my mouse to select an area to copy and then right click to paste the copied ...
0 votes
0 answers
25 views

'set fileencoding' for new files. Vim says it won't work, but is it really so?

set encoding=utf-8 set fileencoding=cp1251 set fileencodings=ut8-8,latin1 set laststatus=2 set statusline=%{(&fileencoding)} Vim help says that only global value of fileencoding won't for new ...
3 votes
2 answers
106 views

Make Vim _really_ work with both spaces and tabs

Here is what I use for indentation: set autoindent set breakindent set expandtab set smarttab set shiftround set shiftwidth=2 softtabstop=-1 " or maybe shiftwidth=2 softtabstop=8 " https://...
0 votes
1 answer
18 views

Different highlighting between foldtext and "the line number on the folded line"?

Can I control the highlighting of the foldtext separately from the color of the line number on a folded line? I want the foldtext to be quite visible while keeping my chosen line number color
0 votes
0 answers
3 views

How to get "foldlevel" number of characters in foldtext? [duplicate]

EDIT Duplicated by vimscript: how to repeat a string N times? ? I currently have the following in my .vimrc: function! MyFoldText() const foldindicator = ">" return v:folddashes . v:...
0 votes
1 answer
24 views

.vimrc in local folder

Can I have a .vimrc file in local folder, so that each time I open files in that folder, vim will automatically load that .vimrc file? so that I can have different settings in different folder?
0 votes
1 answer
25 views

Set location to be same as path

I keep a vimrc file stored on Dropbox and use symlinks to point to this so my vimrc is always synced up. Recently I got a new laptop and the location of some utilities are different from that of my ...
  • 145
0 votes
0 answers
30 views

How do I disable syntax highlighting in the changelist?

I want syntax highlighting off in menus like the changelist (accessed via :changes). Is there a setting for this?
0 votes
0 answers
31 views

Do I need the contents of the indent and ftplugin directories in my configuration?

While I have been using nvim (on Linux) for some time, I have only recently started using gvim (on Linux and Windows). I have noticed that on the Windows version of gvim there are directories amongst ...
  • 139
1 vote
1 answer
33 views

Why is my changelist not working? [closed]

I'm using homebrew-installed vim My changelist looks something like this: 10 250 0 nmap <leader>rn <Plug>(coc-rename) 9 266 11 set report=0 8 267 20 set display+=...
0 votes
1 answer
44 views

Why is this mapping deleting text?

I'm using these two binding for indentation and dedentation of a visual selected block of text. " Indentation vmap <TAB> >gv " Dedentation vmap <S-TAB> <gv When I ...
  • 23
1 vote
1 answer
43 views

How to remap :bn and :bp [closed]

I have these remaps for buffer switching in my .vimrc let mapleader = ' ' nnoremap <leader>bk :bw<CR> nnoremap <leader>bn :bn<CR> nnoremap <leader>bp :bp<CR> If I ...
  • 11
1 vote
1 answer
38 views

How can I turn off syntax highlighting for man pages?

I open man pages in vim, per export MANPAGER="vim -M +MANPAGER -" in my zshrc. However, vim has syntax highlighting enabled when it opens a man page. Is there a way to ensure man pages ...
1 vote
1 answer
38 views

Why are incsearch and hlsearch disabled when opening a .csv file?

I like the incsearch and hlsearch options in Vim, so early on in my .vimrc file, I have the following lines: augroup allfiles autocmd FileType * :set nocindent noexpandtab incsearch hlsearch ...
0 votes
2 answers
51 views

Can vimrc 'tell' if syntax is on or off?

I want to write a simple function that will toggle syntax highlighting, I imagine it'll just be a simple if-else. Is there a condition I can check? If "syntax is on"?
0 votes
0 answers
19 views

Arrow characters are left behind on the screen

Whenever I press and hold any arrow key (e.g. h, j, k or l) they appears on screen as such: The same kind of thing happens whenever I accidentally scroll, where ^[OA are displayed if I scroll up and ^...
0 votes
0 answers
15 views

How do I do a keybind involving <C-ñ>?

I use a keyboard layout designed for Spanish speakers and I've remapped hjkl to jklñ because those are the main home row keys. With hjkl I have to be constantly moving my hand to the left in order to ...

1
2 3 4 5
34