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