Skip to content

Commit

Permalink
Update vim configuration to add support for golang
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitesh Paul committed Jun 11, 2019
1 parent df1bab4 commit 1403ab6
Showing 1 changed file with 87 additions and 30 deletions.
117 changes: 87 additions & 30 deletions nvim/init.vim
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
" File : init.vim
" Author : Hitesh Paul <[email protected]>
" Date : 28.05.2019
" Last Modified Date: 28.05.2019
" Last Modified By : Hitesh Paul <[email protected]>
set nocompatible

call plug#begin('~/.local/share/nvim/plugged')
Expand All @@ -6,7 +11,7 @@ call plug#begin('~/.local/share/nvim/plugged')
""Plug 'arcticicestudio/nord-vim', { 'branch': 'develop' }
Plug 'dracula/vim', { 'as': 'dracula' }
""Plug 'chriskempson/base16-vim'
Plug 'mike-hearn/base16-vim-lightline'
" Plug 'mike-hearn/base16-vim-lightline'
Plug 'ryanoasis/vim-devicons'
Plug 'itchyny/lightline.vim'
Plug 'taohexxx/lightline-buffer'
Expand All @@ -20,31 +25,39 @@ Plug 'mhinz/vim-startify'
Plug 'junegunn/fzf.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'jsfaint/gen_tags.vim'
Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh \| UpdateRemotePlugins' }
" Plug 'Shougo/vimproc.vim', {'do' : 'make'}
" Plug 'idanarye/vim-vebugger', { 'branch': 'develop' }

Plug 'neomake/neomake'
" Plug 'tpope/vim-dispatch'
" Plug 'w0rp/ale'
Plug 'sbdchd/neoformat'
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-github'
Plug 'ncm2/ncm2-ultisnips'
Plug 'ncm2/ncm2-racer', { 'for': 'rust' }
" Plug 'ncm2/ncm2-tern', {'do': 'npm install', 'for': 'javascript' }
Plug 'ncm2/ncm2-tern', {'do': 'npm install'}
Plug 'ncm2/ncm2-jedi', {'for': 'python' }
Plug 'ncm2/ncm2-pyclang', {'for': ['c', 'cpp']}
Plug 'ncm2/ncm2-go'
Plug 'fatih/vim-go'
Plug 'sebdah/vim-delve'

Plug 'chemzqm/vim-jsx-improve'
" Plug 'mattn/emmet-vim'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'

Plug 'tpope/vim-fugitive'

Plug 'bfredl/nvim-ipy', {'for': 'python'}
Plug 'rust-lang/rust.vim'
Plug 'lervag/vimtex'

" Plug 'autozimu/LanguageClient-neovim', {
" \ 'branch': 'next',
" \ 'do': 'bash install.sh',
" \ }
Plug 'alpertuna/vim-header'
Plug 'junegunn/goyo.vim'
Plug 'pgdouyon/vim-evanesco'
Plug 'justinmk/vim-dirvish'
Plug 'justinmk/vim-sneak'
Expand All @@ -60,7 +73,7 @@ call plug#end()

set rnu
set showtabline=2
set clipboard+=unnamedplus
" set clipboard+=unnamed
" set cursorline
set splitbelow
set shortmess+=c
Expand All @@ -79,19 +92,30 @@ set grepprg=rg\ --vimgrep
set grepformat^=%f:%l:%c:%m
set completeopt=noinsert,menuone,noselect
set formatexpr=LanguageClient#textDocument_rangeFormatting_sync()
set tabstop=4
set expandtab
" set tabstop=4
" set expandtab
" set softtabstop=4
set shiftwidth=4
" set shiftwidth=4
" colorscheme base16-eighties
let g:nord_italic = 1
let g:nord_underline = 1
let g:nord_italic_comments = 1
let g:nord_comment_brightness = 16
let g:nord_cursor_line_number_background = 1
" let g:nord_italic = 1
" let g:nord_underline = 1
" let g:nord_italic_comments = 1
" let g:nord_comment_brightness = 16
" let g:nord_cursor_line_number_background = 1
colorscheme dracula

let mapleader=" "
" " Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" " Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>p "+p
vnoremap <leader>P "+P
let g:python_host_prog = '/usr/bin/python2'
let g:python3_host_prog = '/usr/bin/python3'

Expand Down Expand Up @@ -133,7 +157,10 @@ nmap <Leader>l :BLines<CR>
nmap <Leader>L :Lines<CR>
nmap <Leader>g :Rg<cr>
" nmap <Leader>p :call LanguageClient#textDocument_

" augroup mail_trailing_whitespace " {
" autocmd!
" autocmd FileType mail setlocal formatoptions+=w
" augroup END " }
inoremap <c-c> <ESC>
" inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
inoremap <expr> <CR> (pumvisible() ? ncm2_ultisnips#expand_or("<CR>", 'n') : "\<CR>")
Expand All @@ -146,14 +173,15 @@ inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
" nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
let g:AutoPairsFlyMode = 1
" let g:AutoPairsFlyMode = 1
let g:AutoPairsShortcutBackInsert = '<M-b>'
" Press enter key to trigger snippet expansion
" The parameters are the same as `:help feedkeys()`
" inoremap <silent> <expr> <C-k> ncm2_ultisnips#expand_or("/<CR>", 'n')
command! -nargs=* Term 10split | terminal <args>
command! -nargs=* Vterm vsplit | terminal <args>
autocmd CompleteDone * silent! pclose!
autocmd FileType javascript set tabstop=2|set shiftwidth=2|set expandtab softtabstop=2

" let g:LanguageClient_serverCommands = {
" \ 'rust': ['~/.local/share/cargo/bin/rustup', 'run', 'stable', 'rls'],
Expand Down Expand Up @@ -187,9 +215,9 @@ let g:fzf_colors =
let g:fzf_layout = { 'window': '10split enew' }
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --max-filesize=2M --maxdepth=40 --threads 4 '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ 'rg --column --line-number --no-heading --color=always --max-filesize=2M --maxdepth=40 --threads 4 --smart-case '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'up:60%')
\ : fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}, 'right:50%:hidden', '?'),
\ <bang>0)
let $FZF_DEFAULT_COMMAND = 'rg --files --no-messages --glob "!.git" --maxdepth=40'
let g:fzf_tags_command = 'ctags -x -R --exclude="target/*" --exclude="*.json"'
Expand All @@ -205,12 +233,12 @@ let g:lightline = {
\ 'statusline': 1,
\ 'tabline': 1
\ },
\ 'colorscheme': 'Dracula',
\ 'colorscheme': 'dracula',
\ }

let g:lightline.active = {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'relativepath', 'modified'] ],
\ [ 'gitbranch', 'readonly', 'relativepath', 'modified'] ],
\ 'right': [ [ 'neomake' ],
\ [ 'lineinfo' ],
\ [ 'percent' ],
Expand Down Expand Up @@ -244,6 +272,7 @@ let g:lightline.component_function = {
\ 'bufferinfo': 'lightline#buffer#bufferinfo',
\ 'filetype': 'MyFiletype',
\ 'fileformat': 'MyFileformat',
\ 'gitbranch': 'fugitive#head'
\ }
let g:lightline.component = {
\ 'separator': '',
Expand Down Expand Up @@ -302,9 +331,6 @@ map T <Plug>Sneak_T

autocmd FileType rust let g:rust_fold=1
autocmd FileType javascript set tabstop=4
autocmd FileType javascript set softtabstop=4
autocmd FileType javascript set shiftwidth=4
set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50
\,a:blinkwait700-blinkoff1000-blinkon1000-Cursor/lCursor
\,sm:block-blinkwait175-blinkoff150-blinkon175
Expand All @@ -316,10 +342,10 @@ let g:tmuxline_powerline_separators = 0

" Vim indentline/
let g:indentLine_enabled = 1
let g:indentLine_fileType = ['c', 'cpp', 'rust', 'python']
let g:indentLine_fileType = ['c', 'cpp', 'rust', 'python', 'javascript']
" let g:indentLine_setColors = 0
" let g:indentLine_concealcursor = 'c'
let g:indentLine_leadingSpaceChar = '·'
let g:indentLine_leadingSpaceChar = ' '
let g:indentLine_leadingSpaceEnabled = 1
let g:indentLine_char = ''
" let g:indentLine_bgcolor_term = 234
Expand All @@ -339,6 +365,8 @@ let g:pandoc#filetypes#handled = ["pandoc", "markdown"]
au FileType vimwiki set syntax=pandoc
au FileType vimwiki set filetype=pandoc
let g:vimwiki_list = [{'path': '~/Dropbox/wiki/', 'index': 'main', 'ext': '.md', 'syntax': 'markdown'}]
nmap <Leader>wq <Plug>VimwikiVSplitLink
nmap <Leader>we <Plug>VimwikiSplitLink
"Vimtex
let g:vimtex_compiler_engine = 'lualatex'
Expand All @@ -361,11 +389,40 @@ let g:vimtex_compiler_latexmk_engines = {
let g:vimtex_mappings_enabled = 0

"VIm Startify
let g:startify_bookmarks = [ {'c': '~/Dropbox/wiki/main.md'}]
let g:startify_bookmarks = [ {'c': '~/.config/nvim/init.vim'}, {'m': '~/Dropbox/wiki/main.md'}]
let g:startify_lists = [
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]

"Vim Header
let g:header_field_author = 'Hitesh Paul'
let g:header_field_author_email = '[email protected]'
let g:header_auto_add_header = 0
let g:header_field_timestamp_format = '%d.%m.%Y'

"Vim C/C++
let g:ncm2_pyclang#library_path = '/usr/lib'


"Nvimipy
let g:nvim_ipy_perform_mappings = 0
autocmd filetype python map <silent> <Leader>kr <Plug>(IPy-RunCell)
autocmd filetype python map <silent> <Leader>kc <Plug>(IPy-Run)
autocmd filetype python map <silent> <Leader>kq <Plug>(IPy-Terminate)
autocmd filetype python map <silent> <Leader>kg <Plug>(IPy-Interrupt)

"Neoformat
" augroup fmt
" autocmd!
" au BufWritePre * try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | endtry
" " autocmd BufWritePre * undojoin | Neoformat
" augroup END


" Vebugger
" let g:vebugger_leader='<Leader>d'

0 comments on commit 1403ab6

Please sign in to comment.