This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinit.vim
277 lines (222 loc) · 6.06 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
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
" PLUGINS
" ~/.config/nvim/plugged (UNIX)
" /user/<username>/appdata/local/nvim/plugged (WINDOWS)
call plug#begin(stdpath('config').'/plugged')
"Looks
Plug 'navarasu/onedark.nvim'
Plug 'kyazdani42/nvim-web-devicons'
"Functional
Plug 'jiangmiao/auto-pairs'
Plug 'nvim-lua/plenary.nvim'
Plug 'voldikss/vim-floaterm'
Plug 'glepnir/dashboard-nvim'
Plug 'nvim-telescope/telescope.nvim'
"Hybrid
Plug 'hoob3rt/lualine.nvim'
Plug 'lewis6991/gitsigns.nvim'
"Navigation
Plug 'kyazdani42/nvim-tree.lua'
Plug 'romgrk/barbar.nvim'
Plug 'unblevable/quick-scope'
Plug 'justinmk/vim-sneak'
call plug#end()
" KEYBINDINGS
" leaders
let g:mapleader = " "
let g:maplocalleader = ','
"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" clear highlight
nnoremap <leader>m :noh<return>
nno <BS> :set hls!\|set hls?<CR>
" init.vim quick edits
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" show colors
nnoremap <leader>c :so $VIMRUNTIME/syntax/hitest.vim<return>
" toggle wrap
nnoremap <buffer><localleader>w :set wrap!<cr>
" buffer settings
nnoremap <s-tab> :bp<return>
nnoremap <tab> :bn<return>
nnoremap <silent><leader>d :bp\|bd #\|BarbarEnable<return>
" save remaps
nnoremap <leader>W :w !diff % -<cr>
nnoremap <leader>w :w<cr>
" primeagen remaps
nnoremap Y y$
nnoremap n nzzzv
nnoremap N Nzzzv
nnoremap J mzJz`v
" STANDARD SETTINGS
" natural split settings
set splitbelow
set splitright
" Enable folding
set foldmethod=indent
set foldlevel=99
" Code Editor settings
filetype plugin on
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
" Core settings
filetype plugin on
set tabstop=4
set encoding=utf-8
syntax on
set nu
set clipboard=unnamedplus " public copy/paste register
set ruler
set nowrap
set showcmd
set noswapfile " doesn't create swap files
set noshowmode
set shortmess+=c
set omnifunc=syntaxcomplete#Complete
set shell=cmd
set hidden
" Indentation and mouse
set backspace=indent,eol,start " let backspace delete over lines
set autoindent
set smartindent " allow vim to best-effort guess the indentation
set pastetoggle=<F1> " enable paste mode
set mouse+=a
" Searching
set smartcase
set ignorecase
set wildmenu "graphical auto complete menu
"set lazyredraw "redraws the screne when it needs to
set showmatch "highlights matching brackets
set incsearch "search as characters are entered
set nohlsearch "remove highlight
" run code
augroup compileandrun
autocmd!
autocmd filetype python nnoremap <f5> :w <bar> :!python3 % <cr>
autocmd filetype cpp nnoremap <silent> <f3> :!g++ -O0 -fsyntax-only %<cr>
autocmd filetype cpp nnoremap <silent> <f4> :!start cmd /c a.exe ^& pause<cr><cr>
autocmd filetype cpp nnoremap <silent> <f5> :!g++ -O2 %<cr> :!start cmd /c a.exe ^& pause<cr><cr>
autocmd filetype java nnoremap <f5> :w <bar> !javac % && java %:r <cr>
augroup END
"custom
autocmd BufEnter * silent! lcd %:p:h
" RICING
" true colours
if !has('gui_running')
set t_Co=256
endif
if (has("nvim"))
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has("termguicolors"))
set termguicolors
endif
" colorscheme
set background=dark
colorscheme onedarker
" GUI SETTINGS
" standard
set guifont=JetBrainsMono\ NF:h14
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=L
" neovide specific
function Neovide_fullscreen()
if g:neovide_fullscreen == v:true
let g:neovide_fullscreen=v:false
else
let g:neovide_fullscreen=v:true
endif
endfunction
map <F11> :call Neovide_fullscreen()<cr>
" Temperory till, neovide resolves the blur issues
let g:neovide_window_floating_opacity = 0
let g:neovide_floating_blur = 0
let g:neovide_floating_opacity = 0.9
" PLUGIN SETTINGS
" --- LOOKS ---
" NO-config: <colorscheme>, nvim-web-devicons
" --- FUNCTIONAL ---
" NO-config: auto-pairs, plenary
"VIM-FLOATERM
let g:floaterm_keymap_toggle = '<F1>'
" DASHBOARD
let g:dashboard_default_executive ='telescope'
let g:dashboard_custom_header = [
\'','','','',
\'Welcome back Mate!',
\'','','','',
\] " Change to your name
let g:dashboard_custom_shortcut={
\ 'last_session' : ' ',
\ 'find_history' : ' ',
\ 'find_file' : 'CTRL P',
\ 'new_file' : ' ',
\ 'change_colorscheme' : ' ',
\ 'find_word' : ' ',
\ 'book_marks' : ' ',
\ }
" TELESCOPE
nnoremap <silent><C-P> :Telescope find_files<cr>
"
" --- HYBRID ---
" LUALINE
lua require('custom.lualine')
" GITSIGNS
lua require('gitsigns').setup()
nnoremap <silent><leader>gn :Gitsigns next_hunk<cr>zzzv
nnoremap <silent><leader>gp :Gitsigns prev_hunk<cr>zzzv
nnoremap <silent><leader>gg :Gitsigns preview_hunk<cr>
nnoremap <leader>gs :Gitsigns stage_hunk<cr>
nnoremap <leader>gc :!git commit -m "
" --- NAVIGATION ---
" NVIM TREE
" lua settings
lua require('plugin-config/nvimTree')
" cursorline
autocmd! BufEnter * call ToggleCursorLine()
function! ToggleCursorLine()
if (bufname("%") =~ "NvimTree")
setlocal cursorline
else
setlocal nocursorline
endif
endfunction
" BARBAR
let bufferline = get(g:, 'bufferline', {})
" (compatibility with NVIM-TREE)
let s:treeEnabled=0
function! ToggleNvimTree()
if s:treeEnabled
lua require('custom.tree').close()
let s:treeEnabled = 0
else
lua require('custom.tree').open()
let s:treeEnabled = 1
endif
endfunction
nnoremap <silent><leader>f :call ToggleNvimTree()<cr>
let bufferline.auto_hide = v:true
let bufferline.animation = v:true
let bufferline.no_name_title = "untitled"
" QUICK SCOPE
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
" SNEAK
" global
let g:sneak#prompt = ' '
let g:sneak#s_next = 1
let g:sneak#use_ic_scs = 1
let g:sneak#label = 1
" highlights
highlight Sneak guifg=white guibg=#708be6 ctermfg=black ctermbg=red gui=none
highlight SneakScope guifg=black guibg=#49A3ff ctermfg=red ctermbg=yellow gui=italic
" remap plugs for
map gS <Plug>Sneak_,
map gs <Plug>Sneak_;