A question for developers
Giorgos Keramidas
keramida at ceid.upatras.gr
Sun Jul 26 03:56:38 UTC 2009
On Fri, 24 Jul 2009 22:49:10 -0400, Steve Bertrand <steve at 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 :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090726/32eee389/attachment.pgp
More information about the freebsd-questions
mailing list