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
1answer
26 views

How to override ftplugin set commands in Neovim

One thing I hate about a lot of the default Vim plugins is that they add o to formatoptions. When using Vim I would get around this by using au FileType * set formatoptions-=o in my vimrc, but for ...
1
vote
1answer
22 views

Can I make left Alt act the same as shift key using key map?

I would like to swap my left shift key with my left alt key, and I would like to know if it’s possible to achieve this with vim key mapping. Maybe not swapping but copy the whole shift key map to ...
0
votes
2answers
52 views

How to delete a character that is present between two specific characters from every line in VIM?

I have a CSV file in which data in a row are present in following way: ID, Name, State, Score, Rank In the Name Column, data are in "some Name" form. But there are many entries in which a comma is ...
0
votes
1answer
61 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 ...
1
vote
0answers
22 views

Problem copying form vim to system clipboard [duplicate]

I usually do this with "*y (from visual mode), but on the linux box I'm working with (lubuntu) when I press * after " in visual mode, vim doesn't insert * (it just ignores the whole "*). If I check * ...
2
votes
2answers
58 views

Do not delay mapped keys with common prefix

What I want to do is have two mappings. One mapped to <s-k>, and one mapped to <s-k><s-k>. What happens right now is that if I press <s-k> vim delays for timeoutlenms, and if ...
1
vote
1answer
25 views

How to turn on airline theme's background in vim?

I just started using vim and I installed tpope/vim-pathogen and then vim-airline/vim-airline-themes plugin to use these themes. Then I changed my .vimrc to set up the papercolor theme, powerline fonts ...
1
vote
2answers
33 views

How to start search `/` from a mapping?

I'm trying to do the following mapping in my vimrc: nnoremap <silent> / :call <SID>FooFunction()<CR><BAR>norm! / But when I press /, instead of running the function and then ...
3
votes
2answers
79 views

Howto enable only one plugin to test?

I need to test a vim plugin. The problem: I already have my vim setup in current env, so ~/.vimrc is occupied. I want to issue a command like vim -u <blah..blah> that maybe specifies the plugin ...
1
vote
1answer
40 views

Why does this autocmd not work

I write this line to the ~/.vim/ftplugin/c.vim file, but nothing happens when I create a new C file: autocmd BufNewFile *.c read ~/skeleton/c Afterwards, I added this line to $MYVIMRC: autocmd ...
1
vote
0answers
46 views

Toggle Vim background transparency: how to setup?

I'd like to map a button to toggle Vim's background between transparent (to see stuff on other apps) and dark. My current settings I'm using onedark theme. There's currently no other background ...
2
votes
1answer
55 views

How to enable part of my vimrc to only apply in gVim?

I run Vim using both gVim and in terminal. Basically, I want to enable a certain colorscheme in my vimrc but only when in gVim, as the theme looks terrible in terminal. How do I accomplish this?
1
vote
0answers
25 views

Add to statusline

I'm using vim-airline plugin for my statusline. Now I want to install kite which suggests adding a section to the statusline. I tried adding using: set statusline+=%{kite#statusline()} but that ...
0
votes
2answers
41 views

Recursively source files under a folder except *.bak

As title howto source all files under a folder recursively except files that end with .bak
3
votes
1answer
16 views

Use mapped shortcut without timeout

I have these in my .vimrc: set notimeout nnoremap <leader>n :set rnu!<CR> nnoremap <leader>h :<C-u>call Toggle_colorcolumn()<CR> <leader>n works instantly; <...
2
votes
1answer
34 views

Why does this binding break the quickfix window? [duplicate]

If I have this vimrc: set nocompatible nnoremap <C-m> ^^ When I try to open a file from the quickfix window by pressing enter nothing happens. If I comment out the last line, so the vimrc is ...
0
votes
1answer
30 views

How do I receive an alert message indicating that persistent undo will be ignored?

I am using Vim 7.4. According to vim's help on persistent undo: An undo file is also ignored if its owner differs from the owner of the edited file. Set 'verbose' to get a message about that when ...
3
votes
2answers
63 views

How to change location of ~/.vim

I have Vim 7 installed from my distro's package manager, and I compiled Vim 8 from source. Vim 8 is all in /usr/local. Then I created a new directory in $HOME called ".vim8". I have all my Vim 7 stuff ...
3
votes
2answers
62 views

`system()` can't get output of shell command in vimrc

I want to enable some configurations only when the distribution is Fedora. Here is my code. let s:os = system("sed -n 's/^NAME=\(.*\)/\1/p' /etc/os-release") echo s:os if s:os == "Fedora" " ...
1
vote
1answer
44 views

Binding toggle comment to <C-/>

I installed NERDCommenter plugin and its default bindings unfortunately conflict with my own. For instance I use <Leader>-c and <Leader>-v to emulate CTRL-c and CTRL-v. And since IDEs ...
4
votes
2answers
127 views

Saving a scratch buffer

I currently use scratch buffers a lot for various uses such as when I read from STDIN to quickly analyze some data or take some very temporary notes. That way I don't have to worry about a swap file ...
1
vote
0answers
61 views

How could I customize preview window coloring with results from Ripgrep and fzf?

I am just getting into vim and I'm trying to get the preview window for my Rg results to show up with nice looking colors. Currently I have most of the stuff looking nice; here is a picture of where I ...
1
vote
0answers
14 views

Does <c-h> represent a backspace when being mapped? [duplicate]

