" --- https://github.com/junegunn/vim-plug ------------------------------ " Minimalist plugin manager. Update with --> :PlugInstall " call plug#begin('~/.local/share/nvim/plugged') Plug 'flazz/vim-colorschemes' " molokai, PaperColor, etc Plug 'scrooloose/nerdcommenter' " toggle comments and so on Plug 'vim-airline/vim-airline' " nice status bar Plug 'vimlab/split-term.vim' " better split neovim terminal Plug 'mhinz/vim-sayonara' " smart buffer quitting Plug 'majutsushi/tagbar' " show file tags (require ctags) Plug 'kien/ctrlp.vim' " fuzzy finder (files, buffer, tags) Plug 'jiangmiao/auto-pairs' " Insert quotes/brackets in pairs Plug 'tpope/vim-obsession' " create/restore vim sessions Plug 'scrooloose/nerdtree' " tree explorer "Plug 'Shougo/deoplete.nvim' "Plug 'davidhalter/jedi' "Plug 'zchee/deoplete-jedi' " Plug 'davidhalter/jedi-vim' Plug 'roxma/nvim-completion-manager' " async, dynamic, completion call plug#end() " ----------------------------------------------------------------------- colorscheme molokai behave mswin set clipboard=unnamed "set clipboard=unnamedplus " set colorcolumn=80 set nowrap set showcmd " Show (partial) command in status line. set showmatch " Show matching brackets. set showmode " Show current mode. set ruler " Show the line and column numbers of the cursor. set number " Show the line numbers on the left side. set formatoptions+=o " Continue comment marker in new lines. set textwidth=0 " Hard-wrap long lines as you type them. set expandtab " Insert spaces when TAB is pressed. set tabstop=4 " Render TABs using this many spaces. set shiftwidth=4 " Indentation amount for < and > commands. set noerrorbells " No beeps. 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) set ignorecase " ignore case on vim command/completion set infercase " smart case insensitivity " 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 nostartofline " Do not jump to first character with page commands. " with infinite undo and a bit of saving addiction, those aren't needed set nobackup set noswapfile set undofile "turn on the feature set undodir=$HOME/.config/nvim/undo set undolevels=1000 " How many undos set undoreload=10000 " number of lines to save for undo " ============================================================================ " FILE ESPECIFICS " use hard tab only on Makefiles (to avoid missing separator error) autocmd Filetype make setlocal noexpandtab shiftwidth=4 softtabstop=0 autocmd Filetype yaml setlocal tabstop=4 softtabstop=4 shiftwidth=4 autocmd BufNewFile,BufReadPost *.ino,*.pde set filetype=cpp " ============================================================================ " KEY MAPPINGS " space enter insertion mode ( still goes back to normal mode) map i " disable ex mode map Q let mapleader="," nmap :TagbarToggle imap :TagbarToggle nmap :NERDTreeToggle map :ed ~/.config/nvim/init.vim " open terminal split [term-split.vim] map :50VTerm map :40VTerm make " delete buffer without closing the window [bclose.vim] nnoremap q :Sayonara nnoremap :qa inoremap :Sayonara "nnoremap :Sayonara "inoremap :Sayonara " toggle comment [NERD commenter] map c smap c " delete word under cursor noremap ciw inoremap ciw " easy tab ident vnoremap > vnoremap < " easier split navigation map h map l map j map k nmap w " move cursor by n lines nnoremap 5- nnoremap 5+ inoremap 5- inoremap 5+ " CTRL-Z is Undo; not in cmdline though noremap u inoremap noremap inoremap vnoremap "+x vnoremap "+y "map "+gP " CTRL-S for saving (require "stty -ixon" line on ~/.bashrc) noremap :update vnoremap :update inoremap :update " Switching buffers map :bnext! map :bprevious! imap :bnext! imap :bprevious! " enter CtrlP tag fuzzy search [ctrp.vim] noremap :CtrlPBufTag noremap :CtrlPLine "tnoremap " keep terminal buffer hidden on background on bn autocmd TermOpen * set bufhidden=hide let python_highlight_all = 1 " --- Airline ----------------------------------------------------------------- " show buffer bar let g:airline#extensions#tabline#enabled = 1 " Show just the filename let g:airline#extensions#tabline#fnamemod = ':t' " --- CtrlP ------------------------------------------------------------------- " let g:ctrlp_map = '' let g:ctrlp_cmd = 'CtrlP' " let g:ctrlp_cmd = 'CtrlPLastMode' let g:ctrlp_extensions = ['buffertag', 'tag', 'line', 'dir'] let g:ctrlp_custom_ignore = { \ 'dir': '\v[\/]\.(git|hg|svn|venv)$', \ 'file': '\v\.(exe|so|dll)$', \ 'link': 'some_bad_symbolic_links', \ } let g:tagbar_map_togglesort = "r" let g:tagbar_map_preview = "" let g:tagbar_map_jump = "" let g:tagbar_autofocus = 1 let g:tagbar_expand = 1 let g:tagbar_indent = 1 let g:tagbar_compact = 1 let g:tagbar_sort = 0 let g:tagbar_width = 25 "let g:deoplete#enable_at_startup=1 "let g:deoplete#enable_refresh_always=0 "let g:deoplete#file#enable_buffer_path=1 "let g:deoplete#auto_completion_start_length = 0 "function! Completefunc(findstart, base) "return "\\" "endfunction " Don't let autocomplete affect usual typing habits "set completeopt=menuone,preview,noinsert """"""" Jedi-VIM """"""" " Don't mess up undo history "let g:jedi#show_call_signatures = "0" "let g:deoplete#sources#jedi#show_docstring = 1 " for python completions "let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'jedi') " language specific completions on markdown file "let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'mistune') " utils, optional "let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'psutil') "let g:python_support_python3_requirements = add(get(g:,'python_support_python3_requirements',[]),'setproctitle') "inoremap pumvisible() ? "\" : "\" "inoremap pumvisible() ? "\" : "\" "inoremap (pumvisible() ? "\\" : "\") "set shortmess+=c "let g:cm_auto_popup = 0 " " inoremap pumvisible() ? "\" : "\" "let g:deoplete#disable_auto_complete = 1 "inoremap "\ pumvisible() ? "\" : "\ check_back_space() ? "\" : "\ deoplete#mappings#manual_complete() "function! s:check_back_space() abort "{{{ "let col = col('.') - 1 "return !col || getline('.')[col - 1] =~ '\s' "endfunction"}}} "inoremap =my_cr_function() "function! s:my_cr_function() abort "return deoplete#close_popup() . "" "endfunction " "if &term =~ '^screen' " tmux will send xterm-style keys when its xterm-keys option is on "execute "set =\e[1;*A" "execute "set =\e[1;*B" "execute "set =\e[1;*C" "execute "set =\e[1;*D" "endif " https://github.com/scrooloose/nerdtree " How can I open a NERDTree automatically when vim starts up if no files were specified? autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif