From 5cbedc5c79e626d7411a9ed918e14d21e0f1701a Mon Sep 17 00:00:00 2001 From: dummy Date: Mon, 12 Feb 2018 17:29:07 -0500 Subject: [PATCH] vimrc add vundle, group autocommands --- .vimrc | 102 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 41 deletions(-) diff --git a/.vimrc b/.vimrc index b08a1df..d2686f9 100644 --- a/.vimrc +++ b/.vimrc @@ -1,7 +1,36 @@ -filetype plugin indent on +" +" Begin Vundle config +" https://github.com/VundleVim/Vundle.vim +" +set nocompatible +filetype off + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() +" alternatively, pass a path where Vundle should install plugins +"call vundle#begin('~/some/path/here') + +" let Vundle manage Vundle, required +Plugin 'VundleVim/Vundle.vim' +" plugin for running make asynchronously +Plugin 'https://github.com/skywind3000/asyncrun.vim.git' + + +" All of your Plugins must be added before the following line +call vundle#end() " required +filetype plugin indent on " required + +" +" End Vundle config +" + +"filetype plugin indent on syntax on colorscheme deus +set hlsearch + " don't clutter directories with backup files set nobackup set nowritebackup @@ -12,29 +41,9 @@ set clipboard=unnamedplus " folding set foldmethod=syntax set foldnestmax=1 -set foldlevelstart=0 +set foldlevelstart=20 set foldcolumn=2 set autoindent -" Don't screw up folds when inserting text that might affect them, until -" " leaving insert mode. Foldmethod is local to the window. Protect against -" " screwing up folding when switching between windows. - autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif - autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif - -" autocmd to highlight current line in one window only -augroup CursorLine - au! - au VimEnter,WinEnter,BufWinEnter * setlocal cursorline - au WinLeave * setlocal nocursorline -augroup END - -" change cursor when changing to/from insert mode -" NOTE: only for xfce terminal -if has("autocmd") - au InsertEnter * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_BLOCK/TERMINAL_CURSOR_SHAPE_IBEAM/' ~/.config/xfce4/terminal/terminalrc" - au InsertLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_IBEAM/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/xfce4/terminal/terminalrc" - au VimLeave * silent execute "!sed -i.bak -e 's/TERMINAL_CURSOR_SHAPE_IBEAM/TERMINAL_CURSOR_SHAPE_BLOCK/' ~/.config/xfce4/terminal/terminalrc" -endif " filename auto-completion set wildmode=longest,list,full @@ -49,10 +58,6 @@ set numberwidth=3 set cpoptions+=n " use gutter for wrapped lines highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE -" pathogen plugin -" https://github.com/tpope/vim-pathogen -execute pathogen#infect() - " airline plugin stuffs set laststatus=2 let g:airline#extensions#tabline#enabled = 1 @@ -74,23 +79,38 @@ nnoremap nnoremap nnoremap nnoremap -map :Make +"map :make map :ccl +map :cn -" Automatically open, but do not go to (if there are errors) the quickfix / -" location list window, or close it when is has become empty. -" -" Note: Must allow nesting of autocmds to enable any customizations for quickfix -" buffers. -" Note: Normally, :cwindow jumps to the quickfix window if the command opens it -" (but not if it's already open). However, as part of the autocmd, this doesn't -" seem to happen. -"autocmd QuickFixCmdPost [^l]* nested copen -"autocmd QuickFixCmdPost l* nested lwindow - -autocmd BufReadPost quickfix nnoremap r :Copen -autocmd BufReadPost quickfix nnoremap R :CopenG -autocmd BufReadPost quickfix nnoremap g :cf +map :AsyncRun -save=2 make + +augroup vimrc + " remove all vimrc autocommands + autocmd! + autocmd QuickFixCmdPost * copen 8 + + " Don't screw up folds when inserting text that might affect them, until + " " leaving insert mode. Foldmethod is local to the window. Protect against + " " screwing up folding when switching between windows. + autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif + autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif + + " save folds/cursor positions of buffers + autocmd BufWinLeave *.* mkview + autocmd BufWinEnter *.* silent loadview + + " Automatically open, but do not go to (if there are errors) the quickfix / + " location list window, or close it when is has become empty. + " + " Note: Must allow nesting of autocmds to enable any customizations for quickfix + " buffers. + " Note: Normally, :cwindow jumps to the quickfix window if the command opens it + " (but not if it's already open). However, as part of the autocmd, this doesn't + " seem to happen. + "autocmd QuickFixCmdPost [^l]* nested cwindow + "autocmd QuickFixCmdPost l* nested lwindow +augroup END " fix keycodes when running inside tmux " http://tmux-users.narkive.com/M9tIqoa0/c-pageup-and-c-pagedown-seems-not-to-work-in-tmux