dotfiles

=> git.r.bdr.sh
=> summary
=> tree
=> log
=> refs

dotfiles/vim/gvimrc | 5 KB

=> view raw

  1 if has("gui_macvim")
  2   " Fullscreen takes up entire screen
  3   set fuoptions=maxhorz,maxvert
  4 
  5   " Command-T for CommandT
  6   macmenu &File.New\ Tab key=
  7   map  :CommandT
  8   imap  :CommandT
  9 
 10   " Command-Return for fullscreen
 11   macmenu Window.Toggle\ Full\ Screen\ Mode key=
 12 
 13   " Command-Shift-F for Ack
 14   map  :Ack
 15 
 16   " Command-e for ConqueTerm
 17   map  :call StartTerm()
 18 
 19   " Command-/ to toggle comments
 20   map  NERDCommenterToggle
 21   imap  NERDCommenterTogglei
 22 
 23 
 24   " Command-][ to increase/decrease indentation
 25   vmap  >gv
 26   vmap   0gt
 30   imap  0gt
 31   map   1gt
 32   imap  1gt
 33   map   2gt
 34   imap  2gt
 35   map   3gt
 36   imap  3gt
 37   map   4gt
 38   imap  4gt
 39   map   5gt
 40   imap  5gt
 41   map   6gt
 42   imap  6gt
 43   map   7gt
 44   imap  7gt
 45   map   8gt
 46   imap  8gt
 47   map   9gt
 48   imap  9gt
 49 
 50   " Command-Option-ArrowKey to switch viewports
 51   map  k
 52   imap   k
 53   map  j
 54   imap   j
 55   map  l
 56   imap   l
 57   map  h
 58   imap  h
 59 
 60   " Adjust viewports to the same size
 61   map = =
 62   imap =  =
 63 endif
 64 
 65 " Don't beep
 66 set visualbell
 67 
 68 " Start without the toolbar
 69 set guioptions-=T
 70 
 71 " Default gui color scheme
 72 color ir_black
 73 
 74 " ConqueTerm wrapper
 75 function StartTerm()
 76   execute 'ConqueTerm ' . $SHELL . ' --login'
 77   setlocal listchars=tab:\ \ 
 78 endfunction
 79 
 80 " Project Tree
 81 if exists("loaded_nerd_tree")
 82   autocmd VimEnter * call s:CdIfDirectory(expand(""))
 83   autocmd FocusGained * call s:UpdateNERDTree()
 84   autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
 85 endif
 86 
 87 " Close all open buffers on entering a window if the only
 88 " buffer that's left is the NERDTree buffer
 89 function s:CloseIfOnlyNerdTreeLeft()
 90   if exists("t:NERDTreeBufName")
 91     if bufwinnr(t:NERDTreeBufName) != -1
 92       if winnr("$") == 1
 93         q
 94       endif
 95     endif
 96   endif
 97 endfunction
 98 
 99 " If the parameter is a directory, cd into it
100 function s:CdIfDirectory(directory)
101   let explicitDirectory = isdirectory(a:directory)
102   let directory = explicitDirectory || empty(a:directory)
103 
104   if explicitDirectory
105     exe "cd " . fnameescape(a:directory)
106   endif
107 
108   " Allows reading from stdin
109   " ex: git diff | mvim -R -
110   if strlen(a:directory) == 0 
111     return
112   endif
113 
114   if directory
115     NERDTree
116     wincmd p
117     bd
118   endif
119 
120   if explicitDirectory
121     wincmd p
122   endif
123 endfunction
124 
125 " NERDTree utility function
126 function s:UpdateNERDTree(...)
127   let stay = 0
128 
129   if(exists("a:1"))
130     let stay = a:1
131   end
132 
133   if exists("t:NERDTreeBufName")
134     let nr = bufwinnr(t:NERDTreeBufName)
135     if nr != -1
136       exe nr . "wincmd w"
137       exe substitute(mapcheck("R"), "", "", "")
138       if !stay
139         wincmd p
140       end
141     endif
142   endif
143 
144   if exists(":CommandTFlush") == 2
145     CommandTFlush
146   endif
147 endfunction
148 
149 " Utility functions to create file commands
150 function s:CommandCabbr(abbreviation, expansion)
151   execute 'cabbrev ' . a:abbreviation . ' =getcmdpos() == 1 && getcmdtype() == ":" ? "' . a:expansion . '" : "' . a:abbreviation . '"'
152 endfunction
153 
154 function s:FileCommand(name, ...)
155   if exists("a:1")
156     let funcname = a:1
157   else
158     let funcname = a:name
159   endif
160 
161   execute 'command -nargs=1 -complete=file ' . a:name . ' :call ' . funcname . '()'
162 endfunction
163 
164 function s:DefineCommand(name, destination)
165   call s:FileCommand(a:destination)
166   call s:CommandCabbr(a:name, a:destination)
167 endfunction
168 
169 " Public NERDTree-aware versions of builtin functions
170 function ChangeDirectory(dir, ...)
171   execute "cd " . fnameescape(a:dir)
172   let stay = exists("a:1") ? a:1 : 1
173 
174   NERDTree
175 
176   if !stay
177     wincmd p
178   endif
179 endfunction
180 
181 function Touch(file)
182   execute "!touch " . shellescape(a:file, 1)
183   call s:UpdateNERDTree()
184 endfunction
185 
186 function Remove(file)
187   let current_path = expand("%")
188   let removed_path = fnamemodify(a:file, ":p")
189 
190   if (current_path == removed_path) && (getbufvar("%", "&modified"))
191     echo "You are trying to remove the file you are editing. Please close the buffer first."
192   else
193     execute "!rm " . shellescape(a:file, 1)
194   endif
195 
196   call s:UpdateNERDTree()
197 endfunction
198 
199 function Mkdir(file)
200   execute "!mkdir " . shellescape(a:file, 1)
201   call s:UpdateNERDTree()
202 endfunction
203 
204 function Edit(file)
205   if exists("b:NERDTreeRoot")
206     wincmd p
207   endif
208 
209   execute "e " . fnameescape(a:file)
210 
211 ruby << RUBY
212   destination = File.expand_path(VIM.evaluate(%{system("dirname " . shellescape(a:file, 1))}))
213   pwd         = File.expand_path(Dir.pwd)
214   home        = pwd == File.expand_path("~")
215 
216   if home || Regexp.new("^" + Regexp.escape(pwd)) !~ destination
217     VIM.command(%{call ChangeDirectory(fnamemodify(a:file, ":h"), 0)})
218   end
219 RUBY
220 endfunction
221 
222 " Define the NERDTree-aware aliases
223 if exists("loaded_nerd_tree")
224   call s:DefineCommand("cd", "ChangeDirectory")
225   call s:DefineCommand("touch", "Touch")
226   call s:DefineCommand("rm", "Remove")
227   call s:DefineCommand("e", "Edit")
228   call s:DefineCommand("mkdir", "Mkdir")
229 endif
230 
231 " Include user's local vim config
232 if filereadable(expand("~/.gvimrc.local"))
233   source ~/.gvimrc.local
234 endif
Proxy Information
Original URL
gemini://r.bdr.sh/git/dotfiles/tree/1eb2f805df7e1af7600565d77a88b2a7ea99ceae/vim/gvimrc
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
583.389233 milliseconds
Gemini-to-HTML Time
0.879979 milliseconds

This content has been proxied by September (3851b).