Advertisement
GlasLarson

функция

Feb 8th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. syntax on
  2. set smartindent
  3. set tabstop=4
  4. set shiftwidth=4
  5. set expandtab
  6. set nobackup
  7. set nowritebackup
  8. set noswapfile
  9. set nu
  10. set autoread
  11. set backspace=eol,start,indent
  12. set whichwrap+=<,>,h,l
  13. set ignorecase
  14. set smartcase
  15. set hlsearch
  16. set incsearch
  17. set mouse=a
  18.  
  19. " Uncomment this if you don't want misspelled words to be highlighted
  20. set spell spelllang=en_us
  21.  
  22. set ai "Auto indent
  23. set si "Smart indent
  24. set wrap "Wrap lines
  25.  
  26. highlight OverLength ctermbg=red ctermfg=white guibg=#592929
  27. match OverLength /\%81v.\+/
  28.  
  29. " Return to last edit position when opening files (You want this!)
  30. autocmd BufReadPost *
  31. \ if line("'\"") > 0 && line("'\"") <= line("$") |
  32. \ exe "normal! g`\"" |
  33. \ endif
  34. " Remember info about open buffers on close
  35. set viminfo^=%
  36.  
  37. """"""""""""""""""""""""""""""
  38. " => Status line
  39. """"""""""""""""""""""""""""""
  40. " Always show the status line
  41. set laststatus=2
  42.  
  43. " Format the status line
  44. set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l
  45.  
  46.  
  47. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  48. " => Helper functions
  49. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  50. function! CmdLine(str)
  51. exe "menu Foo.Bar :" . a:str
  52. emenu Foo.Bar
  53. unmenu Foo
  54. endfunction
  55.  
  56. function! VisualSelection(direction) range
  57. let l:saved_reg = @"
  58. execute "normal! vgvy"
  59.  
  60. let l:pattern = escape(@", '\\/.*$^~[]')
  61. let l:pattern = substitute(l:pattern, "\n$", "", "")
  62.  
  63. if a:direction == 'b'
  64. execute "normal ?" . l:pattern . "^M"
  65. elseif a:direction == 'gv'
  66. call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.')
  67. elseif a:direction == 'replace'
  68. call CmdLine("%s" . '/'. l:pattern . '/')
  69. elseif a:direction == 'f'
  70. execute "normal /" . l:pattern . "^M"
  71. endif
  72.  
  73. let @/ = l:pattern
  74. let @" = l:saved_reg
  75. endfunction
  76.  
  77. " Returns true if paste mode is enabled
  78. function! HasPaste()
  79. if &paste
  80. return 'PASTE MODE '
  81. en
  82. return ''
  83. endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement