all repos

dotfiles @ 3bad26598355d78a7586e6f059a98137bbfa6159

my dotfiles

config/nvim/init.vim (view raw)

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
145
146
147
148
149
call plug#begin("~/.vim/plugged")
  Plug 'Smirnov-O/nten16.vim'
  Plug 'sheerun/vim-polyglot'
  Plug 'jiangmiao/auto-pairs'
  Plug 'scrooloose/nerdtree'
  Plug 'w0rp/ale'
call plug#end()

"== General
set termguicolors
colorscheme nten16

" Line numbers
set nu rnu

" Line wrap
set linebreak wrap

" Tabs
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab
set expandtab
set autoindent

" Status line
set ruler laststatus=0

" Maximux item in popup
set pumheight=8

" Scroll
set scrolloff=3

" Mouse
set mouse=a
set mousehide
set cursorline

" Encoding
set encoding=utf-8
set fileencodings=utf-8

" Backup file & history
set nobackup noswapfile noundofile
set history=500

" Search
set incsearch
set ignorecase
set smartcase

" Enable mode line
set modeline

" Auto reload file
set autoread

" Buffer
set hidden

" Space/tab indicator
set list listchars=tab:\|·,trail:~,extends:>,precedes:<,space:·

" Disable sound
set visualbell t_vb=


"== Aliases
command! Term     :vs|wincmd L|vert res 50|set nonu nornu|startinsert|term
command! Prettier :silent !prettier % --write
command! ESlint   :!eslint %
command! Black    :silent !black %
command! AutoPep8 :silent !autopep8 % --in-place
command! Flake8   :!flake8 %
command! GoFmt    :silent !gofmt -w %
command! GoLint   :!golint %


"== Settings for specific files
autocmd FileType python setlocal ex sw=4 ts=4
autocmd FileType go setlocal noex sw=4 ts=4
autocmd FileType javascript,javascriptreact,yaml setlocal et sw=2 ts=2


"== ALE
let g:ale_disable_lsp = 1
let g:ale_echo_msg_format = '%severity%: %s'
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'python': ['flake8'],
\ 'go': ['golint']
\ }


"== NERDTree
let g:NERDTreeWinPos = "right"
let g:NERDTreeMinimalUI = 1
let g:NERDTreeWinSize = 24


"== Mapping
let mapleader=";"

" NerdTree
nnoremap <leader>e :NERDTreeToggle<CR>

" Terminal
tnoremap <Esc> <C-\><C-n>
nnoremap <leader>t :Term<CR>

" Alternative keys
nnoremap <C-s>   :w<CR>
nnoremap <C-n>   :tabnew<CR>
nnoremap <space> :noh<CR>

" Window
nnoremap <C-h> :wincmd h<CR>
nnoremap <C-j> :wincmd j<CR>
nnoremap <C-k> :wincmd k<CR>
nnoremap <C-l> :wincmd l<CR>

" Split
nnoremap spv :vsp<CR>
nnoremap sph :sp<CR>
nnoremap spj :wincmd K<CR>
nnoremap spk :wincmd L<CR>

" Tab
nnoremap tn :tabnew<CR>
noremap <A-1> :tabn 1<CR>
noremap <A-2> :tabn 2<CR>
noremap <A-3> :tabn 3<CR>
noremap <A-4> :tabn 4<CR>
noremap <A-5> :tabn 5<CR>
noremap <A-6> :tabn 6<CR>
noremap <A-7> :tabn 7<CR>
noremap <A-8> :tabn 8<CR>
noremap <A-9> :tabn 9<CR>

" Buffer
nnoremap <leader>j :bnext<CR>
nnoremap <leader>k :bprev<CR>
nnoremap <leader>h :bdele<CR>

" Working with system clipboard
noremap <leader>c "+y<CR>
noremap <leader>v "+p<CR>