Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Guide to VIM

  • 08-07-2009 3:05pm
    #1
    Posts: 5,589 ✭✭✭


    Anyone have any good guides to using vim?

    It would be for doing out tex docs and I am getting tired of emacs..


Comments

  • Registered Users, Registered Users 2 Posts: 2,534 ✭✭✭FruitLover


    Within VIM, type:

    :help<enter>


  • Posts: 5,589 ✭✭✭ [Deleted User]


    The help is confusing, or else I am starting at the wrong parts..


  • Registered Users, Registered Users 2 Posts: 1,110 ✭✭✭Skrynesaver


    this is the obvious starting point

    And as it says at the end open vimtutor and familiarise yourself with it that way, after that, learning to write macros in your .exrc this site provides some useful instructions/examples


  • Registered Users, Registered Users 2 Posts: 545 ✭✭✭ravydavygravy


    Most vi cheat sheets you find are waaay to complicated, detailing dozens commands you'll never use or need.

    Heres a fairly concise one: http://www.artweb-design.de/images/blog/posts/vim.cheatsheet.jpg

    My personal list of most used vi(m) commands:
    arrow keys        == moving around  
    i                 == enter input mode (enter text)
    esc               == go back to command mode (enter commands)
    :q!               == quit and don't save
    :wq               == quit and save
    
    :0                == Goto line 0 (start of file - also :145 == goto line 145) 
    G                 == Goto last line of file
    Ctrl-G            == show me current line number
    
    yy                == copy current line to buffer 
    dd                == cut current line to buffer 
    p                 == paste buffer here
    x                 == delete current character
    
    :g/abc/s//def/g   == Globally, where you find 'abc', substitute 'def'
    :s/abc/def/g      == On current line, substitute all 'abc' with 'def'
    :s/abc/def/       == On current line, substitute first 'abc' with 'def' 
    
    /abc              == find & highlight next occurrance of 'abc'
    ?abc              == find & highlight previous occurrance of 'abc'
    n                 == move highlight to next occurance of pattern
    
    J                 == join this line to next line (make one line)
    
    .                 == repeat previous command
    

    Thats pretty much all I've needed for the last ~10 years of perl, shell and php coding... Theres lots of other cool stuff, but that'll be what you use most...


Advertisement