-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
233 lines (184 loc) · 6.4 KB
/
.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2019 Dec 17
"
" To use it, copy it to
" for Unix: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-Windows: $VIM\_vimrc
" for Haiku: ~/config/settings/vim/vimrc
" for OpenVMS: sys$login:.vimrc
" When started as "evim", evim.vim will already have done these settings, bail
" out.
if v:progname =~? "evim"
finish
endif
" Get the defaults that most users want.
" source $VIMRUNTIME/defaults.vim
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file (restore to previous version)
if has('persistent_undo')
set undofile " keep an undo file (undo changes after closing)
endif
endif
if &t_Co > 2 || has("gui_running")
" Switch on highlighting the last used search pattern.
set hlsearch
endif
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
augroup END
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Add optional packages.
"
" The matchit plugin makes the % command work better, but it is not backwards
" compatible.
" The ! means the package won't be loaded right away but when plugins are
" loaded during initialization.
if has('syntax') && has('eval')
packadd! matchit
endif
" Plugins
call plug#begin('~/.vim/plugged')
" Easy escape using jk
Plug 'zhou13/vim-easyescape'
" Nerdtree file explorer
Plug 'preservim/nerdtree'
" T-comment
Plug 'tomtom/tcomment_vim'
" Autoclose plugin
Plug 'Townk/vim-autoclose'
" Jedi python autocomplete
Plug 'davidhalter/jedi-vim'
" Easy Grep
Plug 'vim-scripts/EasyGrep'
" Rename variables
Plug 'vim-scripts/rename.vim'
" Vim Surround https://github.com/tpope/vim-surround
Plug 'tpope/vim-surround'
" Status line
Plug 'itchyny/lightline.vim'
" Conquer of Completion
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Autoclose html tags
Plug 'alvan/vim-closetag'
" Emmet features in vim
Plug 'mattn/emmet-vim'
" Startify welcome screen
Plug 'mhinz/vim-startify'
" Show color for colors codes
" golang must be installed before the plugin
Plug 'RRethy/vim-hexokinase', { 'do': 'make hexokinase' }
" Vim Wiki for taking notes and what not
" For writing markdown basically
Plug 'vimwiki/vimwiki'
" show git branch in status line
Plug 'itchyny/vim-gitbranch'
Plug 'ternjs/tern_for_vim', { 'do' : 'npm install' }
call plug#end()
let g:easyescape_chars = { "j": 1, "k": 1 }
" let g:easyescape_timeout = 100
cnoremap jk <Esc>
cnoremap kj <Esc>
vnoremap <C-L> <Esc>
vnoremap <C-L> <Esc>
set hls
set tabstop=4
set shiftwidth=4
set expandtab
set number
set termguicolors
set mouse=a
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" NERDTree settings
let NERDTreeShowHidden=1
" Emmet vim options
let g:user_emmet_settings = {
\ 'variables': {'lang': 'en'},
\ 'html': {
\ 'snippets': {
\ 'html:5': "<!DOCTYPE html>\n"
\ ."<html lang=\"${lang}\">\n"
\ ."<head>\n"
\ ."\t<meta charset=\"${charset}\">\n"
\ ."\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n"
\ ."\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
\ ."\t<title>|</title>\n"
\ ."</head>\n"
\ ."<body>\n\t${child}|\n</body>\n"
\ ."</html>",
\ },
\ },
\}
" Keybinding to toggle NERDTree
nnoremap <leader>t :NERDTreeToggle<CR>
set splitbelow " Open terminal below
set splitright
" Keybinding to open terminal
nnoremap <leader>` :terminal<CR>
nnoremap <C-`> :terminal<CR>
" Keybindings to move through windows
nnoremap <C-\>j <C-w>j
nnoremap <C-\>k <C-w>k
nnoremap <C-\>l <C-w>l
nnoremap <C-\>h <C-w>h
tnoremap <C-\>j <C-w>j
tnoremap <C-\>k <C-w>k
tnoremap <C-\>l <C-w>l
tnoremap <C-\>h <C-w>h
" Keybinding to go to startify page
nnoremap <leader>s :Startify<CR>
" Keybinding to switch to 'Terminal-Normal mode' inside the vim terminal
tnoremap <C-n> <c-\><c-n>
" Configs for lightline.vim
set laststatus=2 " becasue the status line is not visible
set noshowmode " to not show the insert twice
let g:lightline = {
\ 'colorscheme': 'powerlineish',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ]],
\ },
\ 'component_function': {
\ 'gitbranch': 'gitbranch#name',
\ },
\
\ }
" Startify options
let g:startify_bookmarks = [ {'rc': '~/.vimrc'}, {'i3': '~/.config/i3/config'}, {'sc': '~/.config/scripts/'}, {'pb': '~/.config/polybar/config.ini'} ]
" Hexokinase options
let g:Hexokinase_highlighters = ['backgroundfull']
let g:Hexokinase_ftOptInPatterns = {
\ 'css': 'full_hex,rgb,rgba,hsl,hsla,colour_names',
\ 'html': 'full_hex,rgb,rgba,hsl,hsla,colour_names',
\ 'javascript': 'full_hex,rgb,rgba,hsl,hsla,colour_names',
\ 'cfg': 'full_hex',
\ 'dosini': 'full_hex',
\ 'i3config': 'full_hex',
\ }
" VimWiki options
set nocompatible
filetype plugin on
syntax on
let g:vimwiki_list = [{'path': '~/megasync/Notes/vimwiki', 'syntax': 'markdown', 'ext': '.md'}, {'path': '~/Documents/Notes/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
" show command enterred bottom right corner
set showcmd
" Run python file on pressing F5
autocmd FileType python map <buffer> <F5> :w<CR>:exec '!clear;python3' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F5> <esc>:w<CR>:exec '!clear;python3' shellescape(@%, 1)<CR>
" Run java file on pressing F5
autocmd FileType java map <buffer> <F5> :w<CR>:exec '!javac' shellescape(@%, 1) '&& java' shellescape(expand('%:t:r'), 1) '&& rm ./*.class' <CR>
autocmd FileType java imap <buffer> <F5> <esc>:w<CR>:exec '!javac' shellescape(@%, 1) '&& java' shellescape(expand('%:t:r'), 1) '&& rm ./*.class' <CR>
" Autopep8 for python
autocmd FileType python setlocal formatprg=autopep8\ -