2023-01-23 00:43:33 +01:00
|
|
|
syntax on " syntax highlighting
|
|
|
|
|
|
|
|
set nocompatible " disable compatibility to old-time vi
|
|
|
|
set mouse=v " middle-click paste with
|
|
|
|
set number
|
|
|
|
set nocompatible
|
|
|
|
set hlsearch " highlight search
|
|
|
|
set incsearch " incremental search
|
|
|
|
set tabstop=4 " number of columns occupied by a tab
|
2023-07-05 11:28:16 +02:00
|
|
|
set softtabstop=4 " see multiple spaces as tab stops so <BS> does the right thing
|
2023-01-23 00:43:33 +01:00
|
|
|
set expandtab " converts tabs to white space
|
2023-07-05 11:28:16 +02:00
|
|
|
set shiftwidth=4 " width for auto indents
|
2023-01-23 00:43:33 +01:00
|
|
|
set autoindent " indent a new line the same amount as the line just typed
|
|
|
|
set number " add line numbers
|
|
|
|
set wildmode=longest,list " get bash-like tab completions
|
|
|
|
set cc=100 " set an 100 column border for good coding style
|
|
|
|
set mouse=a " enable mouse click
|
|
|
|
set cursorline " highlight current cursorline
|
|
|
|
set ttyfast " Speed up scrolling in Vim
|
2023-02-16 16:10:07 +01:00
|
|
|
set fdm=indent " foldingmethod syntax
|
2023-02-09 13:46:39 +01:00
|
|
|
set foldlevel=10 " only fold when a certain complexity is reached by default. This applies only at startup.
|
2023-07-04 21:33:12 +02:00
|
|
|
set numberwidth=4
|
2023-03-06 13:05:17 +01:00
|
|
|
set timeout timeoutlen=400
|
|
|
|
set ttimeoutlen=0
|
2023-01-23 00:43:33 +01:00
|
|
|
|
|
|
|
" Avoid showing message extra message when using completion"
|
|
|
|
set shortmess+=c
|
|
|
|
|
|
|
|
filetype plugin indent on "allow auto-indenting depending on file type
|
|
|
|
filetype plugin on
|
|
|
|
|
|
|
|
|
|
|
|
let g:indentLine_char = '│'
|
|
|
|
|
2023-03-25 18:45:49 +01:00
|
|
|
" add lines with double o
|
2023-01-23 00:43:33 +01:00
|
|
|
noremap oo o<ESC>
|
|
|
|
noremap OO O<ESC>
|
|
|
|
|
2023-03-25 18:45:49 +01:00
|
|
|
" H and L for end and beginning
|
|
|
|
nmap H ^
|
|
|
|
nmap L $
|
2023-07-04 21:33:12 +02:00
|
|
|
vmap H ^
|
|
|
|
vmap L $
|
2023-03-25 18:45:49 +01:00
|
|
|
|
2023-05-08 00:30:07 +02:00
|
|
|
" usefull functions for arrow keys
|
|
|
|
" (and force the user to use hjkl)
|
|
|
|
|
|
|
|
" right/left to add/remove a tab in the beginning of the line.
|
|
|
|
nmap <Left> <<
|
|
|
|
nmap <Right> >>
|
|
|
|
" same for visual mode (plus reselecting stuff for visual mode)
|
|
|
|
vmap <Left> <gv
|
|
|
|
vmap <Right> >gv
|
|
|
|
|
|
|
|
" up and down move lines up and down
|
|
|
|
nmap <Up> :m -2<CR>
|
|
|
|
nmap <Down> :m +1<CR>
|
|
|
|
" same for visual mode (plus reselecting stuff for visual mode)
|
|
|
|
vmap <Up> :m -2<CR>
|
|
|
|
vmap <Down> :m +1<CR>
|
|
|
|
|
2023-01-23 00:43:33 +01:00
|
|
|
" hit f3 to toggle search highlighting"
|
|
|
|
nnoremap <F3> :set hlsearch!<CR>
|
|
|
|
|
|
|
|
nnoremap <SPACE> <Nop>
|
|
|
|
let mapleader=" "
|
|
|
|
map <leader>t :echo "leader tested!"<CR>
|
|
|
|
map <leader>h :noh<CR>
|
|
|
|
|
2023-07-05 11:28:16 +02:00
|
|
|
" copy to Wayland clipboard when leader is used. (note, install gvim for this)
|
2023-01-23 01:06:18 +01:00
|
|
|
vnoremap <leader>wy y :call system("wl-copy", @")<CR>
|
|
|
|
nnoremap <leader>wY Y :call system("wl-copy", @")<CR>
|
|
|
|
nnoremap <leader>wy y :call system("wl-copy", @")<CR>
|
|
|
|
nnoremap <leader>wyy yy :call system("wl-copy", @")<CR>
|
|
|
|
|
2023-01-23 00:43:33 +01:00
|
|
|
" copy to system clipboard when leader is used. (note, install gvim for this)
|
|
|
|
vnoremap <leader>y "+y
|
|
|
|
nnoremap <leader>Y "+Y
|
|
|
|
nnoremap <leader>y "+y
|
|
|
|
nnoremap <leader>yy "+yy
|
|
|
|
|
2023-03-25 18:45:49 +01:00
|
|
|
" dont write the pasted upon stuff in visual mode into the register
|
2023-02-17 19:46:58 +01:00
|
|
|
vnoremap p pgvy
|
|
|
|
|
2023-01-23 00:43:33 +01:00
|
|
|
" open terminal with F12
|
|
|
|
nnoremap <F12> :terminal<CR>
|
|
|
|
|
|
|
|
" vsplit with <Leader>, then "
|
|
|
|
map <Leader>" :vsplit<CR>
|
|
|
|
|
|
|
|
" split with <Leader>, then %"
|
|
|
|
map <Leader>% :split<CR>
|
2023-07-03 10:56:38 +02:00
|
|
|
|
|
|
|
" resize windows
|
2023-07-04 16:42:59 +02:00
|
|
|
nnoremap <C-Left> :vertical resize +1<CR>
|
|
|
|
nnoremap <C-Right> :vertical resize -1<CR>
|
2023-07-03 14:03:22 +02:00
|
|
|
nnoremap <C-Up> :resize -1<CR>
|
|
|
|
nnoremap <C-Down> :resize +1<CR>
|
2023-07-05 11:28:16 +02:00
|
|
|
|
|
|
|
" spell checking
|
|
|
|
set spell spelllang=en
|
|
|
|
|
|
|
|
" go to last or next misspelled word
|
|
|
|
nnoremap zn ]s
|
|
|
|
nnoremap zN [s
|
|
|
|
|
|
|
|
" same as above but only with bad words (unrecognized)
|
|
|
|
nnoremap Zn ]S
|
|
|
|
nnoremap ZN [S
|
|
|
|
|
|
|
|
" mark correct with zg, mark bad with zw, undo with zug/zuw
|
|
|
|
|
|
|
|
" correct with zc, default is z= but that sucks for qwertz keyboards
|
2023-07-05 11:53:40 +02:00
|
|
|
nnoremap z<space> z=
|
2023-07-05 12:07:30 +02:00
|
|
|
|
|
|
|
" don't make things written as `something` a typo
|
|
|
|
syntax region cCommentNoSpell start=+`+ end=+`+
|
|
|
|
\ contained containedin=cComment,cCommentL transparent
|
|
|
|
\ contains=@NoSpell
|
|
|
|
|
|
|
|
" don't make lines starting with `//!` a typo (used by rust docs)
|
|
|
|
syntax region cCommentNoSpell start=+//!+ end='\z1' contained extend
|
|
|
|
\ contained containedin=cComment,cCommentL transparent
|
|
|
|
\ contains=@NoSpell
|