DeskTux

Linux on Desktops

User Tools

Site Tools


apps:vim

Table of Contents

vim

As you might have noticed on other pages here, my editor-to-go-to is vim. Fast, versatile, always available.

The Debian default settings need some tweaking however, to make it really useful.

Packages

First of all, when you install vim in Debian, it (for some reason) also installs vim-tiny. There have been occasions when this was suddenly the default editor and to prevent that from happening and always being able to use the fully-featured version, I just uninstall vim-tiny:

sudo apt purge vim-tiny

Then, Debian packages lots of vim plugins by default. Have a look at the list and decide for yourself which ones you need or want:

apt-cache search vim|sort|grep ^vim

For me, I install these packages/plugins by default for some git added value as well as syntax highlighting for Puppet (.pp) files.

sudo apt install vim-gitgutter vim-puppet

Settings

These settings make vim a lot more usable, especially when it comes to the information it gives you as well as some handy functionality.

" DeskTux Handy Dandy vim settings
syntax on               " Enable Syntax Highlighting
set background=dark     " Use colors suited for dark backgrounds
set showcmd             " Show (partial) command in status line.
set showmatch           " Show matching brackets.
set ignorecase          " Do case insensitive matching
set smartcase           " Do smart case matching
set incsearch           " Incremental search
set autowrite           " Automatically save before commands like :next and :make
set hidden              " Hide buffers when they are abandoned
set mouse-=a            " Enable mouse usage (all modes)
set ruler               " Show current column and row
"set number             " Show line numbers
 
" The 'Insert' mode knows two different operations, 'Insert' and 'Insert
" (paste)'. The following settings make it possible to toggle between these
" two modes using the <F2> key (and show the current mode in the status line)
" so indentations of copied code will not get destroyed on pasting code.
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
 
" Tabstops and indentation for Python and Puppet
filetype plugin indent on
au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent
au BufNewFile,BufRead *.pp set tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab autoindent

Discussion

Enter your comment:
F T Y C Q
 
apps/vim.txt · Last modified: 2024-05-20 09:59 by jens