Advertisement
Guest User

Untitled

a guest
Feb 5th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 2.33 KB | None | 0 0
  1. set t_Co=256
  2. let g:debuggerPort = 62343
  3. syntax enable
  4. "set background=dark
  5. " Highlight trailing whitespace and tabs
  6. colorscheme molokai
  7. highlight TrailingSpaces ctermbg=yellow
  8. match TrailingSpaces /\s\+$\| \+$\|\t\+$/
  9. set number
  10.  
  11. highlight ExtraWhitespace ctermbg=yellow guibg=yellow
  12. match ExtraWhitespace /\s\+$/
  13.  
  14. autocmd FileType c,cpp,java,php,ruby,python,perl,yaml autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
  15.  
  16. " Set the leader key
  17. let mapleader = ","
  18.  
  19. " Map w!! to write file with sudo, when forgot to open with sudo.
  20. cmap w!! w !sudo tee % >/dev/null
  21.  
  22. " Map F1 to Esc. Safe to remove if not desirable.
  23. inoremap <F1> <ESC>
  24. nnoremap <F1> <ESC>
  25. vnoremap <F1> <ESC>
  26.  
  27. " Display a place holder character for tabs and trailing spaces
  28. " set list
  29. " set listchars=trail:⋅,nbsp:⋅,tab:▷⋅
  30.  
  31. " Enable plugins and indentation based on filetype
  32. filetype plugin indent on
  33.  
  34. " Enable filetype detection
  35. setlocal foldmethod=indent
  36. setlocal nofoldenable
  37. setlocal foldlevel=1
  38. setlocal foldnestmax=10
  39.  
  40. " Remove highlighting search results
  41. nnoremap <leader><space> :noh <CR>
  42.  
  43. " Set the keys to turn spell checking on/off
  44. map <F8> <Esc>:setlocal spell spelllang=en_us<CR>
  45. map <F9> <Esc>:setlocal nospell<CR>
  46.  
  47. " Set the key to toggle NERDTree
  48. nnoremap <leader>d :NERDTreeToggle<cr>
  49.  
  50. " set Enter/Return to activate a node
  51. let NERDTreeMapActivateNode='<CR>'
  52. let NERDTreeShowHidden=1
  53.  
  54. function! Smart_TabComplete()
  55.         let line = getline('.')
  56.         let substr = strpart(line, -1, col('.')+1)
  57.         let substr = matchstr(substr, "[^ \t]*$")
  58.  
  59.         if(col('.')==1)
  60.                 return "\<tab>"
  61.         endif
  62.  
  63.         if (strlen(substr)==0)
  64.                 return "\<tab>"
  65.         endif
  66.  
  67.         let has_period = match(substr, '\.') != -1
  68.         let has_slash = match(substr, '\/') != -1
  69.  
  70.         if (!has_period && !has_slash)
  71.                 return "\<C-X>\<C-P>"
  72.         elseif ( has_slash )
  73.                 return "\<C-X>\<C-F>"
  74.         else
  75.                 return "\<C-X>\<C-O>"
  76. endfunction
  77.  
  78. " inoremap <tab> <c-r>=Smart_TabComplete()<CR>
  79.  
  80. function! <SID>StripTrailingWhitespaces()
  81.         let _s=@/
  82.         let l = line(".")
  83.         let c = col(".")
  84.         %s/\s\+$//e
  85.         let @/=_s
  86.         call cursor(l, c)
  87. endfunction
  88.  
  89. set pastetoggle=<F2>
  90. set ignorecase
  91. set smartcase
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement