Migrating from Windows to Linux is no simple task. One of the things that some people complain about is the difficulty of text editing in console mode.

You may or may not know that Notepad.exe is actually pretty damn complicated. Just take a look at all the documented keyboard shortcuts:

New Ctrl+N
Open Ctrl+O
Save Ctrl+Save
Save As Alt, F, A
Page Setup Alt, F, U
Print Ctrl + P
Exit Alt+F4

Undo Ctrl+Z
Cut Ctrl+X
Copy Ctrl+C
Paste Ctrl+P
Delete Del
Find Ctrl+F
Find Next F3
Replace Ctrl+H
Goto Ctrl+G
Select All Ctrl+A
Time/Date F5

Word Wrap Alt, O, W
Font Alt, O, F

Status Bar Alt, V, S

Help Topics F1
About Notepad Alt, H, A

Here are some some undocumented keyboard shortcuts:

Goto Beginning of Next Word: Ctrl+Right Arrow
Goto Beginning Previous Word: Ctrl+Left Arrow

Select From Current Position To Next Word: Ctrl+Shift+Left Arrow
Select From Current Position To Previous Word: Ctrl+Shift+Left Arrow

Select From Current Position to Beginning of Line: Shift+Home
Select From Current Position to End of Line: Shift+End

This list of undocumented keyboard shortcuts for notepad are pretty long, that’s just a start from memory. If you count all the extra undocumented keyboard shortcuts, notepad has tons of functionality that is under utilized.

Did we ever notice or care that notepad had that many shortcuts? Most power users simply knew these shortcut commands by heart and never even had a second thought that notepad was difficult to learn, or poorly documented.

Using the vi editor is not complicated. I think most people just assume at first glance at a huge list of commands that it’s really hard to remember everything. It’s not that hard! Remember how ‘easy to use’ notepad seemed at first? Apply that attitude to learning vi!

The hard part about learning vi is that it doesn’t have a graphical interface for training wheels. You get right dropped right into a window that doesn’t necessarily want to help you get up and running quickly. So here are a few keyboard shortcuts for vi starting from the equivalents for notepad that are listed above:

New vi newfile
Open vi filename
Save :w[Enter]
Save As :w filename[Enter]
Exit :q
Undo u
Cut y
Paste P
Delete d
Find /text
Find Next n
Replace :%s/search/replace/g
Goto :linenumber
Help F1

Here’s where you, my readers come in. I’ve been looking all over, but I just can’t seem to find replacements for the following commands that have similar function without making things difficult:

Copy ?
Select All ?
Time/Date ?
Word Wrap ?
Font ?
Page Setup ?
Print ?

I assume since these were something I couldn’t find really easily that they are probably configuration settings, somewhere, but I’ve been looking for awhile and no luck.

Also, here is a pretty fantastic cheat sheet for vi (or vim) that I’ve found pretty handy:

vi-vim cheat sheet

Enjoy!

Few more announcements: Friday is my birthday, and I’ll be out of town. The the next several days will be pretty quiet. I’ll probably do the 6th edition of Linux Nation tomorrow morning, but that should be all you see from me until Monday, and I’ll be back with a vengeance.

Good news if anyone is keeping up with the times here, girlfriend has been quoted as asking, “can’t we just take off Windows?” Needless to day, that experiment is also going much better than I expected.

Also check out the right sidebar, Atlas carrying the Firefox icon was an idea I came up with, it was all done using Inkscape and GIMP. Let me know what you think of it. If you’re too lazy to scroll up, here it is:

atlas with firefox

See ya next week,
-Wayne

Are you interested in FREE SUBSCRIPTIONS for qualified professionals to eWeek, PC Magazine, PC World, and many more? Click here!

Tags: ,


