all repos — dotfiles @ 523f2b38ee3682b68c7e255eaf5e0b23299e5587

personal dotfiles

nvim/.config/nvim/init.vim (view raw)

  1" la-ninpre init.vim "
  2
  3" misc: {{{
  4
  5if &shell =~# 'fish$'
  6    set shell=bash
  7endif
  8
  9" use space as leader key
 10let mapleader=" "
 11
 12" enter new era :D
 13set nocompatible
 14set encoding=utf-8
 15
 16" enable 24-bit colors
 17set termguicolors
 18
 19" enable hybrid numbers
 20set nu rnu
 21
 22" mouse is bad, but sometimes is useful
 23set mouse=a
 24
 25" this is for better file searching
 26set path=.,**
 27set wildmenu
 28
 29" more intuitive splits
 30set splitbelow splitright
 31
 32" search options
 33set nohlsearch incsearch ignorecase smartcase showmatch
 34
 35" ruler
 36set rulerformat=%35(%{strftime('%F\ %H:%M')}%=%l/%L%=%c%V%=%p%%\ %)
 37
 38" expand tabs to spaces
 39set tabstop=4 softtabstop=4
 40set shiftwidth=4
 41set expandtab
 42
 43" use autoindents
 44set smartindent
 45
 46" replace default behaviour with undotree plugin
 47set noswapfile nobackup
 48set undodir=~/.local/share/nvim/undodir
 49set undofile
 50
 51" actually, i don't remember what is this...
 52set hidden
 53
 54" fix update time
 55set updatetime=50
 56
 57" remind yourself about 80 column rule
 58set colorcolumn=81
 59
 60" this could be used to show unprintable characters
 61set listchars=tab:>-,eol:$,space:•,trail:~
 62
 63" }}}
 64" plugins: {{{
 65
 66" pluggins are installed with vim plug
 67call plug#begin('~/.local/share/nvim/plugged')
 68Plug '~/.local/share/nvim/plugged/gruvbox', {'branch': 'la-ninpre/la-ninpre'}
 69Plug 'junegunn/goyo.vim'
 70Plug 'junegunn/limelight.vim'
 71Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
 72Plug 'junegunn/fzf.vim'
 73Plug 'mattn/emmet-vim'
 74Plug 'ap/vim-css-color'
 75Plug 'preservim/nerdcommenter'
 76Plug 'tpope/vim-surround'
 77Plug 'mbbill/undotree'
 78Plug 'dense-analysis/ale'
 79Plug 'cespare/vim-toml'
 80Plug 'dag/vim-fish'
 81Plug 'https://tildegit.org/sloum/gemini-vim-syntax'
 82Plug 'karolbelina/uxntal.vim'
 83call plug#end()
 84filetype plugin indent on
 85
 86" }}}
 87" colorscheme: {{{
 88" colorscheme tweaks
 89if exists('+termguicolors')
 90    let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
 91    let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
 92endif
 93
 94let g:gruvbox_contrast_dark='hard'
 95let g:gruvbox_italic=1
 96let g:gruvbox_transparent_bg=1 
 97let g:gruvbox_invert_selection='0'
 98
 99set background=dark
100colorscheme gruvbox
101
102" }}}
103" mappings: {{{
104
105" easier navigation in splits
106map <C-H> <C-W><C-H>
107map <C-L> <C-W><C-L>
108map <C-J> <C-W><C-J>
109map <C-K> <C-W><C-K>
110
111" replace all occurencies of the word under the cursor
112nnoremap <leader>su :%s/\<<C-r><C-w>\>/
113
114" show or hide undo tree
115nnoremap <leader>u :UndotreeToggle<CR>
116
117" open helptags
118nnoremap <leader>h :Helptags<CR>
119
120" open file with fzf
121nnoremap <leader>o :Files<CR>
122
123" easy source init.vim
124nnoremap <leader><CR> :so ~/.config/nvim/init.vim<CR>
125" easy open init.vim
126nnoremap <leader>vc :e ~/.config/nvim/init.vim<CR>
127
128" show or hide unprintable characters
129nnoremap <leader>sl :set list<CR>
130nnoremap <leader>sn :set nolist<CR>
131
132" goyo
133nnoremap <leader>go :Goyo<CR>
134
135" actually magick!
136" this moves higlighted block up or down
137vnoremap J :m '>+1<CR>gv=gv
138vnoremap K :m '<-2<CR>gv=gv
139
140" alias for capturing group in command mode (for use with regexps)
141cmap ;( \(\)<Left><Left>
142
143" }}}
144" autocommands: {{{
145
146" limelight on when goyo
147autocmd! User GoyoEnter Limelight
148autocmd! User GoyoLeave Limelight!
149
150" fix wrong nvim size when starting in alacritty
151autocmd VimEnter * :silent exec "!kill -s SIGWINCH $PPID"
152
153" enable insert mode when entering git commit message
154autocmd VimEnter */COMMIT_EDITMSG startinsert
155
156" highlight yanked text (needs nvim 0.5.x)
157augroup highlight_yank
158    autocmd!
159    autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank({timeout = 40})
160augroup END
161
162" }}}
163" vim: ft=vim fdm=marker: