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