I've been learning Vim recently and I decided to put a few lines in my vimrc for quick navigation without having to leave normal mode, like so: inoremap jk <esc> inoremap <c-h> <esc>...
5
votes
1answer
71 views

How do I change the return/enter key functionality without breaking enter to select?

I like to replace the default enter/return key functionality with actually inserting a new line, and the same with space (but inserting a line above), e.g. here is my map: nnoremap <CR> O<...
2
votes
0answers
38 views

Can't use special characters in listchars even if setting scriptencoding to utf-8

Here is my .vimrc file: set encoding=utf-8 scriptencoding utf-8 set list set listchars=tab:→· When I open vim, it will show an error message E474: Invalid argument: listchars=tab:→· My vim is Vi ...
7
votes
8answers
2k views

How to quickly type a C expression where the assigned-to variable is repeated?

I sometimes want to type an expression like this: table[row][col] = std::max(table[row][col], other_table[row+1][col+1]) (this is C++ code. Unfortunately there's no way in C++ to eliminate the ...
2
votes
2answers
113 views

map <leader>b<number> :b<number><cr>

I am using a convenient macro to list my buffers: map <leader>bb :buffers<cr> I am trying to come up with a way to then switch to the buffer of interest with <leader>b<number> ...
2
votes
1answer
71 views

vim-plug: install plugins on startup not working properly on Ubuntu

per the recommendation in the vim-plug wiki: https://github.com/junegunn/vim-plug/wiki/extra, I've added the following snippet to my vimrc: " Install missing plugins on Vim startup autocmd VimEnter * ...
0
votes
1answer
39 views

After undoing changes, Neovim still requires saving file or ! before exit [closed]

If I open a file, add a line (o), and then delete that line (dd) making the file exactly the same as when it was opened, upon exiting (:q), Neovim states: E37: No write since last change (add ! to ...
2
votes
1answer
95 views

Making terminal buffer unlisted

I'm configuring my scripts to work with terminal in VIM and have a question regarding :h special-buffers. Among mentioned kinds there were the following: unlisted The buffer is not in the buffer ...
1
vote
1answer
51 views

NERDTree is not displayed in buffer list

I'm currently exploring ways to iterate through all buffers in vim and am confused by the behavior of NERDTree. I displayed the NERDTree directory tree and expected that the viewport is bound to ...
0
votes
0answers
34 views

Some of unicode characters doesn't work in vim

I am using vim8 on windows 7. The problem is what whenever I try to paste a unicode character from somewhere else it doesn't work instead it shows. For example when I try to enter ⇛ It shows a ...
4
votes
1answer
51 views

How to set ruler with decimals in .vimrc file?

I have this line in .vimrc file set ruler which shows the percentage of current line. But for very large text files, it would just show 0% for first couple hundreds of lines, which is not quite ...
2
votes
1answer
125 views

How to get put the result of a shell command in a variable?

I would like to capture the result of a shell command into a vim variable inside of my vimrc file. I tried using let myvar = system("DIR") however it seems to crash vim when I put it in my vimrc file....
0
votes
3answers
74 views

How to completely hide the seperator between windows?

I managed to hide the background of the seperator between open windows by using: hi VertSplit term=NONE cterm=NONE gui=NONE guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE However the fillchars ...
0
votes
0answers
28 views

Vim terminal job prevents from exiting

I'm writing a function which is supposed to create a terminal buffer once for the entire Vim session and which would not prevent it from exiting. Here is how it looks like: let s:term_buf_nr = -1 ...
2
votes
0answers
38 views

Adjust terminal size using a system call from within Vim

All, I have a little function I'm trying to fix. I'd like to change my terminal Vim window size using the ASCII escape sequence \e[8;40;130t so that my writing window size stays the same when I use a ...
0
votes
1answer
45 views

Vim command 0 goes to second column instead of first one

When I press 0 in Normal mode, the cursor goes to the second column and not the first one. This is not the normal behavior stated in vim's :help 0. I have tried disabling the remaps to move between ...
0
votes
2answers
102 views

VIM How to enable .ts .tsx .js (for front-end) code highlight?

I have .vimrc plugins " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'nanotech/...
0
votes
0answers
23 views

Two lines in command area how to make a single line

I have two lines in the command area. How to make a single line?
1
vote
2answers
54 views

Make a buffer active by its number

I'm configuring a terminal buffer and now I have the following problem. I have only one terminal buffer and I need to make it active by its number to avoid lots of CTRL-w j/k/l clicks. Here is what ...
4
votes
2answers
49 views

Map CTRL-& in vimrc

I'm trying to re-map tagbar toggling with <C-&> that I get used to when working with IDEs. But setting execute "nnoremap <C-&> :TagbarToggle<CR>" does not have the ...
0
votes
2answers
72 views

Enable cursor blink in all modes for terminal Vim

I am relatively new to vim and tried to understand this article and also read :help guicursor and inserted this line in my .vimrc set guicursor+=a:-blinkwait175-blinkoff150-blinkon175 But it didn't ...
1
vote
1answer
34 views

How to set custom shortcut in vim?

I want to make use of Shift+Tab to left-shift (unindent) a block of text, instead of Ctrl+d. How to do it?
2
votes
1answer
63 views

Syntax highlighting stopped working

I was just started with Vim. While experimenting with basic customization techniques, it began to behave differently. Somehow the default configurations changed to very basic for both GVim and ...
1
vote
1answer
47 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:...
3
votes
1answer
54 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 ...
0
votes
1answer
28 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 ...
1
vote
1answer
33 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 ...
0
votes
0answers
52 views

ftplugin not loading

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....