Browse Source

vimrc add vundle, group autocommands

master
dummy 9 years ago
parent
commit
5cbedc5c79
  1. 102
      .vimrc

102
.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 syntax on
colorscheme deus colorscheme deus
set hlsearch
" don't clutter directories with backup files " don't clutter directories with backup files
set nobackup set nobackup
set nowritebackup set nowritebackup
@ -12,29 +41,9 @@ set clipboard=unnamedplus
" folding " folding
set foldmethod=syntax set foldmethod=syntax
set foldnestmax=1 set foldnestmax=1
set foldlevelstart=0 set foldlevelstart=20
set foldcolumn=2 set foldcolumn=2
set autoindent 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 " filename auto-completion
set wildmode=longest,list,full set wildmode=longest,list,full
@ -49,10 +58,6 @@ set numberwidth=3
set cpoptions+=n " use gutter for wrapped lines set cpoptions+=n " use gutter for wrapped lines
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE 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 " airline plugin stuffs
set laststatus=2 set laststatus=2
let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#enabled = 1
@ -74,23 +79,38 @@ nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K> nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L> nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H> nnoremap <C-H> <C-W><C-H>
map <F5> :Make<CR> "map <F5> :make<CR>
map <F6> :ccl<CR> map <F6> :ccl<CR>
map <F2> :cn<CR>
" Automatically open, but do not go to (if there are errors) the quickfix / map <F5> :AsyncRun -save=2 make<CR>
" location list window, or close it when is has become empty.
" augroup vimrc
" Note: Must allow nesting of autocmds to enable any customizations for quickfix " remove all vimrc autocommands
" buffers. autocmd!
" Note: Normally, :cwindow jumps to the quickfix window if the command opens it autocmd QuickFixCmdPost * copen 8
" (but not if it's already open). However, as part of the autocmd, this doesn't
" seem to happen. " Don't screw up folds when inserting text that might affect them, until
"autocmd QuickFixCmdPost [^l]* nested copen " " leaving insert mode. Foldmethod is local to the window. Protect against
"autocmd QuickFixCmdPost l* nested lwindow " " screwing up folding when switching between windows.
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
autocmd BufReadPost quickfix nnoremap <buffer> r :Copen<CR> autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
autocmd BufReadPost quickfix nnoremap <buffer> R :Copen<CR>G
autocmd BufReadPost quickfix nnoremap <buffer> g :cf<CR> " 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 " fix keycodes when running inside tmux
" http://tmux-users.narkive.com/M9tIqoa0/c-pageup-and-c-pagedown-seems-not-to-work-in-tmux " http://tmux-users.narkive.com/M9tIqoa0/c-pageup-and-c-pagedown-seems-not-to-work-in-tmux

Loading…
Cancel
Save