Home

last update: 2024-04-25 at 19:00:19 CEST

Live With Vim

Vim is an improved version of the vi editor distributed with most UNIX systems

Something wrong? → Please email me

Customizing Vim Settings

Disable annoying mouse select

set mouse-=a

Setting Tab Width

The example below will use the distance of 8 spaces for one tab character. A tab will be one character. Either you put this in your ~/.vimrc or you write it at the somewhere in a file within a comment (mode line).

vimrc example:
set tabstop=8
set shiftwidth=1
set expandtab!

It is also common to use 4 spaces and fill the tab space with single white spaces. I suggest to also set softtabstop to make 4 spaces feel like real tabs. This makes navigation easier.

For python I use
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4

have a nice menu e.g. if opening files with :e <tab>

set wildmenu

Show Non-Printable Characters

Use :set list to let vim show the following non-printable characters.

set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<

Retab Multiple Files

Issue the command retab on every .txt file beneath current directory

for f in $(find -name \*.txt); do vim -c "retab|wq" $f; done

Install A New Vim Color Scheme

mkdir -p ~/.vim/colors

Download and extract yourt preferred colorscheme to this directory. In vim you can switch to that theme with

:colorscheme matrix.vim

For me the default color scheme was fine. but only in diff mode (vim -d) some FG/BG colors were not distinguishable. Here is how to use a different color scheme only in diff mode. Add this to your .vimrc

if &diff colorscheme some_other_scheme endif

You can also anytime switch to another installed color scheme by using tab-completion on :colorscheme + <space> + <tab> command

Setup vim for asciidoc

Dag Wieers has created an alternative syntax file for asciidoc.

Installation:

mkdir -p ~/.vim/syntax
(cd ~/.vim/syntax && wget https://raw.github.com/dagwieers/asciidoc-vim/master/syntax/asciidoc.vim)

put this in yout txt files:
// vim: set syntax=asciidoc: