dotfiles

config files for my linux setup
git clone git://edryd.org/dotfiles
Log | Files | Refs | README

rsi.vim (2186B)


      1 " rsi.vim - Readline style insertion
      2 " Maintainer:   Tim Pope
      3 " Version:      1.0
      4 " GetLatestVimScripts: 4359 1 :AutoInstall: rsi.vim
      5 
      6 if exists("g:loaded_rsi") || v:version < 700 || &cp
      7   finish
      8 endif
      9 let g:loaded_rsi = 1
     10 
     11 set ttimeout
     12 if &ttimeoutlen == -1
     13   set ttimeoutlen=50
     14 endif
     15 
     16 inoremap        <C-A> <C-O>^
     17 inoremap   <C-X><C-A> <C-A>
     18 cnoremap        <C-A> <Home>
     19 cnoremap   <C-X><C-A> <C-A>
     20 
     21 inoremap <expr> <C-B> getline('.')=~'^\s*$'&&col('.')>strlen(getline('.'))?"0\<Lt>C-D>\<Lt>Esc>kJs":"\<Lt>Left>"
     22 cnoremap        <C-B> <Left>
     23 
     24 inoremap <expr> <C-D> col('.')>strlen(getline('.'))?"\<Lt>C-D>":"\<Lt>Del>"
     25 cnoremap <expr> <C-D> getcmdpos()>strlen(getcmdline())?"\<Lt>C-D>":"\<Lt>Del>"
     26 
     27 inoremap <expr> <C-E> col('.')>strlen(getline('.'))<bar><bar>pumvisible()?"\<Lt>C-E>":"\<Lt>End>"
     28 
     29 inoremap <expr> <C-F> col('.')>strlen(getline('.'))?"\<Lt>C-F>":"\<Lt>Right>"
     30 cnoremap <expr> <C-F> getcmdpos()>strlen(getcmdline())?&cedit:"\<Lt>Right>"
     31 
     32 if empty(mapcheck('<C-G>', 'c'))
     33   cmap <script> <C-G> <C-C>
     34 endif
     35 
     36 noremap! <expr> <SID>transposition getcmdpos()>strlen(getcmdline())?"\<Left>":getcmdpos()>1?'':"\<Right>"
     37 noremap! <expr> <SID>transpose "\<BS>\<Right>".matchstr(getcmdline()[0 : getcmdpos()-2], '.$')
     38 cmap   <script> <C-T> <SID>transposition<SID>transpose
     39 
     40 if exists('g:rsi_no_meta')
     41   finish
     42 endif
     43 
     44 if &encoding ==# 'latin1' && has('gui_running') && !empty(findfile('plugin/sensible.vim', escape(&rtp, ' ')))
     45   set encoding=utf-8
     46 endif
     47 
     48 noremap!        <M-b> <S-Left>
     49 noremap!        <M-d> <C-O>dw
     50 cnoremap        <M-d> <S-Right><C-W>
     51 noremap!        <M-BS> <C-W>
     52 noremap!        <M-f> <S-Right>
     53 noremap!        <M-n> <Down>
     54 noremap!        <M-p> <Up>
     55 
     56 if !has("gui_running") && !has('nvim')
     57   silent! exe "set <S-Left>=\<Esc>b"
     58   silent! exe "set <S-Right>=\<Esc>f"
     59   silent! exe "set <F31>=\<Esc>d"
     60   silent! exe "set <F32>=\<Esc>n"
     61   silent! exe "set <F33>=\<Esc>p"
     62   silent! exe "set <F34>=\<Esc>\<C-?>"
     63   silent! exe "set <F35>=\<Esc>\<C-H>"
     64   map! <F31> <M-d>
     65   map! <F32> <M-n>
     66   map! <F33> <M-p>
     67   map! <F34> <M-BS>
     68   map! <F35> <M-BS>
     69   map <F31> <M-d>
     70   map <F32> <M-n>
     71   map <F33> <M-p>
     72   map <F34> <M-BS>
     73   map <F35> <M-BS>
     74 endif
     75 
     76 " vim:set et sw=2: