Firewalls posts about Editors got me to thinking. What are the coolest tricks you use with your editors? Like any vi tricks, emacs tricks, heck any 'edit' tricks? Anything that if you had to switch editors, the new editor would HAVE to be able to perform?
For me I run Linux and I'm a huge fan of vi's pattern matching.
Out,
Macphist0
Everyone has their demons....
RE: Editor tricks.
by clemburg (Curate) on Sep 30, 2000 at 16:41 UTC
|
Some of the things I do regularly:
- vi/emacs: filter parts of the edit buffer through commands (perl
one liners, tools like fmt(1), specialized little tools for
building indexes, cross-references, and the like ...)
- vi/emacs: map a key to the compile command (or the respective
vi macro) to run Makefile entries that do compilation, testing,
publishing to web sites, ...
- emacs: use the shell mode to record all your activities,
e.g., when working as root on other's machines, or when doing
a new installation routine, ...
- vi/emacs: make the editor put in templates for common tasks
- vim/emacs: develop your own, intelligent (for you) syntax colouring scheme
- emacs: use the editor as shell substitution on platforms where
you have no convenient shell (command line history, ...)
Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com
| [reply] |
RE: Editor tricks.
by t0mas (Priest) on Sep 29, 2000 at 17:01 UTC
|
Don't know how cool it is, but my .gvimrc is now full of snippets I've picked up form PM, like:
inoremap <C-P>slurp @array=do{local @ARGV=$file;<>};<CR>
giving me a file eater at Ctrl+P slurp. Power at your fingertips...
/brother t0mas
| [reply] [d/l] |
Re: Editor tricks.
by stefan k (Curate) on Jul 26, 2002 at 06:52 UTC
|
Hi,
can't believe this thread slipped me for so long...
Well, after some 6 years in (X)emacs and with a configuration of some 4000 lines of elisp I must have configured my XEmacs (almost) exactly to my needs. What is it that makes this so powerfull for me?
- dabbrev (defaults to M-/): dynamic abbreviations which lets you pick the really long but insightful variable names because you don't have to type them anymore.
- M-x locate so you'll never do the locate in xterm and mark the filename with the mouse again (later pasting that filename into XEmacs anyway)
- speedbar one of the finest tools for navigation in large projects I've ever come across
- desktop for re-opening all the files on the next day
- active-menu.el (see the website) for one more line of code
- function-menu for another navigation mechanism which works only in the current buffer (a buffer is usually a representation of a file in the editor)
- saveplace to find myself at exactly the cursor position as the last time I opened that file
- cperl auto help shows a short syntactic information; good if it has been a while since your last perl programm
- and thousands of other things that don't spring to my mind in this moment
Have fun!
Regards... |
Stefan
|
you begin bashing the string with a +42 regexp of confusion
|
| [reply] [d/l] [select] |
RE: Editor tricks.
by runrig (Abbot) on Sep 29, 2000 at 22:53 UTC
|
My favorite thing with vi is that I've set up the F1 and F3 keys so that if I have a block like this:
{#
select something
from sometable
where something="some_value"
#}
If I hit F1 while in the block, it pipes the contents of the block to sqlplus (Oracle SQL tool, it used to go to dbaccess, the Informix SQL tool), and creates a block below the current block with the results. That way I can edit any sql with vi, and all queries and results are immediately saved (temporarily at least in the current vi session).
I have F3 set up to delete the block after the current block, so it makes for quick edit/execute/edit/execute cycles until I like the result.
On any WinPC I'm forced to use, I usually install vim, because I can't stand Notepad. Though I've never implemented the above sort of system from a PC. | [reply] |
RE: Editor tricks.
by Corion (Patriarch) on Sep 29, 2000 at 17:22 UTC
|
First of all, an editor needs a clipboard. I've learned
the necessary tricks for Windows, pico and vi :
- For Windows, it's CTRL-C, CTRL-V and CTRL-X
- For pico, it's CTRL-K to erase a line and CTRL-U to paste a set of lines
- For vi, it's dd to erase a line and p to paste it.
The second nice-to-have thing is the ability to replay
keystrokes. pico has no such capability,
vi has limited capability by prefixing the number
of repetitions to a single command, and the Borland IDEs
and proton have that capability.
notepad lacks that capability. D'oh.
Syntax highlighting is nice eye-candy that helps immensely
when doing some TeX stuff. Both, proton and nedit
do that.
Being able to read (and maybe write) both, Unix and DOS
line endings is a sure plus, but not really necessary,
as I can convert stuff using Perl anyway.
| [reply] |
|
vi and emacs both have named registers that you can use to
store and recall text. I don't know how to use vi but I know
they're there.
- emacs does really beautiful rectangle cuts and pastes.
- emacs does cuts, copies and appends to regisers.
- emacs does cuts copies and appends to other buffers.
- emacs lets you treat a register as a variable that
you can increment and decremt and use it's value in
keyboard macros.
- emacs lets you write extra functions in lisp (if you
want to)
- emacs lets you record
keyboard macros. either one time quick hacks or you can
name them and bind them to a key. just for this session or
make them permenant.
emacs does lots of other wonderful things that I can't/haven't
figured out how to do in vi.
emacs figures out the line ending and uses it transparently,
if it gets it wrong you can override it.
Nuance
| [reply] |
|
nuance: "vi and emacs both have named registers that you can use to
store and recall text. I don't know how to use vi but I
know they're there."
Hitting the double quote in command mode tells vi that the
next letter you enter is going to be the name of the
buffer that you'll be refering to. For instance:
"aD
will cut everything from the cursor to the end of the line,
and throw it in buffer a. To paste it in again, you'd
say:
"ap
The :map command binds a key to a macro... like so:
:map q xp
which will make the q key cut the letter the cursor's
presently on and paste it after the next one, effectively
transposing them.
Some of the other things you mention make me think. It's
about time I went back and learned some more stuff, to
make my editing more pleasant. It's easy to just roll
along after a certain point, using what you know.
| [reply] |
(Dermot) RE: Editor tricks.
by Dermot (Scribe) on Sep 29, 2000 at 17:53 UTC
|
In Emacs or XEmacs, M-q is fill-paragraph-or-region. It
properly formats the current paragraph. You live without
it, you learn it. Suddenly, you can't live without it. | [reply] |
A reply falls below the community's threshold of quality. You may see it by logging in. |
|
|