Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #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


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

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (7)
    As of 2021-04-19 10:37 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found