Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I made the switch to vim in 2003, maybe 2004 for its syntax highlighting. The last step was figuring out how to do cut and paste longer than a single line at a time (dd, p).

During the transition, I would close the file in vim, open it in nano for block moves, then return to vim. I called a friend who introduced me to my first shell and he helped me break my nano habit (except for a rare machine I've encountered where the J command did not work to kill the \n at the end of a line). He introduced me to markers. The m key will set a marker, named after the next letter you feed it. Go to the start of your block you want to move, type `ma`. Then move to the end of your block and use `d'a` and it will delete from the current position back to the marker you set. Move the cursor again and use the `p` key to paste your block where you want it.

I found this far less annoying than using `dd` and `p` to move one line at a time.

From a combination of nodes here, the vim website and elsewhere, I have now accumulated the following .vimrc file which creates a useful development environment for me. The first thing I do after being given shell access to a new server, right after changing my password, is to scp my .vimrc from my usual servers to the new environment.

My .vimrc follows:

set wrapmargin=1 "source /usr/share/vim/current/syntax/html.vim" syntax on set vb set sw=2 set autoindent set number set tw=71 set mouse=a map # :%s/./>&/ map @ 1G!Gcloak^M3Gdj map J {!}fmt -65^M}j set noautoindent set undolevels=1 set noerrorbells set bg=light " set bg=dark set wildchar=<tab></tab> let perl_include_pod = 1 let perl_extended_vars = 1 " check perl code with :make autocmd FileType perl set makeprg=perl\ -c\ %\ $* autocmd FileType perl set errorformat=%f:%l:%m autocmd FileType perl set autowrite au BufRead,BufNewFile *.t set filetype=perl | compiler perlprove " This is for taglist " let Tlist_Inc_Winwidth = 0 " map <F3> :Tlist<CR>
I write nearly everything in vim these days, love letters, code, memos, reports. Between vim and mailx (catdoc, antiword, xpdf's pdftotext and munpack) I rarely need to leave a console. Perhaps a couple of times a month I'll open Abiword or OpenOffice to "pretty up" a document for printing. But I also once wrote a perl script to massage a plain text press release thorugh LaTeX into a pdf file, so I didn't have to open a gui editor just to distribute a press release (something I had to do several times a week in a previous job).

When I introduce new folks to a linux environment, as I'm telling them not to fear the shell prompt, I urge them to learn a text editor. I tell them that nano may be more intuitive and easier to learn (with its on screen menu), but that vim is far more powerful, that if they spend any time writing (as I do) that they will appreciate having mounted the learning curve.

By now I am so attuned to working in vim, that I sometimes find spurious :wq or i's in my documents composed in other editors or on webforms like this one.

-- Hugh

:wq

if( $lal && $lol ) { $life++; }

In reply to Re: Learn vi/vim in 50 lines and 15 minutes by hesco
in thread Learn vi/vim in 50 lines and 15 minutes by tachyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-29 08:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found