-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
126 lines (109 loc) · 3.17 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
set nocompatible
let mapleader = ","
call plug#begin('~/.vim/bundle')
" BUFFERS AND FILES
set autowriteall
set encoding=utf-8
set fileencodings=utf-8,windows-1251,iso-8859-15,koi8-r
set hidden
set noswapfile
" INTERFACE
set clipboard=unnamed " http://vim.wikia.com/wiki/Mac_OS_X_clipboard_sharing#Comments
set cursorline
set foldmethod=marker
set diffopt+=vertical
set guifont=Monaco:h14
set laststatus=2
set nowrap
set number
set modeline
set modelines=5
set mouse=a
set scrolloff=3
set showmatch
set noshowmode
set title
set ttyfast
nmap <C-J> <C-W>j
nmap <C-K> <C-W>k
nmap <C-H> <C-W>h
nmap <C-L> <C-W>l
" SEARCH AND REPLACE
set gdefault
set history=100
set hlsearch
set incsearch
set ignorecase
set smartcase
set wrapscan
nmap <Space> :set invhls<cr>:set hls?<cr>
" COMMAND-LINE COMPLETION
set wildignore+=*.swp,.git
set wildmenu
set wildmode=list:longest,full
" CODE COMPLETE
set complete=.,w,b,t
set completeopt-=preview " Docs preview are very annoying on completion
set omnifunc=syntaxcomplete#Complete
" FORMATTING AND EDITING
set autoindent
set backspace=indent,eol,start
set expandtab
set shiftround
set shiftwidth=4
set softtabstop=4
set tabstop=4
vnoremap < <gv
vnoremap > >gv
" THEME AND HIGHLITING
set t_Co=256
set background=dark
Plug 'altercation/vim-colors-solarized'
let g:solarized_underline=0
" COMMON PLUGINS
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'
let g:fzf_layout = { 'down': '~40%' }
let g:fzf_buffers_jump = 1
nmap <silent> <c-p> :Files<CR>
Plug 'jlanzarotta/bufexplorer', { 'tag': 'v7.4.6' }
let g:bufExplorerShowRelativePath=1
let g:bufExplorerSortBy='fullpath'
nmap <silent> <Leader>e :BufExplorer<CR>
Plug 'scrooloose/nerdtree', { 'tag': '4.2.0' }
let NERDTreeIgnore=[]
nmap <silent> <Leader>t :NERDTreeToggle<CR>
Plug 'ervandew/supertab', { 'tag': '2.1' }
Plug 'mileszs/ack.vim', { 'tag': '1.0.8' }
Plug 'Lokaltog/powerline', { 'tag': '1.2' }
Plug 'tpope/vim-fugitive', { 'tag': 'v2.1' }
Plug 'kana/vim-scratch', { 'tag': '0.1.1' }
Plug 'scrooloose/nerdcommenter', { 'tag': '2.3.0' }
for f in split(glob('~/.vim/vimrc.d/*.vim'), '\n')
execute 'source' f
endfor
call plug#end()
silent! colorscheme solarized
" Common commads in upper case to do want I want even if the Shift button was
" pressed by accident.
:command! W w
:command! Q q
:command! WQ wq
:command! Wq wq
nmap <silent> <Leader>v :e $MYVIMRC<CR>
augroup tricks
autocmd!
" Jump to the last known position in a file just after opening it, if the '" mark is set
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g`\"" | endif
" Remove trailing whitespaces before save Someone says its dangerous. Nah! Screw you!
autocmd BufWritePre * :%s/\s\+$//e
" Souce my .vimrc file every time it was saved.
" Use *vimrc pattern because ~/.vimrc is a symlink to ~/.vim/vimrc in my
" case so I want a clever file detection.
autocmd BufWritePost *vimrc source $MYVIMRC
augroup END
" Enables the reading of .vimrc, .exrc and .gvimrc indent the current
" directory. If you switch this option on you should also consider
" setting the 'secure' option. Using a local .exrc, .vimrc or .gvimrc
" is a potential security leak, use with care!
set exrc
set secure