Quantcast
Channel: Debian User Forums
Viewing all articles
Browse latest Browse all 3200

Docs, HowTos, Tips & Tricks • [Tips] Vim configuration

$
0
0
Vim is a text editor intended for advanced uses. If you just want to occasionally edit text files, a simpler editor like nano is probably more appropriate.

Vim has a configuration file located in /etc/vim/vimrc. We can assume that all these packages may be affected by changes to this file:

Code:

$> apt-file -x search "/etc/vim/vimrc$"vim-common: /etc/vim/vimrc$> apt --no-breaks --no-replaces rdepends "vim-common" 2>/dev/null | sed 's/ (.\+//'vim-commonReverse Depends:  Depends: vim-latexsuite  Depends: vim-addon-manager  Depends: vim  Depends: vim-tiny  Depends: vim-nox  Depends: vim-motif  Depends: vim-gtk3  Depends: pollinate  Depends: dh-vim-addon  Suggests: libfinal0
Files that are part of a package are overwritten when the package is updated, it is recommended to use /etc/vim/vimrc.local instead. Or ~/.vimrc in your home directory.

Code:

$> tail -n5 /etc/vim/vimrc" Source a global configuration file if availableif filereadable("/etc/vim/vimrc.local")  source /etc/vim/vimrc.localendif
Here are my personal modifications to Vim's default configuration:

Code:

$> cat /etc/vim/vimrc.local"" enable syntax highlightingsyntax on"" for dark backgrounds (why isn't this the default?)set background=dark"" I don't like the default blue color for commentshi Comment ctermfg=Grey"" avoid syntax highlighting errors when jumping to a distant position":au Syntax * syntax sync fromstart"" same but for shell scripts only:au Syntax sh syntax sync fromstart"" jump to the last position when reopening a fileif has("autocmd")  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endifendif"" original tab setting:"set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab"" do not use tabs, insert three spaces instead (secures rendering on other systems)set tabstop=3 softtabstop=3 shiftwidth=3 expandtab
This one only works in the home directory (don't ask me why):

Code:

$> cat ~/.vimrc"" The middle mouse button pastes from the system clipboard, NOT from the vim clipboardset mouse=
You may have other interesting configuration items, please share them ;)

Statistics: Posted by fabien — 2024-09-27 22:50 — Replies 1 — Views 32



Viewing all articles
Browse latest Browse all 3200

Trending Articles