forked from ryanb/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.after
executable file
·85 lines (77 loc) · 2.66 KB
/
vimrc.after
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
let g:CommandTMaxHeight=7
set laststatus=1
" Easier non-interactive command insertion
nnoremap <Space> :
imap <c-l> <space>=><space>
command! KillWhitespace :normal :%s/ *$//g<cr><c-o><cr>
" hightlight cursor line
set cursorline
"nnoremap <CR> :nohlsearch<cr>
set number
set guifont=Monaco:h15
"map <D-r> :SweetVimRspecRunFile<CR>
"imap <D-r> <Esc> :SweetVimRspecRunFile<CR>
"map <D-R> :SweetVimRspecRunFocused<CR>
"imap <D-R> <Esc> :SweetVimRspecRunFocused<CR>
"map <M-D-r> :SweetVimRspecRunPrevious<CR>
"let $SWEET_VIM_RSPEC_SHOW_PASSING="true"
let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$','tmp']
let g:SweetVimRspecOptions="--drb"
set shell=/bin/bash
function! ExtractVariable()
let name = input("Variable name: ")
if name == ''
return
endif
" Enter visual mode (not sure why this is needed since we're already in
" visual mode anyway)
normal! gv
" Replace selected text with the variable name
exec "normal c" . name
" Define the variable on the line above
exec "normal! O" . name . " = "
" Paste the original selected text to be the variable value
normal! $p
endfunction
function! InlineVariable()
" Copy the variable under the cursor into the 'a' register
" XXX: How do I copy into a variable so I don't pollute the registers?
:normal "ayiw
" It takes 4 diws to get the variable, equal sign, and surrounding
" whitespace. I'm not sure why. diw is different from dw in this respect.
:normal 4diw
" Delete the expression into the 'b' register
:normal "bd$
" Delete the remnants of the line
:normal dd
" Go to the end of the previous line so we can start our search for the
" usage of the variable to replace. Doing '0' instead of 'k$' doesn't
" work; I'm not sure why.
normal k$
" Find the next occurence of the variable
exec '/\<' . @a . '\>'
" Replace that occurence with the text we yanked
exec ':.s/\<' . @a . '\>/' . @b
endfunction
vnoremap <leader>ev :call ExtractVariable()<cr>
nnoremap <leader>iv :call InlineVariable()<cr>
set ofu=syntaxcomplete#Complete
filetype plugin on
set autoindent
set smartindent
set antialias
"Map Cmd-shitf-a to Ack for current word
map <D-A> :Ack! --type ruby '<C-r><C-w>' <CR>
let g:ackprg="ack -H --smart-case --column --no-group -w"
set exrc
set wildignore=tmp,coverage
autocmd FileType ruby setlocal fdm=syntax
autocmd FileType ruby setlocal foldlevel=99
set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
command! W :w
command! Q :q
set guifont=Menlo:h17
set guioptions-=T
map <D-r> :exe "!spin push %" <CR><CR>
map <D-R> :exe "!spin push %:" . line(".") <CR><CR>
map <D-A> :Ack! <C-R><C-W><CR>