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
1 answer
25 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=...
user avatar
  • 105
1 vote
1 answer
51 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 ...
user avatar
0 votes
1 answer
26 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')...
user avatar
  • 203
0 votes
1 answer
32 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! ...
user avatar
1 vote
2 answers
52 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 ...
user avatar
  • 203
0 votes
1 answer
32 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 ...
user avatar
0 votes
0 answers
24 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, ...
user avatar
0 votes
0 answers
14 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:...
user avatar
1 vote
1 answer
35 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 ...
user avatar
  • 89
5 votes
1 answer
70 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: ...
user avatar
0 votes
0 answers
15 views

How do I prevent vim from overriding my fold preferences? [closed]

I really really really don't like folding and when my colleague last updated our lab, vim started automatically folding on every file when I opened it. I'd be happy to set an option to turn it off ...
user avatar
  • 101
0 votes
2 answers
25 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. ...
user avatar
2 votes
2 answers
176 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 ...
user avatar
  • 203
1 vote
1 answer
26 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>...
user avatar
  • 33
0 votes
3 answers
84 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 ...
user avatar
0 votes
0 answers
23 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 ...
user avatar
  • 203
3 votes
2 answers
100 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://...
user avatar
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
user avatar
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:...
user avatar
0 votes
1 answer
21 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?
user avatar
0 votes
1 answer
24 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 ...
user avatar
  • 145
0 votes
0 answers
29 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?
user avatar
0 votes
0 answers
27 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 ...
user avatar
  • 107
1 vote
1 answer
24 views

Why is my changelist not working?

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+=...
user avatar
0 votes
1 answer
43 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 ...
user avatar
  • 23
1 vote
1 answer
34 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 ...
user avatar
  • 11
1 vote
1 answer
35 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 ...
user avatar
1 vote
1 answer
35 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 ...
user avatar
0 votes
2 answers
40 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"?
user avatar
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 ^...
user avatar
0 votes
0 answers
14 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 ...
user avatar
0 votes
1 answer
39 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 ...
user avatar
  • 21
0 votes
1 answer
34 views

Why is nvim updating the clipboard on start?

I use set clipboard=unnamed in my configuration. When I open nvim with nvim, the clipboard is left unchanged but if I open with nvim . the latest entry of the clipboard is always something unexpected. ...
user avatar
0 votes
1 answer
30 views

How do I type an insert mode command?

I've recently read that some people put inoremap jk <Esc> on their vimrc to exit insert mode without having to move their hands away from the home row. But then how do you type the letters jk? ...
user avatar
0 votes
0 answers
97 views

How do I configure NeoVim in termux?

I install neovim in termux And run these commands:- cd ~ mkdir .config cd .config/ mkdir nvim cd nvim/ nvim init.vim I put set number in the init.vim file and save it. Nothing happens.
user avatar
  • 101
0 votes
1 answer
56 views

Indent changes when using CoC, how do I stop this?

I have set up my init.vim file to always use tabs as indentation by adding this to it: set tabstop=4 set shiftwidth=4 set noexpandtab Ever since I installed CoC to use Rust's language server, it ...
user avatar
0 votes
1 answer
51 views

how to accept tabnine suggestion?

I'm using tabnine and COC. I have a ~/.vimrc with the following lines: inoremap <expr> <C-j> pumvisible() ? "\<C-N>" : "j" ...
user avatar
0 votes
0 answers
9 views

how to prompt to mkview when leave the window

Is there a way to make vim prompt to ask if you want to mkview, choose [Y/n], and also ask where you want to save the view file if choose yes?
user avatar
0 votes
1 answer
43 views

Vim Autoindent does not work [closed]

I'm configuring my Vim editor. Now I want it to automatically indent when I press enter after a parenthesis (like in modern IDEs) function test() { | } I already have autoindent and smartindent ...
user avatar
1 vote
0 answers
27 views

How to map keybindings only for specific file type?

In vimwiki, <C-x><C-o> provides available tags in autocomplete dropdown. I am attempting to map that key mapping to something easier like (ctrl+alt+space) and only when I am in a markdown ...
user avatar
  • 111
0 votes
1 answer
29 views

Disabling a plugin loading when launching Vim from `git commit`

Is there a way to disable a plugin only on occasions where Vim was launched from another program? I have set Vim (Neovim, more specifically) to be the default core.editor of my git configuration and ...
user avatar
0 votes
0 answers
17 views

In MacVim, I want to make it so the cursor does not blink

In my vimrc file, I have the two lines let &t_SI="\033[6 q" " start insert mode (steady bar, xterm) let &t_EI="\033[2 q" " end insert mode When I am in the ...
user avatar
1 vote
2 answers
86 views

Where did I find this organization scheme?

Some time ago, I organized my vimrc in a particular way, modeling it after what I am pretty sure I remember to be one of the documents in the :help. But I've looked for an hour now and can't seem to ...
user avatar
  • 223
2 votes
0 answers
24 views

Safe configuration for editing pass entries

So I use the Pass program to store passphrases with gpg. To edit these entries you can use the $EDITOR environment variable. Now, I had set vim to store swap files and backup files with the following ...
user avatar
  • 21
2 votes
1 answer
58 views

How to delete backwards till whitespace in Insert mode?

Hope you're doing well. Input: let firstDate = src[0][0]|.toString(); ^ cursor in Insert mode Desired output: let firstDate = |.toString(); ...
user avatar
  • 131
0 votes
1 answer
18 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 ...
user avatar
0 votes
0 answers
12 views

How do i configure neovim to remember open tabs when opening a directory? [duplicate]

Basically, I'd like to emulate the same behaviour as VSCode. When I open a directory in VSCode, it automatically, opens all the previously open tabs. This way, every time i open up an old project, I ...
user avatar
0 votes
0 answers
31 views

ModuleNotFoundError: No module named 'pylama'

I am taking errors whenever open python code and then press a movement key. Just only have these error in .py extensions. Even not in the pyc Error detected while processing CursorMoved Autocommands ...
user avatar
1 vote
1 answer
60 views

Changing Airline-Vim z section

Currently my z section looks cramped. Is there any way I could add a bit more separation between the symbols? I would like to separate "≡" from the "%"
user avatar
1 vote
2 answers
42 views

What's the configuration used to make vim remember modifications after closing the file?

I've recently started using SpaceVim which is basically vim that comes with some extra plugins and pre-done configurations. However, it has a default behavior that bothers me... It remembers changes ...
user avatar
  • 385

1
2 3 4 5
34