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/
|
||||||
|
|
190
nvim/init.vim
190
nvim/init.vim
|
@ -1,21 +1,79 @@
|
||||||
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', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
Plug 'scrooloose/nerdtree'
|
Plug 'crusoexia/vim-monokai'
|
||||||
Plug 'fatih/vim-go'
|
Plug 'projekt0n/github-nvim-theme'
|
||||||
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
|
|
||||||
|
|
||||||
call plug#end()
|
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 number relativenumber
|
||||||
set nu rnu
|
set nu rnu
|
||||||
set tabstop=4
|
set tabstop=4
|
||||||
|
@ -24,16 +82,6 @@ set softtabstop=-1
|
||||||
set expandtab
|
set expandtab
|
||||||
set autoindent
|
set autoindent
|
||||||
set cursorline
|
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 hidden
|
set hidden
|
||||||
" Better display for messages
|
" Better display for messages
|
||||||
set cmdheight=2
|
set cmdheight=2
|
||||||
|
@ -57,49 +105,73 @@ function! s:check_back_space() abort
|
||||||
return !col || getline('.')[col - 1] =~# '\s'
|
return !col || getline('.')[col - 1] =~# '\s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Use <c-space> to trigger completion.
|
" deoplete config
|
||||||
inoremap <silent><expr> <c-space> coc#refresh()
|
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
|
" UltiSnips config
|
||||||
nmap <silent> [c <Plug>(coc-diagnostic-prev)
|
inoremap <silent><expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||||
nmap <silent> ]c <Plug>(coc-diagnostic-next)
|
let g:UltiSnipsExpandTrigger="<tab>"
|
||||||
|
let g:UltiSnipsJumpForwardTrigger="<tab>"
|
||||||
|
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
||||||
|
|
||||||
" Remap keys for gotos
|
" Tell Vim which characters to show for expanded TABs,
|
||||||
nmap <silent> gd <Plug>(coc-definition)
|
" trailing whitespace, and end-of-lines. VERY useful!
|
||||||
nmap <silent> gy <Plug>(coc-type-definition)
|
if &listchars ==# 'eol:$'
|
||||||
nmap <silent> gi <Plug>(coc-implementation)
|
" set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
|
||||||
nmap <silent> gr <Plug>(coc-references)
|
set listchars=tab:>\ ,extends:>,precedes:<,nbsp:+
|
||||||
|
endif
|
||||||
|
|
||||||
" Use U to show documentation in preview window
|
" nerdtree config
|
||||||
nnoremap <silent> U :call <SID>show_documentation()<CR>
|
map <c-n> :NERDTreeToggle<CR>
|
||||||
|
|
||||||
" Remap for rename current word
|
" airline settings
|
||||||
nmap <leader>rn <Plug>(coc-rename)
|
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
|
" Multicursor
|
||||||
vmap <leader>f <Plug>(coc-format-selected)
|
let g:multi_cursor_use_default_mapping=0
|
||||||
nmap <leader>f <Plug>(coc-format-selected)
|
let g:multi_cursor_next_key='<C-e>'
|
||||||
" Show all diagnostics
|
let g:multi_cursor_quit_key='<Esc>'
|
||||||
nnoremap <silent> <space>u :<C-u>CocList diagnostics<cr>
|
let g:multi_cursor_quit_key='<Esc>'
|
||||||
" 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>
|
|
||||||
|
|
||||||
" disable vim-go :GoDef short cut (gd)
|
" YouCompleteMe
|
||||||
" this is handled by LanguageClient [LC]
|
let g:ycm_autoclose_preview_window_after_completion = 1
|
||||||
let g:go_def_mapping_enabled = 0
|
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