From b58865cf88efede16f7cfc4d9e7d5953fa6a748e Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Mon, 25 Nov 2024 11:15:18 +0100 Subject: [PATCH] add vimrc --- roles/pubnix/files/skel/dot.vimrc | 116 ++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 roles/pubnix/files/skel/dot.vimrc diff --git a/roles/pubnix/files/skel/dot.vimrc b/roles/pubnix/files/skel/dot.vimrc new file mode 100644 index 0000000..db6243b --- /dev/null +++ b/roles/pubnix/files/skel/dot.vimrc @@ -0,0 +1,116 @@ +" concentrate backup files etc +let &directory = expand('~/.vimdata/swap//') +set backup +let &backupdir = expand('~/.vimdata/backup//') +set undofile +let &undodir = expand('~/.vimdata/undo//') +if !isdirectory(&undodir) | call mkdir(&undodir, "p") | endif +if !isdirectory(&backupdir) | call mkdir(&backupdir, "p") | endif +if !isdirectory(&directory) | call mkdir(&directory, "p") | endif + +" allow backspacing over everything in insert mode +set bs=2 + +" no auto indent +set nosmartindent +set noautoindent + +" smart indent with code +autocmd FileType perl set smartindent +autocmd FileType python set smartindent +autocmd FileType shell set smartindent +autocmd FileType c set smartindent + +" paste mode - this will avoid unexpected effects when you +" cut or copy some text from one window and paste it in Vim. +set pastetoggle= + +" indent shifts 2 spaces to right +set expandtab +set shiftwidth=2 +set softtabstop=2 +set smarttab + +" show matches when using completion +set wildmenu + +" search is case insensitive +set ignorecase + +" Set utf8 as standard encoding and en_US as the standard language +set encoding=utf8 + +" highlight matches +set hlsearch + +" not case insensitive if term contains upper letters +set smartcase + +" show cursor position in statusline +set ruler + +" show matching bracket after typing a closing bracket +set showmatch + +" show current mode in statusline +set showmode + +" show last command in statusline +set showcmd + +" show status line +set laststatus=2 + +" set xterm title to "VIM ", while is +" the currently opened buffer +set title + +" do not beep (doh!) +set visualbell + +" don't ask for :x! +set writeany + +" just enter Q to exit +map Q :q! + +" fix broken shells +set term=xterm + +" enable true colors +set termguicolors + +" add comment char when pressing inside comment line +set formatoptions+=r + +" show line numbers +" set number +set relativenumber +set numberwidth=5 + +" to disable linenumbers and indentlines (if any) press t in normal mode +nmap t :set relativenumber!:IndentLinesToggle + +" help in full screen +command! -nargs=1 -complete=help H help | silent only + +if &diff + " apply right patch to the left + nnoremap < :diffget + + " apply left patch to the right + nnoremap > :diffput + + " update diff + nnoremap :diffupdate + + " jump to next diff + map n ]c + + " jump to previous diff + map p [c + + " switch windows (back and forth) + nnoremap w +endif +