-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.vim
261 lines (226 loc) · 6.57 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
" install vimplug if not installed
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source ~/.config/nvim/init.vim
endif
" enable true color in terminal
if (empty($TMUX))
if (has("nvim"))
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
if (has("termguicolors"))
set termguicolors
endif
endif
" PLUG
call plug#begin("~/.vim/plugged")
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.0' }
Plug 'nvim-telescope/telescope-file-browser.nvim'
Plug 'ryanoasis/vim-devicons'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'fannheyward/telescope-coc.nvim'
Plug 'OmniSharp/omnisharp-vim'
Plug 'puremourning/vimspector'
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
Plug 'sheerun/vim-polyglot'
Plug 'kamykn/spelunker.vim'
Plug 'kamykn/popup-menu.nvim'
Plug 'jiangmiao/auto-pairs'
Plug 'wakatime/vim-wakatime'
Plug 'preservim/nerdcommenter'
Plug 'navarasu/onedark.nvim' " theme
Plug '1612492/github.vim' " theme
Plug 'folke/todo-comments.nvim'
Plug 'ThePrimeagen/vim-be-good'
"Plug 'itchyny/lightline.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tpope/vim-fugitive'
Plug 'vimwiki/vimwiki'
Plug 'vim-scripts/taglist.vim'
Plug 'eandrju/cellular-automaton.nvim'
Plug 'airblade/vim-gitgutter'
Plug 'akinsho/toggleterm.nvim', {'tag' : '*'}
Plug 'kdheepak/lazygit.nvim'
Plug 'mhinz/vim-startify' " start screen
Plug 'NvChad/nvim-colorizer.lua' " highlight color values
Plug 'williamboman/mason.nvim', { 'do': ':MasonUpdate' } " package manager
call plug#end()
" COC
let g:coc_global_extensions = ['coc-emmet', 'coc-css', 'coc-html', 'coc-json', 'coc-prettier', 'coc-tsserver']
command! -nargs=0 Prettier :CocCommand prettier.formatFile
" GoTo code navigation
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi :Telescope coc implementations<CR>
nmap <silent> gr :Telescope coc references<CR>
xmap <leader>fo <Plug>(coc-format-selected)
nmap <leader>fo <Plug>(coc-format-selected)
command! -nargs=0 Format :call CocActionAsync('format')
nnoremap <silent> S :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('S', 'in')
endif
endfunction
lua require("toggleterm").setup()
lua require("colorizer").setup()
lua require("mason").setup()
let g:NERDTreeWinSize=35
let g:NERDTreeShowHidden = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeIgnore = []
let g:NERDTreeStatusline = ''
" automatically close nvim if NERDTree is only thing left open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:Tlist_WinWidth=50
let g:enable_spelunker_vim = 1
let g:spelunker_check_type = 2
let g:spelunker_disable_acronym_checking = 1
let g:spelunker_disable_email_checking = 1
let g:spelunker_disable_uri_checking = 1
let g:spelunker_highlight_type = 2
" VimWiki
let g:vimwiki_syntax = 'markdown'
let g:vimwiki_ext = '.md'
let g:vimwiki_automatic_nested_syntaxes = 1
set linebreak
set textwidth=0
set wrapmargin=0
set laststatus=2
set noshowmode
set scrolloff=10
set number relativenumber
set nospell
set wrap
set number
set tabstop=4
set expandtab
set autoindent
set cursorline
set encoding=UTF-8
set guifont=DroidSansMono_Nerd_Font:h11
set nocompatible
" open new split panes to right and below
set splitright
set splitbelow
set ignorecase smartcase
set showtabline=2
set mouse=
" THEMEING
set termguicolors
colorscheme github
let g:airline_theme = 'dark_dimmed'
let g:airline_section_x=''
let g:airline_section_y=''
let g:airline_section_z='%l / %L | %3p%%'
set background=dark
"hi Normal guibg=NONE ctermbg=NONE " make background transparent
hi TabLineFill guifg=#22272E guibg=#22272E
hi TabLine guifg=#2D333B guibg=#585d61
hi TabLineSel guifg=#2D333B guibg=#6CB6FF
let g:onedark_config = {
\ 'style': 'deep',
\}
let g:lightline = {
\ 'colorscheme': 'one',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'filename', 'modified' ] ],
\ 'right': [ [ ],
\ [ 'percent' ],
\ [ ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
syntax on
filetype plugin on
" TELESCOPE
lua << EOF
_G.telescope_find_files_in_path = function(path)
local _path = path or vim.fn.input("Dir: ", "", "dir")
require("telescope.builtin").find_files({search_dirs = {_path}})
end
EOF
lua << EOF
_G.telescope_live_grep_in_path = function(path)
local _path = path or vim.fn.input("Dir: ", "", "dir")
require("telescope.builtin").live_grep({search_dirs = {_path}})
end
EOF
lua << EOF
local actions = require('telescope.actions')
require('telescope').setup({
defaults = {
mappings = {
i = {
["<C-q>"] = actions.send_to_qflist
}
}
}
})
EOF
lua << EOF
require("telescope").setup {
extensions = {
coc = {
theme = 'ivy',
prefer_locations = true, -- always use Telescope locations to preview definitions/declarations/implementations etc
},
file_browser = {
theme = "ivy",
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
["i"] = {
},
["n"] = {
},
},
},
},
}
require("telescope").load_extension "file_browser"
require('telescope').load_extension('coc')
EOF
" TODO COMMENTS
lua << EOF
require("todo-comments").setup {
keywords = {
QUESTION = {
icon = "?",
color = "hint"
}
}
}
EOF
" BINDINGS
nnoremap <SPACE> <Nop>
let mapleader = " "
tnoremap <Esc> <C-\><C-n> " turn terminal to normal mode with escape
vnoremap p "_dP " replace currently selected text with default register without yanking it
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader>h :noh<CR>
nnoremap <leader>td :TodoQuickFix<CR>
nnoremap <leader>fp :lua telescope_find_files_in_path()<CR>
nnoremap <leader>fP :lua telescope_live_grep_in_path()<CR>
nnoremap <leader>ff :Telescope find_files<CR>
nnoremap <leader>fb :Telescope buffers<CR>
nnoremap <leader>fc :Telescope live_grep<CR>
nnoremap <leader>t :ToggleTerm<CR>
nnoremap <silent> <F8> :TlistToggle<CR>
nnoremap <silent> <leader>gg :LazyGit<CR>
vmap + <plug>NERDCommenterToggle
nmap + <plug>NERDCommenterToggle
map <F12> <C-]>
map Y "+y<CR>