-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit.vim
More file actions
130 lines (118 loc) · 4.02 KB
/
init.vim
File metadata and controls
130 lines (118 loc) · 4.02 KB
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
call plug#begin('~/.config/nvim/bundle')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'scrooloose/syntastic'
Plug 'tpope/vim-surround'
Plug 'bling/vim-airline'
Plug 'morhetz/gruvbox' " Theme
Plug 'airblade/vim-gitgutter' " Gutter git highlighting
Plug 'scrooloose/nerdcommenter'
Plug 'jiangmiao/auto-pairs'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-fugitive' " Git Wrapper
Plug 'wesQ3/vim-windowswap' " Window swapper
Plug 'ryanoasis/vim-devicons' " Icons for NERDTree
Plug 'terryma/vim-smooth-scroll'
call plug#end()
" --------- IntelliSense --
" go to definition
nmap <silent> gd <Plug>(coc-definition)
" go to type definition
nmap <silent> gy <Plug>(coc-type-definition)
" go to implementation
nmap <silent> gi <Plug>(coc-implementation)
" display references
nmap <silent> gr <Plug>(coc-references)
" coc config
let g:coc_global_extensions = [
\ 'coc-snippets',
\ 'coc-pairs',
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-prettier',
\ 'coc-json',
\ 'coc-html',
\ 'coc-css',
\ 'coc-python',
\ 'coc-angular',
\ 'coc-flutter',
\ 'coc-tabnine',
\ 'coc-rls'
\ ]
" tab completion
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" ---------- Custom Hotkeys -
let mapleader = "," " map leader key as ,
" jj -> exit insert mode
:imap jj <Esc>
" spacebar x2 -> types : to begin command
:nmap <Space><Space> :
" Search directory
" shift+p -> search file names some rules in .zshrc and .rgignore
:nmap <S-p> :Files<Cr>
" shift+f -> search in files
:nmap <S-f> :Ag<Cr>
" ,b -> Pulls up opened Buffers
:nmap <leader>b :Buffers<Cr>
" ,s -> splits current buffer horizontally
:nmap <leader>s :split<Cr>
" ,vs -> splits current buffer vertically
:nmap <leader>vs :vsplit<Cr>
" ---------- Terminal Controls ----
" ,vt -> opens terminal in nvim split vertically
:nmap <leader>vt :vsplit term://zsh<Cr>
" ,ht -> opens terminal in nvim split horizontally
:nmap <leader>ht :split term://zsh<Cr>
" jj -> in terminal also exit insert mode
:tnoremap jj <C-\><C-n> " Exit Insert Mode
" --------- Smooth Scroll ----
" ctrl+u -> smooth scroll half page up
noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 0, 2)<CR>
" ctrl+d -> smooth scroll half page down
noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 0, 2)<CR>
" ctrl+b -> smooth scroll full page up
noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 0, 4)<CR>
" ctrl+b -> smooth scroll full page down
noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 0, 4)<CR>
" ---------- Basics ---------
set encoding=utf8
set autoindent
set smartindent
set shiftwidth=4
set smarttab
set clipboard=unnamed
set number
set relativenumber
set incsearch " jump to search match as typing
set nohlsearch " don't highlight my searches
set ignorecase
set smartcase
set noswapfile
set autoread " refreshes changes if buffer opened was changed other places
autocmd BufWritePre * %s/\s\+$//e "Auto-remove trailing whitespace on save
" ================ Git ==============================
" ,g -> Opens Git Blame buffer
nnoremap <Leader>g :Gblame<Cr>
" ,gd -> opens git diff buffer for current buffer
nnoremap <leader>gd :Gvdiff<CR>
nnoremap gdh :diffget //2<CR>
nnoremap gdl :diffget //3<CR>
" --------- NERDTree ---------
autocmd vimenter * if !argc() | NERDTree | endif "open NERDTree by default
autocmd VimEnter * wincmd p "change focus away from NERDTree pane
" ctrl+n -> open NERDTree to current file's location
:map <C-n> :NERDTreeFind<Cr>
let NERDTreeShowHidden=1 " show hidden files in NERDTree
set conceallevel=3 " to hide brackets on dev icons
let g:webdevicons_enable_airline_tabline = 1 " adding to vim-airline's tabline
let g:webdevicons_conceal_nerdtree_brackets = 1 " whether or not to show the nerdtree brackets around flags
" ---------- Theme ---------
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail:·
colorscheme gruvbox
syntax enable