last update: 2021-08-04 at 07:00:20 CEST
Live With Vim
Very Useful Links
Customizing Vim Settings
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).
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.
set tabstop=4 set shiftwidth=4 set expandtab set softtabstop=4
have a nice menu e.g. if opening files with :e <tab>
Show Non-Printable Characters
Use :set list to let vim show the following non-printable characters.
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
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.
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: