Questions tagged [vimrc]
.vimrc is the primary configuration file for the VIM text editor
178 questions
-4
votes
1
answer
79
views
New / different VIM for Debian?
On both my new Debian and Raspberry Pi: VIM version 9.0.1499
This vim is quite different and irksome to a user of the version that's been "standard issue" on Fedora for over a decade now. ...
1
vote
1
answer
48
views
Vim highlighting problems with large files
If I open a large file (using that term generously, like ~1000 lines is enough) in vim, and jump somewhere, I sometimes get highlighting that ignores text off screen. For example, if I jump to the end ...
1
vote
0
answers
49
views
Backspace on vim doesn't work after I create a ~/.vimrc file
I'm using vim on macOS, I did different tests.
Backspace doesn't work in vim with my ~/.vimrc.
I saw that when I remove my ~/.vimrc file everything is ok, but whatever I write in it (any writable ...
0
votes
1
answer
69
views
Vim does not display other files in the same folder when opening a file
On a brand new debian installation, when no ~/.vimrc is present, vim shows all files in the current directory when trying to open another file for editing in normal/command mode, as shown below:
...
1
vote
1
answer
90
views
What's overriding my .vimrc tabstop size setting for CMake files?
In my ~/.vim/vimrc, I have:
set shiftwidth=4
set tabstop=4
and when I edit a plain text file, that is respected. However, when I edit a CMake file - these both becomes 8. I tried looking for the ...
1
vote
0
answers
65
views
Vim. Close the quicklist and return to the original window
I'd like to write a function that toggles the quicklist and when closing it, it returns to the window it was in before the quicklist opening.
I tried to improve some function I found but it does not ...
0
votes
1
answer
386
views
"E492: Not an editor command: PlugInstall" only when I "sudo vim"
My question is a spinoff from this previous question 6 months ago, so to get more details and see how I've installed Vim Plug have a look here.
Currently I wanted to add this extension.
https://github....
0
votes
1
answer
3k
views
Enable plugins in VIM. E492: Not an editor command: PlugInstall
I've been following this video tutorial, to install some VIM plugins in order to change the text colors in my VIM editor, especially to make comments brighter color.
I've created .vimrc file. It looks ...
1
vote
1
answer
118
views
Copying "fancy" spaces with the mouse from Vim
I have the following setting in my .vimrc:
set listchars+=space:·
for formatting purposes (spaces vs tabs, extra spaces, etc) and thanks to a proper color scheme, these dots do not disturb much. So ...
1
vote
1
answer
846
views
How do I search for a string and then insert a newline at the beginning, for all lines in file?
I want to search an entire file for the string --- when it appears at the beginning of a line. I then want to insert a newline before each instance of that string.
In my .vimrc file, I added this ...
2
votes
1
answer
1k
views
Disable vim from auto indenting my comment lines, but continue to autoindent everything else [duplicate]
I want vim to stop auto indenting any time I add a # to the beginning of a link after its white space.
Here is an example of the problem:
Original text:
dog
cat
moose
If I add a # comment ...
4
votes
3
answers
4k
views
Change the default comments in GIT's COMMIT_EDITMSG after typing "git commit"
Sometimes when I'm at work, I want to commit and push changes to my own projects on GitHub. So I do a lot of git config user.email to make sure that I don't commit with my email at the company and ...
1
vote
0
answers
716
views
Ubuntu: vim gruvbox looks like completely different in tmux
I am a beginner of using tmux and am trying to get vim and tmux working together properly. I am using Ubuntu 20.04 LTS, vim 8.1.3741, tmux 3.0a.
All was well until I entered vim inside of a tmux ...
1
vote
1
answer
2k
views
How to remap CapsLock to Esc in Vim, installed on Ubuntu (console only, no Desktop Environment)?
The goal is to remap CapsLock to Esc in Vim, installed on Ubuntu (console only, no Desktop Environment).
This Ubuntu system is installed on Virtual Private Server.
I'm logging to this server using ...
0
votes
1
answer
461
views
Which $TERM renders bold text in vim as well as display status line?
I am looking for a $TERM which displays bold text in vim and display airline statusline too. To know what I mean,I have screenshot of two identical files opened by vim but using different terms by ...
0
votes
0
answers
150
views
How to Migrate Neovim from Windows to Linux
This seems like a pretty simple question, but I can't find a solution. I have Neovim configuration on Windows with a custom init.vim as well as plugins and color schemes. I am able to get Neovim on ...
5
votes
2
answers
1k
views
Vim: run commands depending on file directory
In my init.vim, I want to run certain commands only if the current file is under a certain hierarchy. Pseudo-code:
if current_file_directory == ~/some/path/here
autocmd <whatever>
set <...
0
votes
0
answers
625
views
Map Escape to caps lock in vim not working in Fedora 34
I am new to Fedora and I have installed Fedora-34 couple of days ago. Well, when I used ubuntu, I mapped my Esc to CapsLk in vim using following lines in ~/.vimrc file
au VimEnter * silent! !xmodmap -...
1
vote
2
answers
5k
views
Icons are not displayed in vim-airline and NERDTree
I've just installed plugins for my Neovim using vim-plug.
The plugins are working perfectly,
but it's the icons within them that are haunting me.
I've provided screenshots of them below.
NERDTree:
...
0
votes
1
answer
99
views
Vim: Default Colour Scheme Permission Issues
So I tried to change the default colour scheme of vim to desert thinking it was going to be a simple task but I ended up getting caught in a rabbit hole.
I normally create a web pages using sudo ...
1
vote
1
answer
390
views
Vim/nvim <BS> and <C-w> delete entire line in (terminal mode from a command) instead of a single character
I'm creating a mapping which is supposed to navigate to a specific window (call TEST_WIN), focus in on the terminal and then delete a single character.
The mapping looks like this:
noremap '; :let ...
0
votes
1
answer
394
views
How to make nested indentation in vim?
I would like to make if-fi statement in vim, where the iabbrev will "autocomplete" the if-fi clause:
autocmd Filetype sh iabbrev if if<esc>ma<cr>ifi<esc>`ak
which upon if ...
0
votes
1
answer
240
views
Scroll, instead of move cursor, if at end of file
I find myself unintentionally hitting j (or some other downward cursor movement key) when I'm at the bottom of a file. Then the next thing I do is to hit Ctrl-E to scroll the current line up - I may ...
6
votes
2
answers
3k
views
Disable auto tabs when putting your first comment in a yaml files with VIM editor?
Example of text before changes:
First line
Second line
Third line
When you put a comment on a line it will auto tab once that line.
This happens every time you switch from ESCAPE mode to INSERT mode ...
0
votes
1
answer
1k
views
Remap <leader>q to exit vim
I'm relatively new to vim rebinds; I am trying to map <leader>q to exit vim, but the following rebind does not seem to work:
map <leader>q :q<cr>
However, all of the following seem ...
0
votes
1
answer
646
views
How can I make vim only write to file after buffer has been modified?
I have this function which sources my .zshrc only if it has been modified in vim but I recently reinstalled Windows and WSL and then used my old .zshrc and .vimrc to get my setup back but this ...
-3
votes
1
answer
118
views
How to import tmux setting for vim to normal vim?
When using tmux my color/font/syntax highliting in VIM gets improved. How can i import that
red/yellow/white combination of color in .vimrc file. I want that.
VIM ON TMUX:
AND THIS IS MY NORMAL UGLY ...
1
vote
1
answer
314
views
Vim Plugin - Easymotion isn't starting automatically
I'm trying to improve my neovim with plugins and the best plugin that I found is Easymotion. However, it do not start automatically. I need to do :source ~/.vimrc every time that I launch a file. How ...
1
vote
1
answer
384
views
vim display message on execution of mapping
I have mapped a key shortcut to copy all lines to system clipboard, which is working fine
nnoremap <localleader>o :silent %w !pbcopy<cr>
I would like to display the message as 'Copied' ...
4
votes
2
answers
4k
views
Vim automatically clear the command line
When using vim I like to keep my command line (the line where messages, warnings and errors are printed) empty, so after saving a file I usually issue a <C-l> to redraw the screen and clear it.
...
1
vote
2
answers
295
views
Vim is displaying medium dash as �~@~S and long dash as �~@~R
I'm using vim on a shared Bluehost server. When I try to type —, Vim inserts �~@~R. And when I try to type –, Vim inserts �~@~S.
The problem is not specific to any particular file. It seems to ...
2
votes
2
answers
9k
views
Difference beetwen default.vim and /etc/vim/vimrc [closed]
What is the difference between $VIMRUNTIME/default.vim and /etc/vim/vimrc?
Why is $VIMRUNTIME/default.vim started first?
Shouldn't /etc/vim/vimrc leave first?
(Debian 9)
5
votes
1
answer
616
views
Make the Shebang of a script different color than comment lines for vim
Currently I have my .vimrc set to produce blue comment lines, I was wondering if it was possible within the vim framework to make the color of line that start with #! a different color than those that ...
11
votes
2
answers
4k
views
Conflict Ctrl-I with TAB in normal mode
I recently noticed that in normal mode when I type Ctrl-i (command for jumps) it is "confused" for the TAB key. In particular, I have this mapping:
nnoremap <Tab> :tabnext<Enter>
2
votes
2
answers
1k
views
Is there a .vimrc setting that will cause vim to open files at the first line?
I'd like vim to automatically open files at line 1 instead of where it left off the last time. I tried putting gg in .vimrc, but that didn't work. There's must be some way to do this.
0
votes
1
answer
306
views
Empty string syntax inside vimrc defined via nix home-manager
I want to use home-manager to declare my vim configuration inside a nix-expression with the extraConfig option.
I'm trying to run the example .vimrc configuration from coc.nvim and one line reads:
...
1
vote
0
answers
34
views
map "j" another character (specifically to a non-latin1, utf-8 character)
I am using a non us keyboard layout. I would like to map "j" to Turkish "ü" character, but also "k" to "j" since it is more convenient and natural for me. (I know this may be bad in the long run etc.,...
14
votes
3
answers
16k
views
Disabling vim visual mode in /etc/vim/vimrc does not work
I found plenty of questions regarding disabling visual mode in vim but none that tackles my particular problem:
I added set mouse-=a to my /etc/vim/vimrc file to disable visual mode for good. Thing ...
1
vote
1
answer
250
views
Using set paste disables imap jk <Esc>
I use the following line in ~/.vimrc to allow me to press jk instead of Esc.
:imap jk <Esc>
It works fine until I add a :set paste:
" Pressing jk is same as pressing Esc
:imap jk <Esc>
...
1
vote
1
answer
229
views
vim: command map to two commands gives E488
I'd like a Build command that starts a build independent of what build system is used.
command! -nargs=* Build :Makeshift<Bar>MakeshiftBuild <args>
gives me
E488: Trailing characters
...
1
vote
1
answer
2k
views
expand tab is not working on vim
I set the expandtab option to on, but still I don't get spaces when I click tab, but I get actual tab.
This is how I set it:
set expandtab
set shiftwidth=4
set softtabstop=4
First I thought as ...
1
vote
1
answer
245
views
vim find claims to have many files but it is not
If I type ls in my directory, I get:
README.md lib sdf.t t.t t1.t t2.t tt.t
I am in vim, and if i type: :find *.t, I get:too many file names
What is that happening?
If I ...
1
vote
0
answers
348
views
Vim statusline shows ^[[2;2R^[[>41;330;0c^[]10;rgb:e5e5/e5e5/e5e5^G^[]11;rgb:0000/0000/0000^G after mapping Capslock to Esc
I added
au VimEnter * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
au VimLeave * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock'
to my .vimrc to map Capslock to Escape. ...
0
votes
4
answers
323
views
prevent vim from replacing % with file name
I am messing around with .vimrc and I had this idea to have function like follow:
function Fill_line ()
execute "! printf '=%.0s' {1..10}"
endfunction
my output is:
Hello =test.cpp.0s
I ...
4
votes
1
answer
603
views
Validate `~/.vimrc`
I want to validate that my ~/.vimrc file is correct, basically just by launching vim and immediately running quit. I can almost do this with vim -c quit, except that I have to press the enter key. For ...
2
votes
1
answer
1k
views
Change vim cursor in Terminator
I am using Terminator in Ubuntu as well as vim.
My question is whether there is a possibility to use an underscore cursor in insert mode and a block cursor in normal mode.
I read on http://vim....
2
votes
1
answer
3k
views
Neovim colour scheme in Urxvt not rendering correctly
I'm trying to use a 256 color theme in Neovim (this one: https://github.com/ayu-theme/ayu-vim), but can't get it to render correctly on Urxvt, even though it seems to support 256 colors:
Here is the ...
-1
votes
1
answer
3k
views
Colors in Terminal and VIM with Windows Subsystem
I'm running Debian GNU/Linux through the Windows Subsystem, and I thought it was pretty cool. However, I'm having issues setting up colors in my terminal and VIM. I used to use Ubuntu as a thing to ...
0
votes
1
answer
359
views
vim: how can i make a mapping from a autocmd
in my .vimrc i have an autocmd which cleans up my files, but how can i make a mapping out of the command?
autocmd BufWritePre *.test1 silent! :%s/\s\+$//e | silent! :%s/\(\n\n\)\n\+/\1/ | silent! :%s#...
0
votes
1
answer
904
views
RedHat global vimrc does not work
I wanted to setup global vimrc. But it does not work. I have it setted up in /usr/share/vim/vimrc where I have this config.
colo torte
syntax on
what I am doing wrong if the color scheme is not ...