You are not logged in.

#1 2008-11-27 21:27:32

hack.augusto
Member
From: Brazil
Registered: 2008-08-28
Posts: 124

Script/Configuration files organization

Just for a curiosity matter, how do you organize your files?
I use a formatting for my configuration files and scripts like this ( Takes too much time to comment like that neutral):

#---[ Aliases ]---

alias ls='ls --color=auto'

#+++[ Aliases ]+++

#---[ System settings ]---
limit    -s coredumpsize 0
umask    0027

#---[ ZSH Options ]---
#
#---Directory---
#
# AUTO_CD        peform cd if a directory name is given
# AUTO_PUSHD        cd push the old directory onto the directory stack
# CD_ABLE_VARS        expand text (if not a command nor a directory in PWD) to ~/text
# PUSH_IGNORE_DUPS    prohibit duplicate directories in the directory stack
# PUSHD_SILENT        do not print directory stack after pushd popd
# PUSHD_TO_HOME        'pushd' acts like 'pushd $HOME'

setopt    AUTO_CD AUTO_PUSHD CD_ABLE_VARS PUSHD_IGNORE_DUPS PUSHD_SILENT PUSHD_TO_HOME

#+++Directory+++

#---Completion---
#
# ALWAYS_TO_END        moves the cursor to the end of the command
# AUTO_LIST        automatcally list choices on ambiguity
# AUTO_PARAM_SLASH
# NO_LIST_BEEP    no beeping

setopt    ALWAYS_TO_END AUTO_LIST    NO_LIST_BEEP

#+++Completion+++

EDIT: Does anyone have vim macros to do that?

Last edited by hack.augusto (2008-11-27 21:31:37)

Offline

#2 2008-11-28 06:34:16

sabooky
Member
Registered: 2006-11-02
Posts: 89

Re: Script/Configuration files organization

Did you mean something like this?

Premacro:

my section title*curser is here*

Postmacro:

#---my section title---
*curser is here*
#+++my section title+++

If thats what you meant than this should do it..

I#<Esc>yyp3a+<Esc>3A+<Esc>k3A-<Esc>03a-<Esc>o<Esc>

You can map that to a key using the syntax below (in this case the key is ';')

:map ; I#<Esc>yyp3a+<Esc>3A+<Esc>k3A-<Esc>03a-<Esc>o<Esc>

After doing the above,  you just type the section title, hit esc, then hit ';' and you'll have your pre/post comments.

If you take out the last <Esc> you'll be left in insert mode rather than command mode.

EDIT: Vim folding might useful to you.. allowing you to collapse/expand sections. (I don't use it much.. so dunno how well it works..)

Last edited by sabooky (2008-11-28 06:36:14)

Offline

Board footer

Powered by FluxBB