-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
240 lines (211 loc) · 7.25 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
234
235
236
237
238
239
240
" _
" __ _(_)_ __ ___ _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" \_/ |_|_| |_| |_|_| \___|
"
"
" For neovim
" mkdir -p ~/.local/share/nvim
" ln -s ~/.vim ~/.local/share/nvim/site
" ln -s ~/.vimrc .config/nvim/init.vim
set encoding=UTF-8
let vim_plug_just_installed = 0
let vim_plug_path = expand('~/.vim/autoload/plug.vim')
if !filereadable(vim_plug_path)
echo "Installing Vim-plug..."
echo ""
silent !mkdir -p ~/.vim/autoload
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let vim_plug_just_installed = 1
endif
if vim_plug_just_installed " manually load vim-plug the first time
:execute 'source '.fnameescape(vim_plug_path)
endif
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
" Plug 'itchyny/lightline.vim'
" quickscope https://www.youtube.com/watch?v=EsGSwNySNMU
" Plug 'srstevenson/vim-picker'
Plug 'tpope/vim-scriptease'
" cxiw to chan swap words, cxc to clear
Plug 'tommcdo/vim-exchange'
Plug 'unblevable/quick-scope'
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'junegunn/goyo.vim'
Plug 'coldfix/hexHighlight'
Plug 'scrooloose/nerdtree'
Plug 'derekwyatt/vim-fswitch' " switching header and sourc in cpp
Plug 'rking/ag.vim'
Plug 'JamshedVesuna/vim-markdown-preview'
" WORKS WITH NERDTREE:
Plug 'ryanoasis/vim-devicons'
Plug 'mbbill/undotree'
Plug 'junegunn/fzf', { 'do': { ->fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'gruvbox-community/gruvbox'
Plug 'tweekmonster/startuptime.vim'
Plug 'kyoz/purify', { 'rtp': 'vim' }
call plug#end()
" PLUGIN CONFIGS:
" let g:lightline = {'colorscheme': 'wombat'}
" let g:syntastic_python_checkers = ['pylint']
" T-Comment
map <leader>c <c-_><c-_>
" Tabs and Spaces
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
" ENABLE THE CURRENT MILLENIUM
set nocompatible
" SEARCH FOR EVERY SUBDIRECTORY
set path+=**
set wildmenu
syntax enable
" DEFAULT FILE BROWSER
filetype plugin on
filetype indent on
set incsearch " search as characters are entered
set hlsearch " highlight matches
set showmatch " highlight matching [{()}]
set scrolloff=2 " keep cursor 3 lines away from screen border
set laststatus=2 " for powerline
" CREATE THE TAGS FILE INSTALL CTAGS FIRST:
command! MakeTags !ctags -R .
command! MakeTagsCppFull !ctags -R --c++-kinds=+p --fields=+iaS --extra=+q /usr/include
command! MakeTagsPython !ctags -R --languages=python "/usr/lib/python3.9/site-packages"
" - Use ^] to jump to tag under cursor
" - Use ^t to jump back up the tags stack
" - Use ^t for ambigious tags
" SHORTCUTS FOR TABS:
nnoremap tn :tabnew<Space>
nnoremap tk :tabnext<CR>
nnoremap tj :tabprev<CR>
nnoremap th :tabfirst<CR>
nnoremap tl :tablast<CR>
" SAVE XRESOURCES IN EVERY WRITE AND RELOAD:
autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb %
autocmd BufWritePost ~/.github/dwm !update-mime-database ~/.local/share/mime %
autocmd BufRead ~/Dropbox/todo.txt :Goyo
autocmd VimLeave * call system("xsel -ib", getreg('+')) " Prevent Vim from clearing the clipboard on exit
" RUNING MAKE WITH PYTHON:
" autocmd Filetype python set makeprg=python2\ %:S
" NOW WE CAN:
" - Run :make
" - :cl to list errors
" - cc# to jump to error by number
" - :cn and :cp to navigate forward and backward
" BETTER BACKUP AND RESTORE MECHANISM:
set directory=~/.vim/dirs/tmp " directory to place swap files in
set backup " make backup files
set backupdir=~/.vim/dirs/backups " where to put backup files
set undofile " persistent undos - undo after you re-open the file
set undodir=~/.vim/dirs/undos
let g:yankring_history_dir = '~/.vim/dirs/' " store yankring history file there too
if !isdirectory(&backupdir) " create needed directories if they don't exist
call mkdir(&backupdir, "p")
endif
if !isdirectory(&directory)
call mkdir(&directory, "p")
endif
if !isdirectory(&undodir)
call mkdir(&undodir, "p")
endif
" OPEN THE FILE WHERE YOU LEFT OF:
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" |
endif
" RESIZE SPLIT:
nnoremap <C-h> :vertical resize -5<cr>
nnoremap <C-j> :resize +5<cr>
nnoremap <C-k> :resize -5<cr>
nnoremap <C-l> :vertical resize +5<cr>
nnoremap <leader>h :split<Space>
nnoremap <leader>v :vsplit<Space>
nnoremap <leader>n :NERDTreeToggle<cr>
nnoremap <leader><space> :noh<cr>
nnoremap <leader><tab> :FZF<cr>
nnoremap <leader>s :FSHere<cr> " vim-fswitch
" CLIPBOARD COPY ALIAS:
map qq "+
map qw "+
set number
set relativenumber
" Update bindekeys when sxhdrc is updated
autocmd BufWritePost *sxhkdrc !pkill sxhkd; sleep 1; setsid sxhkd &
autocmd BufWritePost ~/.Xresources,~/.Xdefaults !xrdb %
set timeout
set timeoutlen=150
" set t_Co=256
" set background=dark
" highlight Normal ctermbg=NONE
" highlight nonText ctermbg=NONE
let b:ale_linters = ['flake8', 'pylint']
" Disable warnings about trailing whitespace for Python files.
let b:ale_warn_about_trailing_whitespace = 0
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
" MARKDOWN PREVIEWER PETTINGS
" let vim_markdown_preview_github=1
let vim_markdown_preview_hotkey='<C-m>'
let vim_markdown_preview_browser='chromium'
let vim_markdown_preview_use_xdg_open=1
" let vim_markdown_preview_temp_file=1
set updatetime=850
set spell
set spelllang=en_us
set background=dark
" " QUICKSCOPE TRIGGER A HIGHLIGHT IN THE APPROPRIATE DIRECTION WHEN PRESSING THESE KEYS:
" let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
" CODI PLUGIN SETUP FOR REPL WITH VIM
highlight CodiVirtualText guifg=cyan
let g:codi#virtual_text_prefix = "❯ "
" ======== Ag command cheat sheet ========
"
" e to open file and close the quickfix window
" o to open (same as enter)
" go to preview file (open but maintain focus on ag.vim results)
" t to open in new tab
" T to open in new tab silently
" h to open in horizontal split
" H to open in horizontal split silently
" v to open in vertical split
" gv to open in vertical split silently
" q to close the quickfix window
"
"
" " ======== vim picker command mappings ========
" nmap <unique> <leader>pe <Plug>(PickerEdit)
" nmap <unique> <leader>ps <Plug>(PickerSplit)
" nmap <unique> <leader>pt <Plug>(PickerTabedit)
" nmap <unique> <leader>pv <Plug>(PickerVsplit)
" nmap <unique> <leader>pb <Plug>(PickerBuffer)
" nmap <unique> <leader>p] <Plug>(PickerTag)
" nmap <unique> <leader>pw <Plug>(PickerStag)
" nmap <unique> <leader>po <Plug>(PickerBufferTag)
" nmap <unique> <leader>ph <Plug>(PickerHelp)
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
let $FZF_DEFAULT_OPTS='--reverse'
let &t_SI = "\e[6 q"
let &t_EI = "\e[2 q"
" Optionally reset the cursor on start:
augroup myCmds
au!
autocmd VimEnter * silent !echo -ne "\e[2 q"
augroup END
:imap kj <Esc>
:imap jk <Esc>
" color gruvbox
color elflord
" search and highlight but do not jump
nnoremap * :keepjumps normal! mi*`i<CR>
" let g:ale_set_highlights = 0
let g:fzf_tags_command = 'ctags -R'
if executable('ag')
set grepprg=ag\ --vimgrep\ $*
set grepformat^=%f:%l:%c:%m
endif
color purify