Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 129 lines (104 sloc) 3.143 kb
9a57c0a @tmm1 make fullscreen take up entire screen
tmm1 authored
1 " Fullscreen takes up entire screen
2 set fuoptions=maxhorz,maxvert
3
9ef5dce @tmm1 link gvimrc to enable apple-t for CommandT in MacVIM
tmm1 authored
4 if has("gui_macvim")
2c4982b @tmm1 comments in gvimrc
tmm1 authored
5 " Apple-T for CommandT
9ef5dce @tmm1 link gvimrc to enable apple-t for CommandT in MacVIM
tmm1 authored
6 macmenu &File.New\ Tab key=<nop>
7 map <D-t> :CommandT<CR>
46b1633 @wycats Map <D-F> to `:Ack `
wycats authored
8
2c4982b @tmm1 comments in gvimrc
tmm1 authored
9 " Apple-Shift-F for Ack
46b1633 @wycats Map <D-F> to `:Ack `
wycats authored
10 macmenu Window.Toggle\ Full\ Screen\ Mode key=<nop>
9974c7b @wycats <D-F> should be `:Ack ` not `:Ack`
wycats authored
11 map <D-F> :Ack<space>
33f6508 @tmm1 apple-e to open conqueterm
tmm1 authored
12
13 " Apple-e for ConqueTerm
14 map <D-e> :call StartTerm()<CR>
9ef5dce @tmm1 link gvimrc to enable apple-t for CommandT in MacVIM
tmm1 authored
15 endif
331c805 @tmm1 use local gvim settings from ~/.gvimrc.local
tmm1 authored
16
8d2a8e2 @wuputah start with the gvim/macvim toolbar hidden
wuputah authored
17 " start without the toolbar
18 set go-=T
19
33f6508 @tmm1 apple-e to open conqueterm
tmm1 authored
20 " ConqueTerm wrapper
21 function StartTerm()
22 ConqueTerm bash --login
23 setlocal listchars=tab:\ \
24 endfunction
25
765746e @tmm1 move project tree stuff into gvimrc
tmm1 authored
26 " Project Tree
27 autocmd VimEnter * NERDTree
28 autocmd VimEnter * wincmd p
29 autocmd VimEnter * call s:CdIfDirectory(expand("<amatch>"))
30
31 " Disable netrw's autocmd, since we're ALWAYS using NERDTree
32 runtime plugin/netRwPlugin.vim
33 augroup FileExplorer
34 au!
35 augroup END
36
37 let g:NERDTreeHijackNetrw = 0
38
39 " If the parameter is a directory, cd into it
40 function s:CdIfDirectory(directory)
41 if isdirectory(a:directory)
42 call ChangeDirectory(a:directory)
43 endif
44 endfunction
45
46 " NERDTree utility function
47 function s:UpdateNERDTree(stay)
48 if exists("t:NERDTreeBufName")
49 if bufwinnr(t:NERDTreeBufName) != -1
50 NERDTree
51 if !a:stay
52 wincmd p
53 end
54 endif
55 endif
56 endfunction
57
58 " Utility functions to create file commands
59 function s:CommandCabbr(abbreviation, expansion)
60 execute 'cabbrev ' . a:abbreviation . ' <c-r>=getcmdpos() == 1 && getcmdtype() == ":" ? "' . a:expansion . '" : "' . a:abbreviation . '"<CR>'
61 endfunction
62
63 function s:FileCommand(name, ...)
64 if exists("a:1")
65 let funcname = a:1
66 else
67 let funcname = a:name
68 endif
69
70 execute 'command -nargs=1 -complete=file ' . a:name . ' :call ' . funcname . '(<f-args>)'
71 endfunction
72
73 function s:DefineCommand(name, destination)
74 call s:FileCommand(a:destination)
75 call s:CommandCabbr(a:name, a:destination)
76 endfunction
77
78 " Public NERDTree-aware versions of builtin functions
79 function ChangeDirectory(dir, ...)
80 execute "cd " . a:dir
81 let stay = exists("a:1") ? a:1 : 1
82 call s:UpdateNERDTree(stay)
83 endfunction
84
85 function Touch(file)
86 execute "!touch " . a:file
87 call s:UpdateNERDTree(1)
88 endfunction
89
90 function Remove(file)
91 let current_path = expand("%")
92 let removed_path = fnamemodify(a:file, ":p")
93
94 if (current_path == removed_path) && (getbufvar("%", "&modified"))
95 echo "You are trying to remove the file you are editing. Please close the buffer first."
96 else
97 execute "!rm " . a:file
98 endif
99 endfunction
100
101 function Edit(file)
102 if exists("b:NERDTreeRoot")
103 wincmd p
104 endif
105
106 execute "e " . a:file
107
108 ruby << RUBY
109 destination = File.expand_path(VIM.evaluate(%{system("dirname " . a:file)}))
110 pwd = File.expand_path(Dir.pwd)
111 home = pwd == File.expand_path("~")
112
113 if home || Regexp.new("^" + Regexp.escape(pwd)) !~ destination
114 VIM.command(%{call ChangeDirectory(system("dirname " . a:file), 0)})
115 end
116 RUBY
117 endfunction
118
119 " Define the NERDTree-aware aliases
120 call s:DefineCommand("cd", "ChangeDirectory")
121 call s:DefineCommand("touch", "Touch")
122 call s:DefineCommand("rm", "Remove")
123 call s:DefineCommand("e", "Edit")
124
331c805 @tmm1 use local gvim settings from ~/.gvimrc.local
tmm1 authored
125 " Include user's local vim config
126 if filereadable(expand("~/.gvimrc.local"))
127 source ~/.gvimrc.local
128 endif
Something went wrong with that request. Please try again.