-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux.vimrc
154 lines (153 loc) · 4.23 KB
/
linux.vimrc
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
150
151
152
153
call plug#begin('~/.vim/plugged')
" List of plugins
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'joshdick/onedark.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'tikhomirov/vim-glsl'
Plug 'leafOfTree/vim-svelte-plugin'
Plug 'mxw/vim-jsx'
Plug 'mattn/emmet-vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-fugitive'
Plug 'sheerun/vim-polyglot'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'dense-analysis/ale'
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'yuezk/vim-js'
Plug 'tpope/vim-surround'
Plug 'neoclide/coc.nvim'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'honza/vim-snippets'
Plug 'HerringtonDarkholme/yats.vim'
if empty(glob('~/.vim/plugged/'))
PlugInstall
endif
call plug#end()
syntax enable
colo onedark
" Make SPACE usable in keymappings
nnoremap <SPACE> <Nop>
let g:mapleader = " "
" Setting up plugins
let g:airline_theme='onedark'
set laststatus=2
let g:airline#extensions#lsp#enabled = 1
let g:airline_section_l = airline#section#create(['filename', 'paste', 'lsp'])
let g:airline_section_r = airline#section#create(['lineinfo', 'percent', 'fileformat', 'fileencoding', 'filetype'])
let g:airline_section_x = airline#section#create(['coc'])
let g:airline#parts#filename#formatter = 'shorten'
let g:airline#parts#filename#shorten_length = 85
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsUnicodeDecorateFileNodes = 1
let g:yats_host_keyword = 1
let g:NERDTreeFileExtensionHighlightFullName = 1
let NERDTreeHighlightFileTypes = 1
let NERDTreeShowBookmarks = 1
let NERDTreeGitStatusIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ 'Ignored' : '☒',
\ 'Unknown' : '⚠︎',
\ }
" Keymappings
nnoremap <C-g> :!g++ % -o %:r && chmod u+x ./%:r && ./%:r<CR>
nnoremap <C-y> :!python3 %<CR>
nnoremap <C-o> :w<CR>:!node %<CR>
nnoremap <C-s> :w<CR>:!npx svelte-check %<CR>
nnoremap <C-p> :CtrlP<CR>
nnoremap <C-b> :!chmod u+x ./%:r && ./%:r<CR>
nnoremap <F2> :w<CR>
nnoremap <F3> :vsp<CR>
nnoremap <F4> :sp<CR>
nnoremap <F5> :q<CR>
nnoremap <F9> :set invnumber<CR>
nnoremap <F10> :set invrelativenumber<CR>
nnoremap <leader>t :ALEToggle<CR>
nnoremap <leader>e :NERDTreeCWD<CR>
nnoremap <leader>d :CocDefinition<CR>
nnoremap <leader>h :CocHover<CR>
nnoremap <leader>r :CocRename<CR>
nnoremap <leader>f :CocFormat<CR>
nnoremap <leader>c :CocType<CR>
nnoremap <leader>x :CocFix<CR>
nnoremap <C-f> :FZF<CR>
nnoremap <C-z> :Files<CR>
" Auto close tags
inoremap { {}<Esc>i
inoremap ( ()<Esc>i
inoremap [ []<Esc>i
inoremap " ""<Esc>i
inoremap ' ''<Esc>i
inoremap < <><Esc>i
inoremap > <C-g>u><CR>==i
inoremap " ""<Esc>i
inoremap ' ''<Esc>i
inoremap ( ()<Esc>i
inoremap [ []<Esc>i
inoremap { {}<Esc>i
" Coc extensions
let g:coc_global_extensions = [
\ 'coc-tsserver',
\ 'coc-svelte',
\ 'coc-clangd',
\ 'coc-json',
\ 'coc-python',
\ 'coc-sql',
\ 'coc-emmet',
\ 'coc-rust-analyzer',
\ 'coc-glslx',
\ 'coc-vimlsp',
\ 'coc-css',
\ ]
" Set autocomplete with TAB
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <Tab>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <silent><expr> <c-space> coc#refresh()
inoremap <silent><expr> <c-@> coc#refresh()
inoremap <expr> <Tab> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
inoremap <expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"
" Settings for emmet to expand abbreviation when TAB is pressed
augroup EmmetSettings
autocmd! FileType html imap <tab> <plug>(emmet-expand-abbr)
augroup END
" Setting regular vim params
set undofile
set clipboard=unnamedplus
set showmatch
set incsearch
set ruler
set wrap
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set relativenumber
set autoindent
set ignorecase
set incsearch
set number
set cursorline
set cursorcolumn
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
" Disable scrollbars (hackers don't use scrollbars for navigation)
set guioptions-=l
set guioptions-=L
set guioptions-=r
set guioptions-=R