Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Desparately seeking a bilingual vim/Emacs expert

by jmcnamara (Monsignor)
on Mar 23, 2005 at 09:22 UTC ( #441715=note: print w/ replies, xml ) Need Help??


in reply to Desparately seeking a bilingual vim/Emacs expert


Here is a minimal usable .emacs file for Perl programming.

;; Use cperl mode instead of the default perl mode (defalias 'perl-mode 'cperl-mode) ;; Turn syntax highlighting on (global-font-lock-mode 1) ;; 4 space indent in cperl mode (setq cperl-indent-level 4) ;; Insert spaces instead of tabs (setq-default indent-tabs-mode nil)

It is better to use Ilya's cperl mode than the default perl mode. The syntax highlighting is optional but recommended. The last two commands set the indent level and the tab expansion. Combined with cperl mode these replicate the vi tab stop behaviour.

It may also be worth adding a link to the Emacs Wiki which is a great source of information.

--
John.


Comment on Re: Desparately seeking a bilingual vim/Emacs expert
Download Code
Re^2: Desparately seeking a bilingual vim/Emacs expert
by barrachois (Pilgrim) on Mar 24, 2005 at 19:50 UTC
    Yes, I agree that cperl is the right mode to use. I use it daily in XEmacs.

    I've also been using mmm-mode regularly to edit HTML::Mason files, with the mode (and syntax highlighting and background) changing between blocks of html and perl.

    I also like your brief version of the tab definitions. However, while I'm not sure exactly what the tab key does in vim perl, cperl's default tab definition took me a bit of getting used to - particularly in that by default hitting tab at the end of a line indents the whole line appropriately instead of moving to the righ to get ready for a comment.

    It might be worth noting that

    (setq-default cperl-tab-always-indent nil)
    tells cperl that tab means indent when the cursor is to the left of the text, otherwise it means "insert-tab" - though I believe that's still different from the shift-tab defined as "tab-to-tab-stop" which I use more often.

    As far as Damian's named macros for inserting a specific chunk of text or loading a specific template, I'd suggest something like the following.

    ; A named function to insert some specific text. (defun my-insert-stuff () "documentation string" (interactive "*") ; "*" => error if read-only (insert "This is the text to insert. ") ) ; Set it to a specific keystroke combo. (global-set-key [(control c) m] 'my-insert-stuff) ; Load a specific template in a new unattached buffer. (defun template-one () "documentation string" ; For help and info. (interactive) ; Make this user accessible. (switch-to-buffer "template-one") (insert-file "~/template_one") ) ; It too could be set to some specific key combination. (global-set-key [(control c) o] 'template-one)
    Finally, you might be amused by these definitions. for », «, ¥
    ;;; ---- some "unicode" perl6 stuff ;; The numeric codes are base 10 from iso-8869-1. ;; Keys are control-c followed by control-(>, <, y), ;; without the shift key (global-set-key [(control c) (control ?.)] '(lambda () (interactive "*") (insert 187))) (global-set-key [(control c) (control ?,)] '(lambda () (interactive "*") (insert 171))) (global-set-key [(control c) (control ?y)] '(lambda () (interactive "*") (insert 165)))

    Regards,

    Jim Mahoney

    update: fixed a typo; "control" not "crontol"

      That's exactly what I was looking for. Thank-you, Jim!

      And yes, I'm sure those non-ASCII set-keys will come in very handy later this year! Damian

      (Deleted. Duplicate.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://441715]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2014-09-19 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls