diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 509c7d8..dd06019 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -2,18 +2,19 @@ " set t_Co=256 -set mouse=a + +" My custom commands {{{ " Cd to current file's directory command! Header :execute '0r!file-header %' command! Term :execute 'sp | term' command! Cwd :execute 'cd %:p:h' command! Reload :execute "bufdo execute 'checktime . bufnr('%')'" +" }}} -" set timeout timeoutlen=1000 ttimeoutlen=100 - -" My settings { +" My settings {{{ filetype on " required! +set mouse=a set clipboard=unnamedplus set history=1000 " Store a ton of history (default is 20) set spell " Spell checking on @@ -29,6 +30,8 @@ set title set path=., set foldlevel=99 +let g:python_host_prog='/usr/bin/python2.7' +let g:python3_host_prog='/usr/bin/python3.5' let javaScript_fold=0 " JavaScript let perl_fold=1 " Perl @@ -38,16 +41,16 @@ let ruby_fold=1 " Ruby let sh_fold_enabled=1 " sh let vimsyn_folding='af' " Vim script " let xml_syntax_folding=1 " XML - +" set completeopt+=preview set foldmethod=indent autocmd FileType java set foldmethod=indent autocmd FileType html set foldmethod=indent autocmd FileType javascript set foldmethod=indent autocmd FileType xml set foldmethod=indent -" } +" }}} -" for formating { +" for formating {{{ " set nowrap " Wrap long lines set autoindent " Indent at the same level of the previous line set shiftwidth=2 " Use indents of 4 spaces @@ -55,17 +58,17 @@ set expandtab " Tabs are spaces, not tabs set tabstop=2 " An indentation every four columns set softtabstop=2 " Let backspace delete indent -" for java { +" for java {{{ autocmd BufRead *.java set include=^#\s*import autocmd BufRead *.java set includeexpr=substitute(v:fname,'\\.','/','g') autocmd BufRead *.java set suffixesadd=.java,.xml autocmd BufRead *.ect set suffixesadd=.ect ft=html.ect autocmd BufRead *.njk set ft=jinja autocmd BufEnter *.gradle set ft=groovy -" } +" }}} -" for UI { +" for UI {{{ set showmode " Display the current mode if has('statusline') @@ -96,9 +99,9 @@ set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too set scrolljump=1 " Lines to scroll when cursor leaves screen set scrolloff=0 " Minimum lines to keep above and below cursor set list -" } +" }}} -"for Ctrl-P{ +"for Ctrl- {{{ let g:ctrlp_user_command = {} let g:ctrlp_working_path_mode = 0 @@ -109,10 +112,10 @@ let g:ctrlp_custom_ignore = { \ 'file': '\v\.(o|pyc|class)$', \ 'link': '', \ } -"}" +" }}}" -" for JS { +" for JS {{{ let g:html_indent_inctags = "html,body,head,tbody" let g:html_indent_script1 = "inc" let g:html_indent_style1 = "inc" @@ -120,18 +123,18 @@ let g:html_indent_style1 = "inc" let b:javascript_fold = 0 " let g:tern_set_omni_function = 0 -" } +" }}} -" For JSX { +" For JSX {{{ " let g:jsx_ext_required = 0 -"} +" }}} -" AutoCloseTag { +" AutoCloseTag {{{ " Make it so AutoCloseTag works for xml and xhtml files as well au FileType xhtml,xml ru ftplugin/html/autoclosetag.vim -" } +" }}} let NERDTreeShowBookmarks=1 let NERDTreeIgnore=['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr'] @@ -141,43 +144,47 @@ let NERDTreeMouseMode=2 let NERDTreeShowHidden=1 let NERDTreeKeepTreeInNewTab=1 let g:nerdtree_tabs_open_on_gui_startup=0 -" } +" }}} :let g:NERDCustomDelimiters = { -\ 'jinja': { 'left': '{# ', 'right': ' #}', 'leftAlt': '{# ', 'rightAlt': ' #}' } + \ 'jinja': { 'left': '{# ', 'right': ' #}', 'leftAlt': '{# ', 'rightAlt': ' #}' }, + \ 'typescript': { 'left': '//', 'leftAlt': '/**', 'rightAlt': '*/' }, + \ 'javascript': { 'left': '//', 'leftAlt': '/**', 'rightAlt': '*/' }, \ } -" Session List { +" Session List {{{ set sessionoptions=blank,buffers,curdir,tabpages,winsize,resize,winpos " nmap c :JavaCorrect " nmap pt :ProjectsTree -" } +" }}} -" for JavaScript syntax checking { +" for JavaScript syntax checking {{{ " let g:syntastic_javascript_checkers = ['eslint'] let g:syntastic_always_populate_loc_list = 1 +" let g:syntastic_javascript_checkers = ['eslint'] let g:syntastic_javascript_checkers = ['jshint'] -" } +" let g:syntastic_typescript_checkers = ['tsuquyomi'] +" }}} -" gides { +" gides {{{ " let g:indent_guides_start_level = 2 let g:indent_guides_guide_size = 1 let g:indent_guides_enable_on_vim_startup = 1 -" } +" }}} set wrap " dont set cursorline for performance imporoovements set cursorline " Highlight current line set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace -" for Gtags { +" for Gtags {{{ let g:Gtags_Auto_Map = 1 let g:Gtags_VerticalWindow = 1 let g:Gtags_Auto_Update = 1 let g:GtagsCscope_Auto_Load = 1 -" } +" }}} " set lazyredraw @@ -193,7 +200,7 @@ let g:sparkupNextMapping = '' " \} -"for Plug { +"for Plug {{{ set nocompatible " be iMproved " " Use deoplete. @@ -210,7 +217,8 @@ call plug#begin( ) " " original repos on github Plug 'tpope/vim-fugitive' -" Plug 'Lokaltog/vim-easymotion' +Plug 'brooth/far.vim' +Plug 'Lokaltog/vim-easymotion' " Plug 'Lokaltog/vim-distinguished' " Plug 'junegunn/seoul256.vim' " Plug 'whatyouhide/vim-gotham' @@ -227,12 +235,14 @@ Plug 'vim-scripts/DoxygenToolkit.vim' " Plug 'vim-scripts/boxdraw' " Plug 'vim-scripts/Vim-JDE' " Plug 'maksimr/vim-jsbeautify' +Plug 'Shougo/vimproc.vim' +Plug 'Quramy/tsuquyomi' Plug 'scrooloose/syntastic' Plug 'pangloss/vim-javascript' Plug 'mxw/vim-jsx' " Plug 'othree/yajs.vim' " Plug 'harish2704/tern_for_vim' , { 'for': 'javascript' } -Plug 'scrooloose/nerdcommenter' +Plug 'harish2704/nerdcommenter' Plug 'garbas/vim-snipmate' " Plug 'amiorin/vim-project' Plug 'MarcWeber/vim-addon-mw-utils' @@ -249,7 +259,8 @@ Plug 'tpope/vim-surround' function! DoRemote(arg) UpdateRemotePlugins endfunction -Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') } +Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +" Plug 'mhartington/deoplete-typescript' " Plug 'vim-scripts/AutoComplPop' " Plug 'Shougo/neocomplcache' " Plug 'Valloric/YouCompleteMe' @@ -280,19 +291,21 @@ Plug 'harish2704/gtags.vim' " Plug 'vim-scripts/adt.vim' " Plug 'tpope/eclim' Plug 'tomasr/molokai' -Plug 'joonty/vdebug' -Plug 'junegunn/fzf', { 'dir': '/opt/fzf' } +" Plug 'joonty/vdebug' +Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' -Plug 'vim-scripts/SyntaxComplete' +" Plug 'vim-scripts/SyntaxComplete' Plug 'justinj/vim-react-snippets' Plug 'othree/javascript-libraries-syntax.vim' Plug 'Glench/Vim-Jinja2-Syntax' -Plug 'kannokanno/previm' +" Plug 'kannokanno/previm' Plug 'tyru/open-browser.vim' Plug 'harish2704/MatchTag' -Plug 'leafgarland/typescript-vim' -Plug 'zenbro/mirror.vim' -Plug 'kassio/neoterm' +" Plug 'leafgarland/typescript-vim' +Plug 'HerringtonDarkholme/yats.vim' +Plug 'bogado/file-line' +" Plug 'zenbro/mirror.vim' +" Plug 'kassio/neoterm' call plug#end() " Source support_function.vim to support vim-snippets. @@ -300,39 +313,16 @@ if filereadable(expand( g:nvim_conf_root ."bundle/vim-snippets/snippets/support_ source g:nvim_conf_root . 'bundle/vim-snippets/snippets/support_functions.vim' endif -" } +" }}} let $FZF_DEFAULT_COMMAND='ag -g ""' nmap :Files nmap :Buffers " Neovim specific settings syntax on -" if has('neovim') -" let s:python_host_init = 'python -c "import neovim; neovim.start_host()"' -" let &initpython = s:python_host_init -" let &initclipboard = s:python_host_init -" set unnamedclip " Automatically use clipboard as storage for the unnamed register -" endif" - -" colorscheme colorful256 -" colorscheme mrkn256 -" colorscheme desert256 -" colorscheme 256-grayvim -" colorscheme jellybeans -" colorscheme devbox-dark-256 -" colorscheme lodestone -" colorscheme distinguished + colorscheme molokai -" set foldmethod=syntax -" let javascriptfold=1 -" let g:indent_guides_auto_colors = 0 -" hi IndentGuidesEven ctermbg=235 -" hi IndentGuidesOdd ctermbg=240 -" hi StatusLine ctermbg=202 -" hi StatusLineNC ctermbg=246 ctermfg=0 -" autocmd ColorScheme * hi IndentGuidesEven ctermbg=235 | hi IndentGuidesOdd ctermbg=240 set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace -" hi SpellBad ctermbg=9 ctermfg=20 " Switch tabs using Alt-1..9 @@ -372,11 +362,11 @@ nmap lc :lclose " Ctrl-Shift-T -> Open new tab nmap :tabedit -" Ctrl-S to save file { +" Ctrl-S to save file {{{ nmap :w vmap gv imap -" } +" }}} " Alt-q Delete current buffer ( Close file ) nmap :bd @@ -388,21 +378,21 @@ execute( 'nmap es :tabedit '. g:nvim_conf_root .'init.vim ' nmap en :execute 'OpenSnippets' -" for moving tab { -" Ctrl-Shift + Page-Up/Down to rearrange tab { +" for moving tab {{{ +" Ctrl-Shift + Page-Up/Down to rearrange tab {{{ nmap :execute 'tabmove ' . (tabpagenr()-2 ) nmap :execute 'tabmove ' . ( tabpagenr()+1 ) nmap :execute 'tabmove ' . (tabpagenr()-2 ) nmap :execute 'tabmove ' . ( tabpagenr()+1 ) -" } +" }}} -" Ctrl-Shift + j/k to move current window in to another tab{ +" Ctrl-Shift + j/k to move current window in to another ta {{{ nmap :execute 'Mt' . (tabpagenr() -1) nmap :execute 'Mt' . (tabpagenr() +1) nmap :execute 'Mt' . (tabpagenr() -1) nmap :execute 'Mt' . (tabpagenr() +1) -" } +" }}} " \tt Toggle tab and spaces nmap tt :let &expandtab=!&expandtab @@ -410,14 +400,14 @@ nmap tt :let &expandtab=!&expandtab nmap tj :let &shiftwidth=&shiftwidth-2\|let &tabstop=&tabstop-2\|let &softtabstop=&softtabstop-2\|echo 'tabstop=' &tabstop " \tj Decreases two spaces width for tab nmap tk :let &shiftwidth=&shiftwidth+2\|let &tabstop=&tabstop+2\|let &softtabstop=&softtabstop+2\|echo 'tabstop=' &tabstop -" } +" }}} -" Session handling { +" Session handling {{{ " List saved sessions nmap sl :SessionList " Save and close current session nmap sc :SessionClose -" } +" }}} " Ctrl-Enter in insert mode will append ';' to the line and insert a new line imap A; @@ -427,21 +417,39 @@ imap A; " Ctrl-? in normal mode will jump to tag references using cscope " nmap :vert scs f t -" Alt + Arrows to Moving cursor to different windows { +" Alt + Arrows to Moving cursor to different windows {{{ nmap k nmap j nmap l nmap h -" } +" }}} + +" For terminal mod {{{ +tmap +tmap +tmap k +tmap j +tmap l +tmap h +" }}} + +" For Terminal mode Alt + [1-8] to Switch tabs {{{ +tmap 1gt +tmap 2gt +tmap 3gt +tmap 4gt +tmap 5gt +tmap 6gt +tmap 7gt +tmap 8gt +" }}} -" For terminal mode{ -tmap k -tmap j -tmap l -tmap h -" } +" For terminal mod {{{ +tmap +tmap +" }}} -"for easy quote/unquote { +"for easy quote/unquote {{{ " \\ + a[add] / d[delete] + q[single quote] / Q [Double quote] " \\dQ remove double quote nmap dQ ds" @@ -455,14 +463,14 @@ nmap aq ysiw' imap maysiw"`aa " In insert mode, will quote current word with double quotes imap maysiw'`ai -" } +" }}} -" format JSON { +" format JSON {{{ nmap jt :%!python -m json.tool:set filetype=json -" } +" }}} -" Alt + [1-8] to Switch tabs { +" Alt + [1-8] to Switch tabs {{{ map 1gt map 2gt map 3gt @@ -471,28 +479,18 @@ map 5gt map 6gt map 7gt map 8gt -" } +" }}} -" For Terminal mode Alt + [1-8] to Switch tabs { -tmap 1gt -tmap 2gt -tmap 3gt -tmap 4gt -tmap 5gt -tmap 6gt -tmap 7gt -tmap 8gt -" } -" NerdTree { +" NerdTree {{{ nmap ac ToggleAutoCloseMappings map :NERDTreeToggle:NERDTreeMirror map e :NERDTreeFind nmap nt :NERDTreeFind -" } +" }}} -" Tabularize { +" Tabularize {{{ " nmap a& :Tabularize /& " vmap a& :Tabularize /& " nmap a= :Tabularize /= @@ -506,20 +504,17 @@ nmap nt :NERDTreeFind " vmap a// :Tabularize /\/\/ " nmap a :Tabularize / " vmap a :Tabularize / -" } +" }}} -" For terminal mode{ -tmap -" } -" For NeoTerm plugin{ +" For NeoTerm plugi {{{ nmap o :Topen nmap c :Tclose -" } -" For Open a terminal in current directory{ +" }}} +" For Open a terminal in current director {{{ nmap t :!gnome-terminal nmap g :!git gui & -" } +" }}} " -> Reload current file nmap :e!