dotfiles

My collection of dotfiles
git clone git://git.stellar-nexus.ru/dotfiles
Log | Files | Refs

vimrc (8437B)


      1 scriptencoding utf-8
      2 " ^^ Please leave the above line at the start of the file.
      3 
      4 " Default configuration file for Vim
      5 
      6 " Written by Aron Griffis <agriffis@gentoo.org>
      7 " Modified by Ryan Phillips <rphillips@gentoo.org>
      8 " Modified some more by Ciaran McCreesh <ciaranm@gentoo.org>
      9 " Added Redhat's vimrc info by Seemant Kulleen <seemant@gentoo.org>
     10 
     11 " You can override any of these settings on a global basis via the
     12 " "/etc/vim/vimrc.local" file, and on a per-user basis via "~/.vimrc". You may
     13 " need to create these.
     14 
     15 " {{{ General settings
     16 " The following are some sensible defaults for Vim for most users.
     17 " We attempt to change as little as possible from Vim's defaults,
     18 " deviating only where it makes sense
     19 set nocompatible        " Use Vim defaults (much better!)
     20 set bs=2                " Allow backspacing over everything in insert mode
     21 set ai                  " Always set auto-indenting on
     22 set history=50          " keep 50 lines of command history
     23 set ruler               " Show the cursor position all the time
     24 
     25 set viminfo='20,\"500   " Keep a .viminfo file.
     26 
     27 " Don't use Ex mode, use Q for formatting
     28 map Q gq
     29 
     30 " When doing tab completion, give the following files lower priority. You may
     31 " wish to set 'wildignore' to completely ignore files, and 'wildmenu' to enable
     32 " enhanced tab completion. These can be done in the user vimrc file.
     33 set suffixes+=.info,.aux,.log,.dvi,.bbl,.out,.o,.lo
     34 
     35 " When displaying line numbers, don't use an annoyingly wide number column. This
     36 " doesn't enable line numbers -- :set number will do that. The value given is a
     37 " minimum width to use for the number column, not a fixed size.
     38 if v:version >= 700
     39   set numberwidth=3
     40 endif
     41 " }}}
     42 
     43 " {{{ Modeline settings
     44 " We don't allow modelines by default. See bug #14088 and bug #73715.
     45 " If you're not concerned about these, you can enable them on a per-user
     46 " basis by adding "set modeline" to your ~/.vimrc file.
     47 set nomodeline
     48 " }}}
     49 
     50 " {{{ Locale settings
     51 " Try to come up with some nice sane GUI fonts. Also try to set a sensible
     52 " value for fileencodings based upon locale. These can all be overridden in
     53 " the user vimrc file.
     54 if v:lang =~? "^ko"
     55   set fileencodings=euc-kr
     56   set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-*
     57 elseif v:lang =~? "^ja_JP"
     58   set fileencodings=euc-jp
     59   set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*
     60 elseif v:lang =~? "^zh_TW"
     61   set fileencodings=big5
     62   set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0
     63 elseif v:lang =~? "^zh_CN"
     64   set fileencodings=gb2312
     65   set guifontset=*-r-*
     66 endif
     67 
     68 " If we have a BOM, always honour that rather than trying to guess.
     69 if &fileencodings !~? "ucs-bom"
     70   set fileencodings^=ucs-bom
     71 endif
     72 
     73 " Always check for UTF-8 when trying to determine encodings.
     74 if &fileencodings !~? "utf-8"
     75   " If we have to add this, the default encoding is not Unicode.
     76   " We use this fact later to revert to the default encoding in plaintext/empty
     77   " files.
     78   let g:added_fenc_utf8 = 1
     79   set fileencodings+=utf-8
     80 endif
     81 
     82 " Make sure we have a sane fallback for encoding detection
     83 if &fileencodings !~? "default"
     84   set fileencodings+=default
     85 endif
     86 " }}}
     87 
     88 " {{{ Syntax highlighting settings
     89 " Switch syntax highlighting on, when the terminal has colors
     90 " Also switch on highlighting the last used search pattern.
     91 if &t_Co > 2 || has("gui_running")
     92   syntax on
     93   set hlsearch
     94 endif
     95 " }}}
     96 
     97 " {{{ Terminal fixes
     98 if &term ==? "xterm"
     99   set t_Sb=^[4%dm
    100   set t_Sf=^[3%dm
    101   set ttymouse=xterm2
    102 endif
    103 
    104 if &term ==? "gnome" && has("eval")
    105   " Set useful keys that vim doesn't discover via termcap but are in the
    106   " builtin xterm termcap. See bug #122562. We use exec to avoid having to
    107   " include raw escapes in the file.
    108   exec "set <C-Left>=\eO5D"
    109   exec "set <C-Right>=\eO5C"
    110 endif
    111 " }}}
    112 
    113 " {{{ Filetype plugin settings
    114 " Enable plugin-provided filetype settings, but only if the ftplugin
    115 " directory exists (which it won't on livecds, for example).
    116 if isdirectory(expand("$VIMRUNTIME/ftplugin"))
    117   filetype plugin on
    118 
    119   " Uncomment the next line (or copy to your ~/.vimrc) for plugin-provided
    120   " indent settings. Some people don't like these, so we won't turn them on by
    121   " default.
    122   " filetype indent on
    123 endif
    124 " }}}
    125 
    126 " {{{ Fix &shell, see bug #101665.
    127 if "" == &shell
    128   if executable("/bin/bash")
    129     set shell=/bin/bash
    130   elseif executable("/bin/sh")
    131     set shell=/bin/sh
    132   endif
    133 endif
    134 "}}}
    135 
    136 " {{{ Our default /bin/sh is bash, not ksh, so syntax highlighting for .sh
    137 " files should default to bash. See :help sh-syntax and bug #101819.
    138 if has("eval")
    139   let is_bash=1
    140 endif
    141 " }}}
    142 
    143 " {{{ Autocommands
    144 if has("autocmd")
    145 
    146 " let @b='ggVG:norm$bd2bhhda]hx'
    147 
    148 let @a='S(v%:norm A i  26to33? )lv%:s/  //g$?( :wlvggd/ )vG$da ):w! /tmp/alp:open!ndi(h2xik!!/home/plat/scripts/vima.shinoNvjdi 26to3326to3 3:%s/26to33//g:%s/26to3 3//g'
    149 let @s='S(v%:norm A i  26to33? )lv%:s/  //g$?( :wlvggd/ )vG$da ):w! /tmp/smol:open!ndi(h2xik!!/home/plat/scripts/vims.shinoNvjdi 26to3326to3 3:%s/26to33//g:%s/26to3 3//g'
    150 let @b='S(v%:norm A i  26to33? )lv%:s/  //g$?( :wlvggd/ )vG$da ):w! /tmp/beeg:open!ndi(h2xik!!/home/plat/scripts/vimb.shinoNvjdi 26to3326to3 3:%s/26to33//g:%s/26to3 3//g'
    151 let @c='y:wGopk$dgg:w! /tmp/vimclip:!xclip -sel c /tmp/vimclip:open!'
    152 
    153 " mutt: insert attachment
    154 fun! RangerMuttAttach()
    155     silent !ranger --choosefile=/tmp/chosenfile
    156     if filereadable('/tmp/chosenfile')
    157     exec 'read /tmp/chosenfile'
    158         call system('rm /tmp/chosenfile')
    159     endif
    160     redraw!
    161 endfun
    162 map <C-a> magg/Reply-To<CR><ESC>:call RangerMuttAttach()<CR>IAttach: <ESC>`a
    163 
    164 augroup gentoo
    165   au!
    166 
    167   " Gentoo-specific settings for ebuilds.  These are the federally-mandated
    168   " required tab settings.  See the following for more information:
    169   " http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml
    170   " Note that the rules below are very minimal and don't cover everything.
    171   " Better to emerge app-vim/gentoo-syntax, which provides full syntax,
    172   " filetype and indent settings for all things Gentoo.
    173   au BufRead,BufNewFile *.e{build,class} let is_bash=1|setfiletype sh
    174   au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab
    175 
    176   " In text files, limit the width of text to 78 characters, but be careful
    177   " that we don't override the user's setting.
    178   autocmd BufNewFile,BufRead *.txt
    179         \ if &tw == 0 && ! exists("g:leave_my_textwidth_alone") |
    180         \     setlocal textwidth=78 |
    181         \ endif
    182 
    183   " When editing a file, always jump to the last cursor position
    184   autocmd BufReadPost *
    185         \ if ! exists("g:leave_my_cursor_position_alone") |
    186         \     if line("'\"") > 0 && line ("'\"") <= line("$") |
    187         \         exe "normal! g'\"" |
    188         \     endif |
    189         \ endif
    190 
    191   " When editing a crontab file, set backupcopy to yes rather than auto. See
    192   " :help crontab and bug #53437.
    193   autocmd FileType crontab set backupcopy=yes
    194 
    195   " If we previously detected that the default encoding is not UTF-8
    196   " (g:added_fenc_utf8), assume that a file with only ASCII characters (or no
    197   " characters at all) isn't a Unicode file, but is in the default encoding.
    198   " Except of course if a byte-order mark is in effect.
    199   autocmd BufReadPost *
    200         \ if exists("g:added_fenc_utf8") && &fileencoding == "utf-8" && 
    201         \    ! &bomb && search('[\x80-\xFF]','nw') == 0 && &modifiable |
    202         \       set fileencoding= |
    203         \ endif
    204 
    205 augroup END
    206 
    207 endif " has("autocmd")
    208 " }}}
    209 
    210 " We don't want VIM to load their own built-in defaults, preferring ours here
    211 " instead. This option cannot apply to minimal builds, so it is guarded by a
    212 " test that's guaranteed to fail for those, owing to the lack of +eval.
    213 if 1
    214   let g:skip_defaults_vim = 1
    215 endif
    216 
    217 " Enable Omni completion when opening a file only if a specific plugin does
    218 " not already exist for that filetype. This allows Omni completion
    219 " (Ctrl-x/Ctrl-o) to work with any programming language if and only if a syntax
    220 " file exists for the said language.
    221 if exists("+omnifunc")
    222    autocmd Filetype *
    223 	      \	if &omnifunc == "" |
    224 	      \		setlocal omnifunc=syntaxcomplete#Complete |
    225 	      \	endif
    226 endif
    227 
    228 " {{{ vimrc.local
    229 if filereadable("/etc/vim/vimrc.local")
    230   source /etc/vim/vimrc.local
    231 endif
    232 " }}}
    233 
    234 " vim: set fenc=utf-8 tw=80 sw=2 sts=2 et foldmethod=marker :
    235 
    236 let &t_BE = "\[?2004h"
    237 let &t_BD = "\[?2004l"
    238 let &t_PS = "\[200~"
    239 let &t_PE = "\[201~"