home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / share / elvis-2.2_0 / scripts / likevim.ex < prev    next >
Encoding:
Text File  |  2004-02-22  |  2.2 KB  |  90 lines

  1. " This file creates some aliases and maps that make elvis work more like vim
  2.  
  3. " Some variations of the :map and :unmap commands
  4. alias nmap    map command
  5. alias nm    map command
  6. alias vmap    map select
  7. alias vm    map select
  8. alias omap    map motion
  9. alias om    map motion
  10. alias imap    map input
  11. alias im    map input
  12. alias cmap    map history
  13. alias cm    map history
  14. alias noremap    map!? noremap
  15. alias nore    map!? noremap
  16. alias nnoremap    map noremap command
  17. alias nn    map noremap command
  18. alias vnoremap    map noremap select
  19. alias vn    map noremap select
  20. alias inoremap    map noremap input
  21. alias ino    map noremap input
  22. alias cnoremap    map noremap history
  23. alias cno    map noremap history
  24. alias nunmap    unmap command
  25. alias nun    unmap command
  26. alias vunmap    unmap select
  27. alias vu    unmap select
  28. alias ounmap    unmap motion
  29. alias ou    unmap motion
  30. alias iunmap    unmap input
  31. alias iu    unmap unput
  32. alias cunmap    unmap history
  33. alias cu    unmap history
  34.  
  35. " Some redundant commands that work on visibly selected text
  36. map noremap select r    g=
  37. map noremap select x    d
  38. map noremap select U    noremap gU
  39. map noremap select u    noremap gu
  40. map noremap select ~    noremap g~
  41. map noremap select J    :j
  42. map noremap select     y:ta 
  43. map noremap select o    g%
  44. map noremap select O    g
  45. "map noremap select R    S     ... except that "vS" isn't implemented yet
  46.  
  47. " Some 'g' commands that aren't built in to elvis
  48. map g#        yiw??w
  49. map g*        yiw//w
  50. map gf        :eval find (current(/[^[:space:]<>"]*/))
  51. map gm        :eval normal (columns/2+1;char(124))
  52. map go        
  53.  
  54. " Some '^W" commands that aren't built in to elvis
  55. map f        :eval sfind (current(/[^[:space:]<>"]*/))
  56.  
  57. " A few miscellaneous vim commands
  58. alias find {
  59.  " Locate a file in 'includepath', and then edit it
  60.  local elvispath f
  61.  if "!*" == ""
  62.  then error cursor not on file name
  63.  let elvispath=includepath
  64.  let f=elvispath("!*")
  65.  if f == ""
  66.  then error "!*" not found in includepath
  67.  else e!? (f)
  68. }
  69. alias fin find
  70. alias sfind {
  71.  " Locate a file in 'includepath', and then split it
  72.  local elvispath f
  73.  if "!*" == ""
  74.  then error cursor not on file name
  75.  let elvispath=includepath
  76.  let f=elvispath("!*")
  77.  if f == ""
  78.  then error "!*" not found in includepath
  79.  else sp (f)
  80. }
  81. alias sf sfind
  82. alias sview split +"se ro"
  83. alias sv sview
  84. alias update {
  85.  " Write a file, but only if modified
  86.  if modified
  87.  then !%write!? !*
  88. }
  89. alias up !%update!?
  90.