-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
187 lines (150 loc) · 5.43 KB
/
init.vim
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
"
" ______________________
" / ░█░█░▀█▀░█▄█░█▀▄░█▀▀ \
" | ░▀▄▀░░█░░█░█░█▀▄░█░░ |
" \ ░░▀░░▀▀▀░▀░▀░▀░▀░▀▀▀ /
" ----------------------
" \ ^__^
" \ (oo)\_______
" (__)\ )\/\
" ||----w |
" || ||
"
"
scriptencoding utf-8
set encoding=utf-8
:set number
:set autoindent
:set tabstop=4
:set shiftwidth=4
:set smarttab
:set softtabstop=4
:set mouse=a
:set clipboard+=unnamedplus
:set expandtab
set cursorline
highlight clear CursorLine
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
call plug#begin()
Plug 'http://github.com/tpope/vim-surround' " Surrounding ysw)
Plug 'https://github.com/preservim/nerdtree' " NerdTree
Plug 'https://github.com/tpope/vim-commentary' " For Commenting gcc & gc
Plug 'https://github.com/vim-airline/vim-airline' " Status bar
Plug 'https://github.com/rafi/awesome-vim-colorschemes' " Retro Scheme
Plug 'neoclide/coc.nvim', { 'branch': 'master', 'do': 'yarn install --frozen-lockfile' }
Plug 'https://github.com/ryanoasis/vim-devicons' " Developer Icons
Plug 'https://github.com/tc50cal/vim-terminal' " Vim Terminal
" sudo apt install exuberant-ctags
Plug 'https://github.com/preservim/tagbar' " Tagbar for code navigation
Plug 'https://github.com/terryma/vim-multiple-cursors' " CTRL + N for multiple cursors
Plug 'https://github.com/tpope/vim-sleuth' " Automatically figures out whether to use tabs or spaces
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'glepnir/dashboard-nvim'
Plug 'tpope/vim-fugitive'
Plug 'kyazdani42/nvim-web-devicons' " Recommended (for coloured icons)
Plug 'akinsho/bufferline.nvim', { 'tag': '*' }
Plug 'francoiscabrol/ranger.vim'
Plug 'rbgrouleff/bclose.vim'
Plug 'folke/which-key.nvim'
Plug 'vimwiki/vimwiki'
Plug 'dominikduda/vim_current_word'
call plug#end()
" Run :PlugInstall to install these plugins
" Shortcuts
" ---------
let g:mapleader="\<Space>"
nnoremap <C-l> :call CocActionAsync('jumpDefinition')<CR>
" Ctrl + s to save file
:nmap <c-s> :w<CR>
:imap <c-s> <Esc>:w<CR>a
nmap <Leader>ss :<C-u>SessionSave<CR>
nmap <Leader>sl :<C-u>SessionLoad<CR>
nnoremap <silent> <Leader>fh :DashboardFindHistory<CR>
nnoremap <silent> <Leader>ff :DashboardFindFile<CR>
nnoremap <silent> <Leader>tc :DashboardChangeColorscheme<CR>
nnoremap <silent> <Leader>fw :DashboardFindWord<CR>
nnoremap <silent> <Leader>fb :DashboardJumpMark<CR>
nnoremap <silent> <Leader>nf :DashboardNewFile<CR>
nnoremap <silent> <Leader>fd :Dashboard<CR>
" Open the vimrc file using SPACE: f e d
let g:vimrc_path = expand('<sfile>')
:nnoremap <Leader>fc :exec "e ".g:vimrc_path<cr>
:nnoremap <silent> <Leader>fcr :source $MYVIMRC<cr>
nnoremap <silent> <Leader>tn :NERDTreeToggle<CR>
nnoremap <silent> <Leader>tt :TagbarToggle<CR>
" fzf power
nnoremap <silent> <Leader>fzb :BLines<CR>
nnoremap <silent> <Leader>fzl :Lines<CR>
" Leader mappings
:nnoremap <Leader><Leader> :Maps<cr>
" Settings
" --------
":set completeopt-=preview " For No Previews
:colorscheme jellybeans
let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"
" air-line
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:dashboard_default_executive ='fzf'
let g:dashboard_custom_shortcut={
\ 'last_session' : 'SPC s l',
\ 'find_history' : 'SPC f h',
\ 'find_file' : 'SPC f f',
\ 'new_file' : 'SPC n f',
\ 'change_colorscheme' : 'SPC t c',
\ 'find_word' : 'SPC f w',
\ 'book_marks' : 'SPC f b',
\ 'Open vim config' : 'SPC f c',
\ 'Ranger' : 'SPC f',
\ }
" Display tabs and spaces
set list
set listchars=tab:▸·,trail:~,extends:>,precedes:<,space:-
" In your init.lua or init.vim
set termguicolors
lua << EOF
require("bufferline").setup{}
EOF
" These commands will navigate through buffers in order regardless of which mode you are using
" e.g. if you change the order of buffers :bnext and :bprevious will not respect the custom ordering
nnoremap <silent>[b :BufferLineCycleNext<CR>
nnoremap <silent>b] :BufferLineCyclePrev<CR>
" These commands will move the current buffer backwards or forwards in the bufferline
nnoremap <silent><mymap> :BufferLineMoveNext<CR>
nnoremap <silent><mymap> :BufferLineMovePrev<CR>
" These commands will sort buffers by directory, language, or a custom criteria
nnoremap <silent>be :BufferLineSortByExtension<CR>
nnoremap <silent>bd :BufferLineSortByDirectory<CR>
nnoremap <silent><mymap> :lua require'bufferline'.sort_buffers_by(function (buf_a, buf_b) return buf_a.id < buf_b.id end)<CR>
lua << EOF
require("which-key").setup {
}
EOF
" ==============================================================================
" NOTES
" -----
" :map-- to show all mappings
"
" ** commentary.vim
" Command: gc, gcc
" ** Coc
" Install latest nodejs : sudo su; curl -sL install-node.now.sh | bash
" pip3 install jedi
" Run yarn install and yarn build inside plugged/coc.nvim
" :CocInstall coc-python
" :CocInstall coc-clangd
" :CocCommand clangd.install
" Folding
" :setlocal foldmethod=syntax