Initial
This commit is contained in:
parent
0e248d1e44
commit
e0cd297485
2 changed files with 138 additions and 64 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
nvim/plugged/
|
||||
|
200
nvim/init.vim
200
nvim/init.vim
|
@ -1,39 +1,87 @@
|
|||
call plug#begin('~/.vim/plugged')
|
||||
syntax on
|
||||
set ruler " Show the line and column numbers of the cursor.
|
||||
set formatoptions+=o " Continue comment marker in new lines.
|
||||
set textwidth=0 " Hard-wrap long lines as you type them.
|
||||
set modeline " Enable modeline.
|
||||
"set esckeys " Cursor keys in insert mode.
|
||||
set linespace=0 " Set line-spacing to minimum.
|
||||
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
|
||||
" More natural splits
|
||||
set splitbelow " Horizontal split below current.
|
||||
set splitright " Vertical split to right of current.
|
||||
if !&scrolloff
|
||||
set scrolloff=3 " Show next 3 lines while scrolling.
|
||||
endif
|
||||
if !&sidescrolloff
|
||||
set sidescrolloff=5 " Show next 5 columns while side-scrolling.
|
||||
endif
|
||||
set display+=lastline
|
||||
set nostartofline " Do not jump to first character with page commands.
|
||||
set noerrorbells " No beeps
|
||||
set backspace=indent,eol,start " Makes backspace key more powerful.
|
||||
set showcmd " Show me what I'm typing
|
||||
set showmode " Show current mode.
|
||||
set noswapfile " Don't use swapfile
|
||||
set nobackup " Don't create annoying backup files
|
||||
set encoding=utf-8 " Set default encoding to UTF-8
|
||||
set autowrite " Automatically save before :next, :make etc.
|
||||
set autoread " Automatically reread changed files without asking me anything
|
||||
set laststatus=2
|
||||
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats
|
||||
set showmatch " Do not show matching brackets by flickering
|
||||
set incsearch " Shows the match while typing
|
||||
set hlsearch " Highlight found searches
|
||||
set ignorecase " Search case insensitive...
|
||||
set smartcase " ... but not when search pattern contains upper case characters
|
||||
set gdefault " Use 'g' flag by default with :s/foo/bar/.
|
||||
set magic " Use 'magic' patterns (extended regular expressions).
|
||||
|
||||
" Use <C-L> to clear the highlighting of :set hlsearch.
|
||||
if maparg('<C-L>', 'n') ==# ''
|
||||
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
|
||||
endif
|
||||
|
||||
" Search and Replace
|
||||
nmap <Leader>s :%s//g<Left><Left>
|
||||
|
||||
" Leader key is like a command prefix.
|
||||
"let mapleader='z'
|
||||
"let maplocalleader='\'
|
||||
|
||||
let g:python_host_prog="/usr/local/bin/python2.7"
|
||||
|
||||
let g:session_autosave = 'yes'
|
||||
let g:session_autoload = 'yes'
|
||||
let g:session_default_to_last = 1
|
||||
|
||||
" set cursorcolumn
|
||||
nmap <Space> <PageDown>
|
||||
vmap <BS> x
|
||||
|
||||
" Plugins here
|
||||
call plug#begin('~/.config/nvim/plugged')
|
||||
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
|
||||
" Plug 'Shougo/deoplete.nvim'
|
||||
Plug 'Valloric/YouCompleteMe'
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'Chiel92/vim-autoformat'
|
||||
Plug 'scrooloose/nerdtree'
|
||||
Plug 'terryma/vim-multiple-cursors'
|
||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'scrooloose/nerdtree'
|
||||
Plug 'fatih/vim-go'
|
||||
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
|
||||
|
||||
Plug 'crusoexia/vim-monokai'
|
||||
Plug 'projekt0n/github-nvim-theme'
|
||||
call plug#end()
|
||||
|
||||
set noeb vb t_vb=
|
||||
let mapleader = ','
|
||||
let g:go_def_mode='gopls'
|
||||
let g:go_info_mode='gopls'
|
||||
set colorcolumn=160
|
||||
|
||||
|
||||
|
||||
set number relativenumber
|
||||
set nu rnu
|
||||
set tabstop=4
|
||||
set shiftwidth=0
|
||||
set softtabstop=-1
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=0
|
||||
set softtabstop=-1
|
||||
set expandtab
|
||||
set autoindent
|
||||
set cursorline
|
||||
syntax enable
|
||||
nnoremap <silent> <cr> :noh<CR><CR>
|
||||
|
||||
" autocmd vimenter * NERDTree
|
||||
|
||||
" -------------------------------------------------------------------------------------------------
|
||||
" coc.nvim default settings
|
||||
" -------------------------------------------------------------------------------------------------
|
||||
|
||||
" if hidden is not set, TextEdit might fail.
|
||||
set cursorline
|
||||
set hidden
|
||||
" Better display for messages
|
||||
set cmdheight=2
|
||||
|
@ -57,49 +105,73 @@ function! s:check_back_space() abort
|
|||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
" deoplete config
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
let g:deoplete#disable_auto_complete = 1
|
||||
if has("gui_running")
|
||||
inoremap <silent><expr><C-Space> deoplete#mappings#manual_complete()
|
||||
else
|
||||
inoremap <silent><expr><C-@> deoplete#mappings#manual_complete()
|
||||
endif
|
||||
|
||||
" Use `[c` and `]c` to navigate diagnostics
|
||||
nmap <silent> [c <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]c <Plug>(coc-diagnostic-next)
|
||||
" UltiSnips config
|
||||
inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||
let g:UltiSnipsExpandTrigger="<tab>"
|
||||
let g:UltiSnipsJumpForwardTrigger="<tab>"
|
||||
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
||||
|
||||
" Remap keys for gotos
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
" Tell Vim which characters to show for expanded TABs,
|
||||
" trailing whitespace, and end-of-lines. VERY useful!
|
||||
if &listchars ==# 'eol:$'
|
||||
" set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
|
||||
set listchars=tab:>\ ,extends:>,precedes:<,nbsp:+
|
||||
endif
|
||||
|
||||
" Use U to show documentation in preview window
|
||||
nnoremap <silent> U :call <SID>show_documentation()<CR>
|
||||
" nerdtree config
|
||||
map <c-n> :NERDTreeToggle<CR>
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
" airline settings
|
||||
let g:airline#extensions#tabline#enabled = 2
|
||||
let g:airline#extensions#tabline#fnamemod = ':t'
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||
let g:airline#extensions#tabline#right_sep = ' '
|
||||
let g:airline#extensions#tabline#right_alt_sep = '|'
|
||||
let g:airline_powerline_fonts=1
|
||||
let g:airline_left_sep = ' '
|
||||
let g:airline_left_alt_sep = '|'
|
||||
let g:airline_right_sep = ' '
|
||||
let g:airline_right_alt_sep = '|'
|
||||
let g:airline_powerline_fonts=0
|
||||
let g:airline_theme='base16_default_dark'
|
||||
|
||||
" Remap for format selected region
|
||||
vmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
" Show all diagnostics
|
||||
nnoremap <silent> <space>u :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
" Multicursor
|
||||
let g:multi_cursor_use_default_mapping=0
|
||||
let g:multi_cursor_next_key='<C-e>'
|
||||
let g:multi_cursor_quit_key='<Esc>'
|
||||
let g:multi_cursor_quit_key='<Esc>'
|
||||
|
||||
" disable vim-go :GoDef short cut (gd)
|
||||
" this is handled by LanguageClient [LC]
|
||||
let g:go_def_mapping_enabled = 0
|
||||
" YouCompleteMe
|
||||
let g:ycm_autoclose_preview_window_after_completion = 1
|
||||
let g:ycm_min_num_of_chars_for_completion = 1
|
||||
|
||||
" Other
|
||||
set mouse=
|
||||
set list
|
||||
lua require('github-theme').setup()
|
||||
"darcula fix to hide the indents:
|
||||
set nolist
|
||||
|
||||
let NERDTreeIgnore = ['_site']
|
||||
|
||||
" Buffer handling
|
||||
nmap L :let &number=1-&number<CR>
|
||||
nmap <leader>] :bnext<CR>
|
||||
nmap <leader>[ :bprevious<CR>
|
||||
nmap <leader>bq :bp <BAR> bd #<CR>
|
||||
nmap <leader>bl :ls<CR>
|
||||
nmap <leader>0 :set invnumber<CR>
|
||||
" map :q to byffer delete
|
||||
" http://stackoverflow.com/questions/7513380/vim-change-x-function-to-delete-buffer-instead-of-save-quit
|
||||
cnoreabbrev <expr> x getcmdtype() == ":" && getcmdline() == 'x' ? 'bd' : 'x'
|
||||
|
||||
|
|
Loading…
Reference in a new issue