247 lines
6.8 KiB
VimL
247 lines
6.8 KiB
VimL
set encoding=utf-8
|
|
|
|
" START - Setting up Vundle - the vim plugin bundler
|
|
let iCanHazVundle=1
|
|
let vundle_readme=expand('~/.vim/bundle/Vundle.vim/README.md')
|
|
if !filereadable(vundle_readme)
|
|
echo "Installing Vundle.."
|
|
echo ""
|
|
silent !mkdir -p ~/.vim/bundle
|
|
silent !git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
|
|
let iCanHazVundle=0
|
|
endif
|
|
set rtp+=~/.vim/bundle/Vundle.vim/
|
|
call vundle#rc()
|
|
|
|
" let Vundle manage Vundle, required
|
|
Plugin 'VundleVim/Vundle.vim'
|
|
|
|
if iCanHazVundle == 0
|
|
echo "Installing Bundles, please ignore key map error messages"
|
|
echo ""
|
|
:source $MYVIMRC
|
|
:PluginInstall
|
|
endif
|
|
" END - Setting up Vundle - the vim plugin bundler
|
|
|
|
|
|
set nocompatible " be iMproved, required
|
|
filetype off " required
|
|
|
|
" 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 'Vimjas/vim-python-pep8-indent'
|
|
Plugin 'Townk/vim-autoclose'
|
|
Plugin 'davidhalter/jedi-vim'
|
|
Plugin 'ervandew/supertab'
|
|
|
|
|
|
" The following are examples of different formats supported.
|
|
" Keep Plugin commands between vundle#begin/end.
|
|
" plugin on GitHub repo
|
|
"Plugin 'tpope/vim-fugitive'
|
|
" plugin from http://vim-scripts.org/vim/scripts.html
|
|
" Plugin 'L9'
|
|
" Git plugin not hosted on GitHub
|
|
"Plugin 'git://git.wincent.com/command-t.git'
|
|
" git repos on your local machine (i.e. when working on your own plugin)
|
|
"Plugin 'file:///home/gmarik/path/to/plugin'
|
|
" The sparkup vim script is in a subdirectory of this repo called vim.
|
|
" Pass the path to set the runtimepath properly.
|
|
"Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
|
|
" Install L9 and avoid a Naming conflict if you've already installed a
|
|
" different version somewhere else.
|
|
" Plugin 'ascenator/L9', {'name': 'newL9'}
|
|
|
|
" All of your Plugins must be added before the following line
|
|
call vundle#end() " required
|
|
filetype plugin indent on " required
|
|
" To ignore plugin indent changes, instead use:
|
|
"filetype plugin on
|
|
"
|
|
" Brief help
|
|
" :PluginList - lists configured plugins
|
|
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
|
|
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
|
|
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
|
|
"
|
|
" see :h vundle for more details or wiki for FAQ
|
|
" Put your non-Plugin stuff after this line
|
|
|
|
|
|
" Leader
|
|
let mapleader = " "
|
|
|
|
set backspace=2 " Backspace deletes like most programs in insert mode
|
|
set nobackup
|
|
set nowritebackup
|
|
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
|
|
set history=50
|
|
set ruler " show the cursor position all the time
|
|
set showcmd " display incomplete commands
|
|
set incsearch " do incremental searching
|
|
set laststatus=2 " Always display the status line
|
|
set autowrite " Automatically :write before running commands
|
|
set modelines=0 " Disable modelines as a security precaution
|
|
set nomodeline
|
|
|
|
|
|
" Switch syntax highlighting on, when the terminal has colors
|
|
" Also switch on highlighting the last used search pattern.
|
|
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
|
|
syntax on
|
|
endif
|
|
|
|
|
|
|
|
if filereadable(expand("~/.vimrc.bundles"))
|
|
source ~/.vimrc.bundles
|
|
endif
|
|
|
|
" Load matchit.vim, but only if the user hasn't installed a newer version.
|
|
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
|
|
runtime! macros/matchit.vim
|
|
endif
|
|
|
|
filetype plugin indent on
|
|
|
|
augroup vimrcEx
|
|
autocmd!
|
|
|
|
" When editing a file, always jump to the last known cursor position.
|
|
" Don't do it for commit messages, when the position is invalid, or when
|
|
" inside an event handler (happens when dropping a file on gvim).
|
|
autocmd BufReadPost *
|
|
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
|
|
\ exe "normal g`\"" |
|
|
\ endif
|
|
|
|
" Set syntax highlighting for specific file types
|
|
autocmd BufRead,BufNewFile *.md set filetype=markdown
|
|
autocmd BufRead,BufNewFile .{jscs,jshint,eslint}rc set filetype=json
|
|
autocmd BufRead,BufNewFile aliases.local,zshrc.local,*/zsh/configs/* set filetype=sh
|
|
autocmd BufRead,BufNewFile gitconfig.local set filetype=gitconfig
|
|
autocmd BufRead,BufNewFile tmux.conf.local set filetype=tmux
|
|
autocmd BufRead,BufNewFile vimrc.local set filetype=vim
|
|
augroup END
|
|
|
|
|
|
" When the type of shell script is /bin/sh, assume a POSIX-compatible
|
|
" shell for syntax highlighting purposes.
|
|
let g:is_posix = 1
|
|
|
|
" Softtabs, 4 spaces
|
|
set tabstop=4
|
|
set shiftwidth=4
|
|
set shiftround
|
|
set expandtab
|
|
|
|
" Display extra whitespace
|
|
set list listchars=tab:»·,trail:·,nbsp:·
|
|
|
|
" Use one space, not two, after punctuation.
|
|
set nojoinspaces
|
|
|
|
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
|
|
if executable('ag')
|
|
" Use Ag over Grep
|
|
set grepprg=ag\ --nogroup\ --nocolor
|
|
|
|
" Use ag in fzf for listing files. Lightning fast and respects .gitignore
|
|
let $FZF_DEFAULT_COMMAND = 'ag --literal --files-with-matches --nocolor --hidden -g ""'
|
|
|
|
if !exists(":Ag")
|
|
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
|
|
nnoremap \ :Ag<SPACE>
|
|
endif
|
|
endif
|
|
|
|
" Make it obvious where 80 characters is
|
|
set textwidth=80
|
|
set colorcolumn=+1
|
|
|
|
" Numbers
|
|
set number
|
|
set numberwidth=5
|
|
|
|
" Tab completion
|
|
" will insert tab at beginning of line,
|
|
" will use completion if not at beginning
|
|
|
|
set wildmode=list:longest,list:full
|
|
function! InsertTabWrapper()
|
|
let col = col('.') - 1
|
|
if !col || getline('.')[col - 1] !~ '\k'
|
|
return "\<Tab>"
|
|
else
|
|
return "\<C-p>"
|
|
endif
|
|
endfunction
|
|
inoremap <Tab> <C-r>=InsertTabWrapper()<CR>
|
|
inoremap <S-Tab> <C-n>
|
|
|
|
" Open new split panes to right and bottom, which feels more natural
|
|
set splitbelow
|
|
set splitright
|
|
|
|
" Quicker window movement
|
|
nnoremap <C-j> <C-w>j
|
|
nnoremap <C-k> <C-w>k
|
|
nnoremap <C-h> <C-w>h
|
|
nnoremap <C-l> <C-w>l
|
|
|
|
" Autocomplete with dictionary words when spell check is on
|
|
set complete+=kspell
|
|
|
|
|
|
" Local config
|
|
if filereadable($HOME . "/.vimrc.local")
|
|
source ~/.vimrc.local
|
|
endif
|
|
|
|
" Relative line numbers, but real line number for current line
|
|
set number relativenumber
|
|
set nu rnu
|
|
|
|
" Keep 8 rows above and below the kk
|
|
set scrolloff=8
|
|
|
|
" Jump to wrapped line instead of next real line.
|
|
nnoremap j gj
|
|
nnoremap k gk
|
|
|
|
" Do not cut words when breaking lines.
|
|
set linebreak
|
|
|
|
" Searching with "/": Ignore case if search term is lower case.
|
|
set smartcase
|
|
|
|
|
|
" Strip trailing whitespaces on each save
|
|
fun! <SID>StripTrailingWhitespaces()
|
|
let l = line(".")
|
|
let c = col(".")
|
|
%s/\s\+$//e
|
|
call cursor(l, c)
|
|
endfun
|
|
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
|
|
|
|
" Indent and unindent with tab.
|
|
|
|
nnoremap <Tab> >>_
|
|
nnoremap <S-Tab> <<_
|
|
inoremap <S-Tab> <C-D>
|
|
vnoremap <Tab> >gv
|
|
vnoremap <S-Tab> <gv
|
|
|
|
" Fuzzy file search by default:
|
|
set path+=**
|
|
|
|
|
|
colorscheme darcula
|