system/nix/progs/nvim/config.vim

145 lines
4.1 KiB
VimL

" Basic settings
filetype off
" Leaders
let g:mapleader = ','
let g:maplocalleader = '-'
" Better Unix support
set viewoptions=folds,options,cursor,unix,slash
set encoding=utf-8
" True color support
set termguicolors
" Theme (required plugin 'material-vim')
"let g:material_theme_style = 'default' | 'palenight' | 'ocean' | 'lighter' |
" 'darker' | 'default-community' | 'palenight-community' | 'ocean-community' |
" 'lighter-community' | 'darker-community'
let g:material_theme_style = 'default'
let g:lightline = { 'colorscheme': 'material_vim' }
colorscheme material
" Other options
syntax on
set backspace=2
set laststatus=2
set noshowmode
" Tabs as spaces
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
" Clear search highlighting
nnoremap <C-z> :nohlsearch<CR>
" Fixes broken cursor on Linux
set guicursor=
" General editor options
set hidden " Hide files when leaving them.
set number " Show line numbers.
set numberwidth=1 " Minimum line number column width.
set cmdheight=2 " Number of screen lines to use for the commandline.
set textwidth=0 " Lines length limit (0 if no limit).
set linebreak " Don't cut lines in the middle of a work.
set showmatch " Show matching parenthesis.
set matchtime=2 " Time during which the matching parenthesis is shown.
set formatoptions=jtcrq " Sensible default line auto cutting and formatting.
set clipboard=unnamedplus " Copy/Past to/from clipboard
set cursorline " Highlight line cursor is currently on
set completeopt+=noinsert " Select the first item of popup menu automatically without inserting it
set listchars=tab:→\ ,trail:~,nbsp:␣,eol" Invisible characters representation when :set list.
" Search
set incsearch " Incremental search.
set ignorecase " Case insensitive.
set smartcase " Case insensitive if no uppercase letter in pattern, case sensitive otherwise
" Set up a line limiter for each lang
aug line_limiter
au!
au BufNewFile,BufRead *.nix setlocal colorcolumn=101
au BufNewFile,BufRead *.vim setlocal colorcolumn=101
au BufNewFile,BufRead *.ts,*.tsx setlocal colorcolumn=101
au BufNewFile,BufRead *.js,*.jsx setlocal colorcolumn=101
au BufNewFile,BufRead *.rs setlocal colorcolumn=101
au BufNewFile,BufRead *.json setlocal colorcolumn=81
au BufNewFile,BufRead *.yml,*.yaml setlocal colorcolumn=81
au BufNewFile,BufRead *.md setlocal colorcolumn=81
au BufNewFile,BufRead *.html setlocal colorcolumn=81
" TODO: add limiter for haskell
aug END
" Spell check for markdown files
aug spell_check
au!
au BufNewFile,BufRead *.md setlocal spell
aug END
" Set up folding
aug folding
au!
au BufNewFile,BufRead *.js,*.jsx syntax on | setlocal foldmethod=syntax
au BufNewFile,BufRead *.ts,*.tsx syntax on | setlocal foldmethod=syntax
aug END
" Enable fast navigation between windows
nnoremap <C-h> <C-W>h
nnoremap <C-l> <C-W>l
nnoremap <C-j> <C-W>j
nnoremap <C-k> <C-W>k
" Disable the annoying and useless ex-mode
nnoremap Q <nop>
nnoremap gQ <nop>
" Disable arrow keys
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
vnoremap <Up> <nop>
vnoremap <Down> <nop>
vnoremap <Left> <nop>
vnoremap <Right> <nop>
"... instead of insert mode for rus lang
"inoremap <Up> <nop>
"inoremap <Down> <nop>
"inoremap <Left> <nop>
"inoremap <Right> <nop>
" Disable page up / down
noremap <PageUp> <nop>
noremap <PageDown> <nop>
inoremap <PageUp> <nop>
inoremap <PageDown> <nop>
vnoremap <PageUp> <nop>
vnoremap <PageDown> <nop>
" Disable mouse / touchpad (only in vim)
set mouse=
inoremap <ScrollWheelUp> <nop>
inoremap <S-ScrollWheelUp> <nop>
inoremap <C-ScrollWheelUp> <nop>
inoremap <ScrollWheelDown> <nop>
inoremap <S-ScrollWheelDown> <nop>
inoremap <C-ScrollWheelDown> <nop>
inoremap <ScrollWheelLeft> <nop>
inoremap <S-ScrollWheelLeft> <nop>
inoremap <C-ScrollWheelLeft> <nop>
inoremap <ScrollWheelRight> <nop>
inoremap <S-ScrollWheelRight> <nop>
inoremap <C-ScrollWheelRight> <nop>
" Incremental substitutin
set inccommand=split
" Misc
nnoremap <leader>sv :source $MYVIMRC<CR>
cabbrev bsp belowright split
cabbrev rvsp belowright vsplit