Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jul 2009 06:32:32 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Steve Bertrand <steve@ibctech.ca>
Cc:        "questions@freebsd.org" <questions@freebsd.org>
Subject:   Re: A question for developers
Message-ID:  <871vo4p19r.fsf@kobe.laptop>
In-Reply-To: <4A6A72A6.1030009@ibctech.ca> (Steve Bertrand's message of "Fri,  24 Jul 2009 22:49:10 -0400")
References:  <4A6A72A6.1030009@ibctech.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=

On Fri, 24 Jul 2009 22:49:10 -0400, Steve Bertrand <steve@ibctech.ca> wrote:
> Forgive the verbosity.
>
> Before anything else, I'd appreciate it if my requirements were actually
> read before providing any feedback. I know that there are qualified
> persons here to legitimately answer my question, so if a flame war does
> ensue, I ask that you refrain from responding.
>
> I'm looking for a new editor.
>
> I continue to claim that I am not a programmer, but I'm getting to the
> point where my current editor can not do what I need it to do for the
> programming I have been doing (90% Perl, a bit of C and the rest is
> shell/awk stuff if you want to call that programming).
>
> Currently, I use "ee". The ONLY reason I have outgrown it, is due to the
> fact that I can't find an easy way to change my \t to four chars instead
> of eight.

Both editors/vim and editors/emacs can do what you describe and a *LOT*
more.  You should at least try them for a while and see which one of the
two fits your style of work better.

To get you started by a sneak preview of what they can do, here's a
short example of how my .vimrc and .emacs files set options that apply
only to C sources.

First the ~/.vimrc options:

    " .vimrc options that apply to all files
    set softtabstop=8       "how much to indent when TAB is typed
    set tabstop=8           "how many columns a literal TAB buffer byte indents
    set textwidth=0        "where do we wrap lines?

    " vim options that apply only to C sources
    if !exists("format_keramida_cmode")
        let format_keramida_cmode = 1
        " formatting C code
        autocmd BufNewFile,BufRead *.c,*.h set autoindent showmatch
        autocmd BufNewFile,BufRead *.c,*.h set formatoptions=tcq2l textwidth=74
        autocmd BufNewFile,BufRead *.c,*.h set shiftwidth=8 softtabstop=8 tabstop=8 noexpandtab
    endif

When using VIM, you can get an indentation style of 4 columns that uses
only spaces (no TABs at all) by setting `softtabstop=4' and
`expandtabs'.

Then the ~/.emacs options for GNU Emacs:

    (defun keramida/cc-mode/setup ()
      "Configure cc-mode and derivatives for KNF style."
      (interactive)

      ;; Basic indent is 8 columns
      (make-local-variable 'c-basic-offset)
      (setq c-basic-offset 8)

      ;; Continuation lines are indented 4 spaces
      (make-local-variable 'c-offsets-alist)
      (c-set-offset 'arglist-cont 4)
      (c-set-offset 'arglist-cont-nonempty 4)
      (c-set-offset 'statement-cont 4)

      ;; Fill column
      (make-local-variable 'fill-column)
      (setq fill-column 74)

      ;; Indenting to a tab stop always inserts TAB characters
      (setq indent-tabs-mode t)
      (setq c-tab-always-indent t))

    ;; Install my own hook for C/C++ mode.
    (add-hook 'c-mode-common-hook 'keramida/cc-mode/setup)

When using Emacs, you can get an indentation style that uses 4 columns
and only spaces by setting `indent-tabs-mode' to `nil' and then tweaking
`c-basic-offset' to 4:

    (setq indent-tabs-mode nil)
    (setq c-basic-offset 4)

There are _tons_ of other features in both editors.  I lean towards
Emacs, because I like the way it works, but you can do so many things
with both editors that I have been using both for more than 16 years
now.  I like both of them :-)


--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iEYEARECAAYFAkprzlsACgkQ1g+UGjGGA7aX1QCgoXIqIgnV3tbsC0dycf0RWHMe
oYwAnRITQSVZV6CNNJc2l+G3o5swnxHN
=v5L8
-----END PGP SIGNATURE-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?871vo4p19r.fsf>