dotfiles/.vimrc

92 lines
2 KiB
VimL
Raw Normal View History

2018-11-01 01:14:42 +01:00
" Visual settings
2019-04-30 19:07:11 +02:00
set t_Co=16
2018-11-01 01:14:42 +01:00
set bg=dark
highlight LineNr ctermfg=darkgrey
2026-08-06 23:56:13 +02:00
" Disable beeping on console
set belloff=all
" Mouse settings
set mouse=a
" Line numbers
set number
set relativenumber
" Amount of screen lines that should be visible above/below the cursor
set scrolloff=5
" Wrap lines at word boundaries
set linebreak
2018-11-01 01:14:42 +01:00
" Syntax highlighting
syntax on
set hlsearch
" Case insensitive search (except for when explicitly using uppercase letters)
set ignorecase
set smartcase
2026-08-06 23:56:13 +02:00
" Indentation settings
set smartindent
set expandtab
2018-11-01 01:14:42 +01:00
set shiftwidth=4
2026-08-06 23:56:13 +02:00
set softtabstop=-1
2018-11-01 01:14:42 +01:00
" Activate filetype plugin (e.g. for automatically using tabs instead of spaces in Makefiles)
2019-12-13 13:53:21 +01:00
filetype plugin on
" Syntax rules for custom file extensions/patterns
autocmd BufNewFile,BufRead *.gitconfig set syntax=gitconfig
autocmd BufNewFile,BufRead *.rasi set syntax=scss
2026-04-08 13:50:05 +02:00
" Indentation for YAML (use 2 spaces)
autocmd FileType yml,yaml setlocal sts=2 sw=2
2018-11-01 01:14:42 +01:00
" Do not insert comment leader when entering insert mode with 'o'/'O' in comment line
autocmd BufNewFile,BufRead * set formatoptions-=o
" Keyboard mappings
" -----------------
2026-08-06 23:56:13 +02:00
nnoremap <C-l> :nohl<CR>:diffupdate<CR><C-l>
2018-11-01 01:14:42 +01:00
set pastetoggle=<F2>
2026-08-06 23:56:13 +02:00
" Exit insert mode with jk
inoremap jk <Esc>
" Quick exit with Ctrl-q
nnoremap <C-q> :q<CR>
nnoremap Q <Nop>
2020-08-21 19:27:23 +02:00
2026-08-06 23:56:13 +02:00
" Quick save all open buffers with Ctrl-S
nnoremap <C-s> :wall<CR>
inoremap <C-s> <C-o>:wall<CR>
2018-11-01 01:14:42 +01:00
2026-08-06 23:56:13 +02:00
" Simple copy and paste to/from system clipboard with Ctrl-c in visual mode
" and Ctrl-v in insert mode
vnoremap <C-c> "+y
inoremap <C-v> <C-\><C-o>"+P
2018-11-01 01:14:42 +01:00
2020-01-29 11:14:52 +01:00
" sudo-write with :w!!
cnoremap w!! w !sudo tee >/dev/null %
2018-11-01 01:14:42 +01:00
" Tab movement
noremap <A-[> :-tabmove<CR>
noremap <A-]> :+tabmove<CR>
2026-08-06 23:56:13 +02:00
" Use comma (,) as a "modifier prefix" for alternative functions of regular
" commands (e.g. yank to system clipboard) or for random shortcuts.
noremap , <Nop>
" Prefix yank/delete/change/paste commands with "," to use system clipboard
noremap ,y "+y
noremap ,Y "+y$
noremap ,d "+d
noremap ,D "+D
noremap ,c "+c
noremap ,C "+C
noremap ,p "+p
noremap ,P "+P