-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.vim
201 lines (155 loc) · 5.32 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
" The following lines open NERDTree
" https://stackoverflow.com/questions/1979520/auto-open-nerdtree-in-every-tab/7640505#answer-7640505
autocmd VimEnter * NERDTree
autocmd BufEnter * NERDTreeMirror
autocmd VimEnter * wincmd w
" end NERDTree stuff
noremap ; l
noremap l k
noremap k j
noremap j h
" custom leader
let mapleader = ","
call plug#begin('~/.config/nvim/data')
Plug 'preservim/nerdtree'
Plug 'joshdick/onedark.vim'
Plug 'wakatime/vim-wakatime'
Plug 'tpope/vim-fugitive'
"Plug 'Yggdroot/indentLine'
Plug 'vim-airline/vim-airline'
" Plug 'autozimu/LanguageClient-neovim', {
" \ 'branch': 'next',
" \ 'do': 'bash install.sh'
" \ }
" Plug 'puremourning/vimspector'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'neoclide/coc-snippets'
"Plug 'scalameta/coc-metals', {'do': 'yarn install --frozen-lockfile'}
Plug 'ryanoasis/vim-devicons'
" Plug 'rust-lang/rust.vim'
" Installed these two for https://github.com/ggandor/leap.nvim
Plug 'tpope/vim-repeat'
Plug 'ggandor/leap.nvim'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
" https://github.com/dpayne/CodeGPT.nvim
Plug 'nvim-lua/plenary.nvim'
Plug 'MunifTanjim/nui.nvim'
Plug 'dpayne/CodeGPT.nvim'
call plug#end()
lua require('leap').set_default_keymaps()
au BufRead,BufNewFile *.sbt set filetype=scala
" added for markdown preview
if filereadable(expand("~/.config/nvim/markdown-preview-mappings.vim"))
source ~/.config/nvim/markdown-preview-mappings.vim
endif
if filereadable(expand("~/.config/nvim/coc-mappings.vim"))
source ~/.config/nvim/coc-mappings.vim
endif
if filereadable(expand("~/.config/nvim/functions.vim"))
source ~/.config/nvim/functions.vim
endif
if filereadable(expand("~/.config/nvim/LanguageClient-neovim-mappings.vim"))
source ~/.config/nvim/LanguageClient-neovim-mappings.vim
endif
" NERDTree mappings
nnoremap <leader>m :NERDTree<CR>
let g:UltiSnipsSnippetsDir = "~/.config/nvim/ultisnips"
" vimspector
" let g:vimspector_enable_mappings = 'HUMAN'
" Theme
set termguicolors
" set background=dark
" onedark.vim override: Don't set a background color when running in a terminal;
" just use the terminal's background color
"if (has("autocmd") && !has("gui_running"))
" augroup colors
" autocmd!
" let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16": "7"}
" autocmd ColorScheme * call onedark#set_highlight("Normal", { "fg": s:white }) "No `bg` setting
" augroup END
"endif
colorscheme onedark
" Because no one likes to be blinded by awful colors
highlight CocErrorSign guifg=#E06C75
highlight CocWarningSign guifg=#E5C07B
highlight StatusLineStatus guifg=#4B5263 guibg=#2C323C
highlight StatusLineError guifg=#E06C75 guibg=#2C323C
highlight StatusLineWarning guifg=#E5C07B guibg=#2C323C
set statusline=%n\ " buffer number
set statusline+=%{FugitiveStatusline()}
" set statusline+=%t\ %M%r%h%w\ " file modified, readonly, help, preview
" set statusline+=%#StatusLineError#%{CocMinimalErrors()}\ " coc-errors
" set statusline+=%#StatusLineWarning#%{CocMinimalWarnings()}\ " coc-warnings
" set statusline+=%#StatusLineStatus#%{CocMinimalStatus()}%#StatusLine#\ " coc status
" set statusline+=%=%Y\ " filetype
" set statusline+=%{&ff}\ " right align line endings
" set statusline+=%l,%v\ " curser position
" set statusline+=%p%%\ " percentage on page
" turn on syntax highlighting.
if !exists("g:syntax_on")
syntax enable
endif
" allow for urls with query strings to be opened with the query string
let g:netrw_gx="<cWORD>"
" don't wrap at screen end
set nowrap
" tabs vs spaces!
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
" make sure line endings are always unix
set ff=unix
" allow for more than one unsaved buffer
set hidden
" show if at least 2 tab pages
set showtabline=1
" display options
set cursorline
set number
set nu
set conceallevel=0
" allows your update time to be a bit faster
set updatetime=300
set showmatch
" always show signcolumns
set signcolumn=yes
" disables the automatic comment lines after another comment line
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" automatically wrap in markdown
autocmd FileType markdown setlocal textwidth=80
" enforce characters to be 80 or less in js
highlight ColorColumn ctermbg=red
autocmd BufEnter *.js call matchadd('ColorColumn', '\%81v', 100)
" always show statusline
set laststatus=2
" search down into subfolders
" provides tab completion for file related tasks
set path+=**
filetype plugin on
" don't search git, node_modules, or targert with wildmenu
set wildignore=.git,*/node_modules/*,*/target/*
"search settings
set incsearch
" include matching uppercase words with lowercase search term
set ignorecase
" include only uppercase words with uppercase search term
set smartcase
set backspace=indent,eol,start
" yank to clipboard
set clipboard=unnamed
" escape
inoremap jj <ESC>
" toggle highlight search off
nnoremap<leader>hs :nohlsearch<cr>
" format json
nnoremap<leader>js :%!jq '.'<cr>
" format xml
nnoremap<leader>xml :%!xmllint --format -<cr>
" Mappings to deal with the quickfix window
nnoremap<leader>fo :copen<cr>
nnoremap<leader>fc :cclose<cr>
nnoremap<leader>fn :cnext<cr>
nnoremap<leader>fp :cprevious<cr>
au BufReadPost,BufNewFile *.md,*.txt,COMMIT_EDITMSG set wrap linebreak nolist spell spelllang=en_us complete+=kspell
au BufReadPost,BufNewFile .html,*.txt,*.md,*.adoc set spell spelllang=en_us