forked from aclough/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
executable file
·118 lines (104 loc) · 4.26 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
" Configuration notes, plugins to install
" Pathogen, for managing other plugins
" ctrlp, for textmate-like find
" nerdtree, for file navigation
" buffergator, for buffer navigation
" easymotion, for, well, easy motion
" fugative, for git integration
set mouse=a " turn on mouse
set scrolloff=3 " when scrolling always show 3 bottom lines
set showcmd " show command
set showmatch
set incsearch " incrimental search
set ignorecase " Normally ignore case when searching
set smartcase " Do The Right Thing with case when searching
set hlsearch " Highlight searched terms
set lazyredraw " Don't redraw screen for intermediate macro steps
set hidden
set wildmenu " Show possible tab completions
set background=dark " dark background
set backspace=indent,eol,start " make backspace more flexible
syntax on " Syntax highlighting on
set nocompatible " Don't emulate vi bugs
set tabstop=4 " 4 space tabs
set expandtab " expand tabs to spaces
set shiftwidth=4 " use 4 spaces when indented
set ruler " statusline showing current cursor position
"set foldcolumn=1 " have a fold status-column
set foldmethod=indent " automatically have everything folded by colum
set nofoldenable " But don't start with things folded
set laststatus=2 " Always use status lines
set encoding=utf-8 " Needed for powerline, but also a good idea
set clipboard=unnamed " Uses system clipboard by default
filetype plugin on " autocomplete
filetype plugin indent on
set complete=.,w,b,u,t,i " Autocomplete via tags
set tags=tags,../tags,../../tags,../../../tags,../../../../tags " Use this tags file
"set csto=0 " Integrate cscope with ctags
"set cscopetag
"set textwidth=80 " Maximum text width before wrap, gq to auto
set list listchars=tab:▸\ ,trail:⋅,nbsp:⋅ " Show whitespace and tabs
"
call pathogen#infect() "use pathogen to get other plugins
" For fugative
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
colorscheme jellybeans
iabbrev #b /*****************************
iabbrev #e *****************************/
iabbrev teh the
"For easier split window management
map <C-J> <C-w>w
map <C-K> <C-W>W
"For easier tab management
map <C-H> gT
map <C-L> gt
"Resist the tempation to guess in the face of ambiguous tags
map <C-]> :tj <C-r><C-w><CR>
"Map Q to repeat the last recorded macro
map Q @@
"Make Y behave like other captials
map Y y$
"Force Saving Files that Require Root Permission
cmap w!! %!sudo tee > /dev/null %
"Reload vimrc when its saved
au BufWritePost .vimrc so ~/.vimrc
"Get rid of trailing whitespace before each save
autocmd BufWritePre * :%s/\s\+$//e
"Select most recent paste (e.g. for indenting python)
nnoremap gp `[v`]
"For selecting by indentation
onoremap <silent>ai :<C-u>cal IndTxtObj(0)<CR>
onoremap <silent>ii :<C-u>cal IndTxtObj(1)<CR>
vnoremap <silent>ai :<C-u>cal IndTxtObj(0)<CR><Esc>gv
vnoremap <silent>ii :<C-u>cal IndTxtObj(1)<CR><Esc>gv
" Selection by indentation function
" use 'vai' to select an indentation or block including blank lines
" use 'vii' to do the same, but without blank lines
function! IndTxtObj(inner)
let curline = line(".")
let lastline = line("$")
let i = indent(line(".")) - &shiftwidth * (v:count1 - 1)
let i = i < 0 ? 0 : i
if getline(".") !~ "^\\s*$"
let p = line(".") - 1
let nextblank = getline(p) =~ "^\\s*$"
while p > 0 && ((i == 0 && !nextblank) || (i > 0 && ((indent(p) >= i && !(nextblank && a:inner)) || (nextblank && !a:inner))))
-
let p = line(".") - 1
let nextblank = getline(p) =~ "^\\s*$"
endwhile
normal! 0V
call cursor(curline, 0)
let p = line(".") + 1
let nextblank = getline(p) =~ "^\\s*$"
while p <= lastline && ((i == 0 && !nextblank) || (i > 0 && ((indent(p) >= i && !(nextblank && a:inner)) || (nextblank && !a:inner))))
+
let p = line(".") + 1
let nextblank = getline(p) =~ "^\\s*$"
endwhile
normal! $
endif
endfunction