make changes for better local changes and modularize nvim configs
This commit is contained in:
@@ -1,129 +1,9 @@
|
||||
set nocompatible
|
||||
|
||||
" Automatically install vim plug
|
||||
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
|
||||
if empty(glob(data_dir . '/autoload/plug.vim'))
|
||||
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||
endif
|
||||
source $HOME/.config/nvim/templates/general.vim
|
||||
|
||||
call plug#begin()
|
||||
" Color Schemes
|
||||
Plug 'rafi/awesome-vim-colorschemes'
|
||||
Plug 'mhartington/oceanic-next'
|
||||
Plug 'morhetz/gruvbox'
|
||||
Plug 'joshdick/onedark.vim'
|
||||
|
||||
Plug 'vim-test/vim-test'
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'sheerun/vim-polyglot'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'mhinz/vim-signify'
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'skywind3000/asyncrun.vim'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
" LSP Resources
|
||||
Plug 'peitalin/vim-jsx-typescript'
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
call plug#end()
|
||||
|
||||
map <C-p> :Files<CR>
|
||||
|
||||
let g:cpp_class_scope_highlight = 1
|
||||
let g:cpp_member_variable_highlight = 1
|
||||
let g:cpp_class_decl_highlight = 1
|
||||
let g:cpp_posix_standard = 1
|
||||
let g:cpp_experimental_template_highlight = 1
|
||||
|
||||
let g:asyncrun_open = 8
|
||||
let g:asyncrun_status = ''
|
||||
|
||||
command! -bang -nargs=* -complete=file Make AsyncRun -program=make @ <args>
|
||||
|
||||
let g:python3_host_prog = '~/.miniconda3/bin/python3'
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#buffer_nr_show = 1
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline_theme='tomorrow'
|
||||
let g:airline_solarized_bg='dark'
|
||||
let g:airline#extensions#hunks#enabled=1
|
||||
let g:airline#extensions#branch#enabled=1
|
||||
let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
|
||||
|
||||
" Set leader to comma
|
||||
let mapleader=","
|
||||
" Quick edit init.vim
|
||||
nnoremap <Leader>v :n $MYVIMRC<cr>
|
||||
|
||||
" For vim-test: these Ctrl mappings work well when Caps Lock is mapped to Ctrl
|
||||
nmap <silent> t<C-n> :TestNearest<CR>
|
||||
nmap <silent> t<C-f> :TestFile<CR>
|
||||
nmap <silent> t<C-s> :TestSuite<CR>
|
||||
nmap <silent> t<C-l> :TestLast<CR>
|
||||
nmap <silent> t<C-g> :TestVisit<CR>
|
||||
let test#strategy = "asyncrun"
|
||||
|
||||
" Reloads vimrc after saving but keep cursor position
|
||||
if !exists('*ReloadVimrc')
|
||||
fun! ReloadVimrc()
|
||||
let save_cursor = getcurpos()
|
||||
source $MYVIMRC
|
||||
call setpos('.', save_cursor)
|
||||
endfun
|
||||
endif
|
||||
autocmd! BufWritePost $MYVIMRC call ReloadVimrc()
|
||||
|
||||
command! -nargs=0 Prettier :CocCommand prettier.formatFile
|
||||
|
||||
" Or if you have Neovim >= 0.1.5
|
||||
if (has("termguicolors"))
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
" Theme
|
||||
syntax enable
|
||||
set background=dark
|
||||
"colorscheme OceanicNext
|
||||
"colorscheme onedark
|
||||
colorscheme gruvbox
|
||||
|
||||
" TextEdit might fail if hidden is not set.
|
||||
set hidden
|
||||
set number
|
||||
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set expandtab
|
||||
set smarttab
|
||||
|
||||
" Some servers have issues with backup files, see #649.
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Give more space for displaying messages.
|
||||
set cmdheight=2
|
||||
|
||||
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
" delays and poor user experience.
|
||||
set updatetime=300
|
||||
|
||||
" Don't pass messages to |ins-completion-menu|.
|
||||
set shortmess+=c
|
||||
|
||||
" Always show the signcolumn, otherwise it would shift the text each time
|
||||
" diagnostics appear/become resolved.
|
||||
if has("patch-8.1.1564")
|
||||
" Recently vim can merge signcolumn and number column into one
|
||||
set signcolumn=number
|
||||
else
|
||||
set signcolumn=yes
|
||||
endif
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
" other plugin before putting this into your config.
|
||||
@@ -267,5 +147,12 @@ nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
nmap <space>e :CocCommand explorer<CR>
|
||||
|
||||
" Set termdebug
|
||||
let g:termdebug_wide=1
|
||||
" Local config
|
||||
if filereadable($HOME . "/.vimrc.local")
|
||||
source ~/.vimrc.local
|
||||
endif
|
||||
|
||||
" Specific Local config
|
||||
if filereadable($HOME . "/.config/nvim/coc_init.vim.local")
|
||||
source ~/.config/nvim/coc_init.vim.local
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user