aniero (owner)

Revisions

gist: 39800 Download_button fork
public
Public Clone URL: git://gist.github.com/39800.git
.profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function d() {
  if [ -n "$1" ]; then
    if [ -d "$1" ]; then
      pushd $1 >/dev/null
      mvim -c :NT
      popd >/dev/null
    else
      echo "$1 is not a directory"
    fi
  else
    echo "specify a directory to edit"
  fi
}
 
alias e='mvim'
 
alias sp='spec -cfs -Du'
alias spb='spec -bcfs -Du'
 
.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
source ~/.vim/vimrc
 
let g:NERDTreeMapOpenSplit = 'i'
let g:fuzzy_ignore = "gems*;pkg/*"
let g:NERDSpaceDelims = 1
 
let NERDTreeChDirMode=2 " auto-change CWD when changing tree root
command -n=? -complete=dir NT NERDTreeToggle <args>
" TODO look up "local leader" for setting up custom local leader
 
" colorscheme twilight2
colorscheme vibrantink
 
" size the window so it fills the macbook screen
set columns=181
set lines=53
set gfn=Andale_Mono:h12
 
set directory=~/.vimswap
" set nobackup
" set noswapfile
 
set tabstop=2
set softtabstop=2
set shiftwidth=2
syntax on
 
set go-=T " disable the toolbars in macvim
set go-=r " disable right-hand scrollbar
set go-=L " disable left-hand scrollbar
" set go-=e " disable graphical tabs
 
set winheight=10 " current window is a nice height always
set winminheight=3 " but the other windows aren't *too* small
 
set number
 
command StripTrailingSpaces :%s/\s\+$//g
command Tr :StripTrailingSpaces
 
" set up word wrap stuff
set wrap
set linebreak
set textwidth=120
set wrapmargin=120
 
" tab mojo from ara
" this lets 'tt' toggle between tabs
let g:tabno=tabpagenr()
au TabLeave * :let g:tabno = tabpagenr()
" map tt :exec 'normal !'.g:tabno.'gt'<cr>
 
" map 'tn' to tabnext - a count is relative from current pos
function TabNext()
    exec 'tabn'
endfunction
" map tn :call TabNext()<CR>
 
" map <C-J> <C-W>j<C-W>_
" map <C-K> <C-W>k<C-W>_
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-h> <C-w>h
map <C-l> <C-w>l
map <C-_> <C-w>_
map <D-j> gt
map <D-k> gT
map <C-Left> :call TabMove(1)<CR>
map <C-Right> :call TabMove(0)<CR>
 
" map 'tg' to 'tab go' - this is an absolute tab number and quite useful with 'tt'
" map tg gt
" map <C-j> gt
 
" map 'tp' to 'tab previous'
" map tp gT
" map <C-k> gT
 
" ctrl-j and ctrl-k move tabs left(j)/right(k)
" map <C-h> :call TabMove(1)<CR>
" map <C-j> :call TabMove(1)<CR>
" map <C-k> :call TabMove(0)<CR>
" map <C-l> :call TabMove(0)<CR>
function TabMove(n)
    let nr = tabpagenr()
    let size = tabpagenr('$')
    " do we want to go left?
    if (a:n != 0)
        let nr = nr - 2
    endif
    " crossed left border?
    if (nr < 0)
        let nr = size-1
        " crossed right border?
    elseif (nr == size)
        let nr = 0
    endif
    " fire move command
    exec 'tabm'.nr
endfunction
 
" settings from jeremy
" wildmatching
" set wildmode=list:longest " make cmdline tab completion similar to bash
" set wildmenu " enable ctrl-n and ctrl-p to scroll through matches
" set wildignore=*.o,*.obj,*~
"
" completion additions.
" set popumen to display longest match on popup even if only one match
" set completeopt=menuone,longest
 
" from http://vim.wikia.com/wiki/Change_vimrc_with_auto_reload
" autocmd BufWritePost .vimrc source %
 
" from http://pastie.org/359759 / evan phoenix
function! CleverTab()
    if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
        return "\<Tab>"
    else
        return "\<C-N>"
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
 
" from atmos
nnoremap <D-r> :NERDTreeToggle<CR>
 
" redraw the screen
nnoremap <D-l> :nohlsearch<CR>
inoremap <D-l> <C-O>:nohlsearch<CR>
 
" formatoptions get overridden by the ftplugin stuff built-ins
" see http://peox.net/articles/vimconfig.html for more info
 
 
" from http://www.oreillynet.com/onlamp/blog/2005/07/vim_its_slim_and_trim_heres_wh.html
" function ClosePair(char)
" if getline('.')[col('.') - 1] == a:char
" return "\<Right>"
" else
" return a:char
" endif
" endf
" inoremap ( ()<ESC>i
" inoremap ) <C-R>=ClosePair(')')<CR>
" inoremap { {}<ESC>i
" inoremap } <C-R>=ClosePair('}')<CR>
" inoremap [ []<ESC>i
" inoremap ] <C-R>=ClosePair(']')<CR>