Stefan Scherfke avatar Stefan Scherfke committed ba4bb88

Added a few vimrc tweaks and fixed the TrimSpaces function.

Comments (0)

Files changed (1)

   if has('gui_macvim')
     set guifont=Menlo:h13
     set lines=56
+    """ num cols for split view
+    let num_cols=175
     " Tab switching
     nmap <D-A-left> <C-PageUp>
   elseif has('gui_gtk2')
     set guifont=DejaVu\ Sans\ Mono\ 9,Monospace\ 9
     set lines=62
+    """ num cols for split view
+    let num_cols=211
+    map <C-o> :tabnew
+    map <C-t> :tabnew .<cr>
+    map <C-w> :q<cr>
     " copy/paste
     vnoremap <special> <C-x> "+x
     vnoremap <special> <C-c> "+y
     cnoremap <special> <C-c> <C-y>
-    nnoremap <special> <C-v> "+gP
-    inoremap <special> <C-v> <C-R>+
-    cnoremap <special> <C-v> <C-R>+
+    nnoremap <special> <C-v> "+P
+    inoremap <special> <C-v> <C-r>+
+    cnoremap <special> <C-v> <C-r>+
 " jj to exit insert mode
 imap jj <esc>
-map <C-o> :tabnew
-map <C-t> :tabnew .<cr>
-map <C-w> :q<cr>
 " Ctrl-jklm to move between windows
 noremap <C-h> <C-w>h
 noremap <C-j> <C-w>j
 " Create new vertical split and switch over to it
 if has('gui_running')
-    let num_cols=175
-    nnoremap <leader>v :let &columns=num_cols<cr><C-w>v<C-w>l
+  """ num_cols is defined above
+  nnoremap <leader>v :let &columns=num_cols<cr><C-w>v<C-w>l
-    nnoremap <leader>v <C-w>v>C-w>l
+  nnoremap <leader>v <C-w>v>C-w>l
 " open/close the quickfix window
 " Remove trailing spaces
 function! TrimSpaces()
+  " mk: set mark k for the current position, H: go to first on-screen line,
+  " ml: set mark l for this position
+  :norm mkHml
+  " Actual stripping
+  " jump to line l, set this line as first on-screen line, jump to line k
+  :norm `lzt`k
 au FileWritePre * :call TrimSpaces()
 au FileAppendPre * :call TrimSpaces()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.