-
Notifications
You must be signed in to change notification settings - Fork 0
/
.nvimrc
238 lines (181 loc) · 5.38 KB
/
.nvimrc
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
" BASIC SETTINGS -------------------------------------------------- {{{
" Colorscheme
" :colorscheme molokai
:colorscheme iceberg
" disable vi compatibility which can cause issues
:set nocompatible
" Enable file type detection
:filetype on
" Enable plugins and load plugin for the detected file type
:filetype plugin on
" Load an indent file for the detected fileType
:filetype indent on
"Highlight cursor line
:set cursorline
"Highlight cursor vertically
":set cursorcolumn
:syntax on
:set number
:set showmode
:set relativenumber
" Show partial command you type in last line
:set showcmd
:set title
:set expandtab
:set tabstop=2
:set shiftwidth=2
:set nobackup
:set list
" :set listchars=tab:➤\
" :set listchars=trail:・
" set command history
:set scrolloff=8
:set history=1000
"AUTOCOMPLETION
" enable auto completetion after pressing TAB
:set wildmenu
" set wildmenu to behave like Bash completion
:set wildmode=list:longest
" }}}
" FOLDING SETTINGS --------------------------------------------------{{{
" fold when the code is indented
:set foldmethod=indent
"where to begin fold
:set foldcolumn=1
:let javascript_fold=1
:let python_fold=1
"start file with all folds open
:set foldlevelstart=99
"}}}
" SEARCH SETTINGS ---------------------------------------------- {{{
" highlight characters as you search
:set incsearch
" ignore case during search
:set ignorecase
" Overrise ignore case if searcing for Capital letters
:set smartcase
" show matching words during a search
:set showmatch
" use highlighting during search
:set hlsearch
" }}}
" FILETYPE SPECIFIC FORMATTING ---------------------------------- {{{
"set python tabs
:autocmd Filetype python setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
:let g:python_host_prog = '/Library/Frameworks/Python.framework/Versions/3.9/bin/python'
" basic auto complete
" :autocmd Filetype javascript set omnifunc=javascriptcomplete#CompleteJS
au FileType javascript setlocal formatprg=prettier
au FileType javascript.jsx setlocal formatprg=prettier
au FileType typescript setlocal formatprg=prettier\ --parser\ typescript
au FileType html setlocal formatprg=js-beautify\ --type\ html
au FileType scss setlocal formatprg=prettier\ --parser\ css
au FileType css setlocal formatprg=prettier\ --parser\ css
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'vue': ['eslint'],
\ 'react': ['eslint']
\}
let g:ale_fixers = {
\ 'javascript': ['prettier', 'eslint'],
\ 'typescript': ['prettier', 'tslint'],
\ 'vue': ['eslint'],
\ 'scss': ['prettier'],
\ 'html': ['prettier'],
\ 'reason': ['refmt']
\}
let g:ale_fix_on_save = 1
" sort imports
let g:import_sort_auto = 1
" let g:prettier#config#single_quotes = 'true'
" }}}
" PLUGINS -------------------------------------------------{{{
call plug#begin('~/.vim/plugged')
:packloadall
Plug 'dense-analysis/ale'
Plug 'vim-airline/vim-airline'
Plug 'preservim/nerdtree'
" sort imports
Plug 'ruanyl/vim-sort-imports'
Plug 'prettier/vim-prettier'
Plug 'othree/yajs.vim'
" Plug 'yuezk/vim-js'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'pangloss/vim-javascript'
Plug 'chemzqm/vim-jsx-improve'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
" auto complete
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'jiangmiao/auto-pairs'
" colorscheme
" Plug 'romgrl/doom-one.vim'
" Plug 'whatyouhide/vim-gotham'
Plug 'kamykn/spelunker.vim'
Plug 'kamykn/popup-menu.nvim'
Plug 'alvan/vim-closetag'
call plug#end()
"}}}
"MAPPINGS -----------------------------------------{{{
" mappings go in here.
" remap the escape key for insert mode
:inoremap jk <Esc>
:vnoremap jk <Esc>
" Pressing the letter o will open a new line below the current one.
" Exit insert mode after creating a new line above or below the current line.
:nnoremap o o<esc>
:nnoremap O O<esc>
" Yank from cursor to the end of line.
nnoremap Y $
" select a word with space bar
:noremap <space> viw
" put a word in all caps
:inoremap <c-u>viwUi
" navigation mappings
:nnoremap L <End>
:nnoremap H <Home>
:vnoremap L <End>
:vnoremap H <Home>
" wrap a word in quotes
:nnoremap <leader>" viw<esc>a"<esc>bi"<esc>lel
:nnoremap <leader>' viw<esc>a'<esc>bi'<esc>lel
:vnoremap <leader>" <esc>`<i"<esc>`>ea"
:vnoremap <leader>' <esc>`<i'<esc>`>ea'
"
" You can split the window in Vim by typing :split or :vsplit.
" Navigate the split view easier by pressing CTRL+j, CTRL+k, CTRL+h, or CTRL+l.
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
" NERDTree specific mappings.
" Map the F3 key to toggle NERDTree open and close.
nnoremap <c-t> :NERDTreeToggle<cr>
" }}}
" VIMSCRIPT ------------------------------------------------------------ {{{
" This enables code volding
" Marker folding method
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" more vimscripts go here
" }}}
"
" SKELETONS
" ---------------------------------------------------------------{{{
autocmd BufNewFile *.jsx 0r ~/.vim/skeletons/react-func-comp.jsx
autocmd BufNewFile *.html 0r ~/.vim/skeletons/html-boilerplate.html
" }}}
" Plugin Settings ---------------------------------------------{{{
" spelunker settings
let g:spelunker_disable_uri_checking = 1
let g:spelunker_disable_email_checking = 1
" closetag
let g:closetag_filenames = '*.html,*.jsx'
"}}}
" abbreviations are auto corrections
:iabbrev waht what
:iabbrev tehn then
:iabbrev adn and
"