15 Comments to “notepad.exe vs vi: Which Is More Difficult To Learn? The Answer Isn’t Quite What You Expect.”

  1. Adam | October 17th, 2007 at 10:13 pm

    Here’s the vi cheatsheet that got me through some MSCS classes at Marquette:

    http://www.mscs.mu.edu/mscs/resources/vi_commands.html

    -Adam

  2. Binny V A | October 17th, 2007 at 11:41 pm

    If your are coming to Linux from Windows, vi is probably not the best idea. Try something like gEdit or Kate.

  3. Wayne | October 18th, 2007 at 12:57 am

    kate and gedit are not installed on every system though. vi is on all unix based systems.

  4. Slack User | October 18th, 2007 at 8:54 am

    I’m personally a nano fan, and what drives me nuts about vi is it’s command modes. I press a shortcut in one mode and it inputs something, I press it in another and it deletes a line. Honestly, I find myself using :!q more than any other command in vi. I’d rather echo data to a file than mess with vi.

    But I find notepad simple because it simply works as you would expect it to. The same applies for nano (or pico). DOS uses edit and the shortcuts are a bit different but it’s not like a new language like how vi works. kedit is the GUI editor I prefer without any prior bias. but kate is just as good if not better with it’s syntax coding. Oh also for windows I really enjoy textpad (a free download) it has blcok select mode!

  5. Wayne | October 18th, 2007 at 10:49 am

    notepad++ is a nice free alternative to shareware

  6. Steve | October 19th, 2007 at 5:11 pm

    Your command for cut in vi is wrong. Cut is c, copy is y (it’s short for ‘yank’). p is paste below the cursor (I seem to remember) and P (capital P) is paste above cursor…or possibly vice versa. I’m not in a place I can test it.

  7. Spence | October 21st, 2007 at 9:26 pm

    To “select all” (press keys in this order)
    gg_vG$

    gg -> front of file
    _ -> beginning of line
    v -> visual (starts select)
    G -> end of file
    $ -> end of line

    To copy - depends on what your copying

    yy -> copy entire line
    y$ -> … to end of line
    y5 [down key] -> … following 5 lines
    .. etc

    You may also just want to just bind keys (make a new file - or append this to ~/.vimrc):

    map gg_vG$

    try pressing ctrl+a inside an opened file now…

  8. Spence | October 21st, 2007 at 9:31 pm

    Bleh.. the above mapping was missing something (maybe this will work

    map gg_vG$

    (without the space between the

  9. Spence | October 21st, 2007 at 9:34 pm

    grr…

    map <C-a> gg_vG$

    Edit: Wayne at Oct 21 10:45 pm
    Fixed it… ampersand lt(or gt) followed by semicolon did the trick.

  10. Wayne | October 21st, 2007 at 9:43 pm

    That’s annoying… hmm > <

  11. lelutin | October 23rd, 2007 at 11:45 pm

    If you’re using Vim, you can also press v to select a region of text and y to copy the region. pressing V has a similar effect but for entire lines and Ctrl+v selects a block of text (very useful to insert the same text on every line by pressing I and then typing. and also very powerful if used with a filtering command: with a block of text selected, press ! and type a “filter” command like ’sed’ with arguments. this way you can easily make complex modifications on a small subset of your text)

  12. Wayne | October 24th, 2007 at 1:07 am

    Great tip lelutin!

  13. vi keyboard cheatsheet « Ubuntu Life | March 17th, 2008 at 4:29 am

    [...] Enlace | Notepad vs vi [...]

  14. cimo | March 27th, 2008 at 3:36 am

    ggVG -> Select All
    :%y* -> copy all lines to system clipboard

  15. Ronald Duncan | July 20th, 2008 at 4:34 am

    Sorry angle brackets got removed to leave
    :,s which is junk.

    With the ex commands it is :lineno,linenoCommand

    e.g.
    search
    :5,8s/findit/replace/
    or
    All lines are
    :%s/findit/replace

    using g (global) to delete all matching lines
    :%g/findit/d
    or to yank all matching lines
    :%g/findit/y

    There is one area where vi is better than vim and that is on very large files. vi does not try and load the file it just takes the first small section, so it is very fast at editing massive files.

Leave a Comment