From 2475eced60af672469c199656d613bc54688618c Mon Sep 17 00:00:00 2001 From: andre Date: Thu, 9 Oct 2008 16:15:16 +0000 Subject: [PATCH] Initial import --- Emacs/AquaMacs.pref.el | 70 +++++++++ Emacs/Preferences.el | 293 ++++++++++++++++++++++++++++++++++++++ environment | 46 ++++++ vim/gvimrc | 27 ++++ vim/myfunx.vim | 33 +++++ vim/skeleton.vim | 55 +++++++ vim/templates/skeleton.c | 19 +++ vim/templates/skeleton.pl | 10 ++ vim/templates/skeleton.py | 25 ++++ vim/templates/skeleton.sh | 10 ++ vim/vimrc | 92 ++++++++++++ zshenv | 61 ++++++++ zshrc | 73 ++++++++++ 13 files changed, 814 insertions(+) create mode 100644 Emacs/AquaMacs.pref.el create mode 100644 Emacs/Preferences.el create mode 100644 environment create mode 100644 vim/gvimrc create mode 100644 vim/myfunx.vim create mode 100644 vim/skeleton.vim create mode 100644 vim/templates/skeleton.c create mode 100644 vim/templates/skeleton.pl create mode 100644 vim/templates/skeleton.py create mode 100644 vim/templates/skeleton.sh create mode 100644 vim/vimrc create mode 100644 zshenv create mode 100644 zshrc diff --git a/Emacs/AquaMacs.pref.el b/Emacs/AquaMacs.pref.el new file mode 100644 index 0000000..e5a7905 --- /dev/null +++ b/Emacs/AquaMacs.pref.el @@ -0,0 +1,70 @@ +;-*- coding: latin-1 -*- +;Copyright (c)2008 CUBE S.p.A. +; +; Author: Andrea Mistrali +; Description: Aquamacs Setup file +; +; $Id: AquaMacs.pref.el,v 1.6 2008-10-09 12:55:23 andre Exp $ + +;; ----------------------------- +;; Aquamacs ONLY customizations +;; ----------------------------- + +(defvar aquamacs-p (string-match "Aquamacs" (version))) ;; are we on Aquamacs? + +;; Se stiamo usando acquamacs +(when (featurep 'aquamacs) + + ;; default window dimensions + (setq default_height 55) + (setq default_width 120) + + ;; non gestire il posizionamento dei frame + (smart-frame-positioning-mode t) + + ;; set size of main window + (set-frame-height (selected-frame) default_height);; set size of main window + (set-frame-width (selected-frame) default_width) + + ;; ;; Apre un nuovo frame con il buffer *Scratch* +;; (defun my-new-frame-with-new-scratch () +;; "Open a new window with default height and width" +;; (interactive) +;; (let ((one-buffer-one-frame t)) +;; (make-frame `((width . ,default_width) +;; (height . ,default_height))))) + (defun my-new-frame-with-new-scratch () + (interactive) + (let ((one-buffer-one-frame t)) + (new-frame-with-new-scratch)) + (set-frame-height (selected-frame) default_height);; set size of main window + (set-frame-width (selected-frame) default_width)) + + ;; Chiudiamo salvando + (one-buffer-one-frame-mode 0) + (defun my-close-current-window-asktosave () + (interactive) + (let ((one-buffer-one-frame t)) + (close-current-window-asktosave))) + + ;; in Dired usiamo il comando open + (defun dired-open-mac () + "Uses open command in dired mode" + (interactive) + (let (( file-name (dired-get-file-for-visit))) + (if (file-exists-p file-name) + (call-process "/usr/bin/open" nil 0 nil file-name)))) + + ;; OSX Keybindings + (define-key osx-key-mode-map (kbd "") 'beginning-of-line) + (define-key osx-key-mode-map (kbd "") 'end-of-line) + + ;; Mela-N per aprire una nuova finestra + (define-key osx-key-mode-map (kbd "A-n") 'my-new-frame-with-new-scratch) + ;; Mela-W per chiudere salvando + (define-key osx-key-mode-map (kbd "A-W") 'my-close-current-window-asktosave) + (define-key osx-key-mode-map (kbd "A-w") 'kill-this-buffer) + (define-key osx-key-mode-map (kbd "A-j") 'join-line) + ;; o in dired per aprire con l'applicazione di default + (define-key dired-mode-map "o" 'dired-open-mac) + ) diff --git a/Emacs/Preferences.el b/Emacs/Preferences.el new file mode 100644 index 0000000..3845bb2 --- /dev/null +++ b/Emacs/Preferences.el @@ -0,0 +1,293 @@ +;; +;; Copyright (c)2007 CUBE S.p.A. +;; +;; Author: Andrea Mistrali +;; Description: Emacs Startup script +;; +;; +;; +;; This file should go in ~/Library/Preferences/Emacs on OSX and +;; in .emacs on Unix/Linux + + +;; Definiamo i path di ricerca di moduli e librerie + +;;(ignore-errors + (add-to-list 'load-path "~/.emacs.d/") + (add-to-list 'load-path "/sw/share/emacs/site-lisp/") + (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/") + (add-to-list 'load-path "/usr/share/emacs/site-lisp") +;;(add-to-list 'load-path "/usr/share/emacs/21.2/lisp")) + + +;; Carichiamo i moduli che ci servono subito +(require 'dired) +(require 'autoinsert) +(require 'hippie-exp) +(require 'tramp) +(require 'saveplace) +;; (require 'desktop) + + +;; (setq-default save-place t) +;; (setq-default desktop-read t) +;; (desktop-save-mode 1) + + +;; global variables +(setq organization "CUBE S.p.A.") +(setq user-mail-address "andre@cubeholding.com") + +(setq-default frame-title-format + (list (format "%s %%S: %%j " (system-name)) + '(buffer-file-name "%f" (dired-directory dired-directory "%b")))) + + +(setq column-number-mode t) +(setq european-calendar-style t) +(setq calendar-week-start-day 1) + +(toggle-text-mode-auto-fill)1 +(line-number-mode t) +(setq transient-mark-mode t) +(setq kill-whole-line t) + +(display-time) ;; in global prefs +(setq-default indent-tabs-mode nil) +(setq-default default-tab-width 2) + +(global-font-lock-mode t) +(setq font-lock-maximum-decoration t) +(setq-default blink-match-paren t) + +;; KEY BINDINGS +;; All version bindings + +(global-set-key (kbd "C-x C-g") 'goto-line) +(global-set-key (kbd "C-x g") 'goto-line) +(global-set-key (kbd "C-c ;") 'comment-or-uncomment-region-or-line) +;; This is better than normal behavior +(global-set-key (kbd "C-x C-b") 'electric-buffer-list) + + +(global-set-key (kbd "") 'other-window) +(global-set-key (kbd "") 'delete-other-windows) ; remove the other windows +(global-set-key (kbd "") 'delete-window) ; remove the selected window + +(global-set-key (kbd "") 'split-window-horizontally) +(global-set-key (kbd "") 'split-window-vertically) + +(global-set-key (kbd "C-x SPC") 'toggle-showtabs) + +(global-set-key (kbd "") 'eshell) ;; conflicts with Dashboard +(global-set-key (kbd "") 'term) ;; conflicts with Dashboard + +(global-set-key [(meta right)] 'forward-word) +(global-set-key [(meta left)] 'backward-word) + +;; Italian Keyboard on Mac OS X +(global-set-key (kbd "M-\230") "@") +(global-set-key (kbd "M-\223") "~") +(global-set-key (kbd "M-\210") "#") +(global-set-key (kbd "M-ò") "@") +(global-set-key (kbd "M-à") "#") +(global-set-key (kbd "M-ì") "~") +(global-set-key (kbd "M-è") "[") +(global-set-key (kbd "M-+") "]") +(global-set-key (kbd "M-é") "{") +(global-set-key (kbd "S-M-+") "}") +(global-set-key (kbd "M-\\") "`") + +;;;;;;;;;;;; +;; hippie +;;;;;;;;;;;; +(setq hippie-expand-try-functions-list + '( + ;; try-complete-tempo-tag + try-expand-dabbrev + try-expand-dabbrev-all-buffers + try-expand-dabbrev-from-kill + try-complete-file-name-partially + try-complete-file-name + try-expand-list + try-complete-lisp-symbol-partially + try-complete-lisp-symbol + try-expand-whole-kill)) + +;; the expand-function. Called with a positive prefix

it jumpes direct +;; to the

-th try-function. +(defun my-hippie-expand (arg) + (interactive "P") + ;; hippie-expand does not have a customization-feature (like + ;; dabbrev-expand) to search case-sensitive for completions. + ;; So we must set 'case-fold-search' temp. to nil! + (let ((old-case-fold-search case-fold-search)) + (setq case-fold-search nil) + (hippie-expand arg) + (setq case-fold-search old-case-fold-search) + ) + ) +;; all expansion is done by 'my-hippie-expand bound to C-TAB! +(global-set-key (kbd "") 'my-hippie-expand) + + +;;;;;;;;;;; +;; TRAMP +;;;;;;;;;;; +(setq tramp-shell-prompt-pattern "[#$%>] *") +(setq tramp-default-method "ssh") + + +;; Some useful functions +(defun ascii-table () + "Print the ascii table. Based on a defun by Alex Schroeder " + (interactive) + (switch-to-buffer "*ASCII*") + (erase-buffer) + (insert (format "ASCII characters up to number %d.\n\n" 254)) + (let ((i 0)) + (while (< i 254) + (setq i (+ i 1)) + (insert (format "%4d %c\n" i i)))) (beginning-of-buffer)) + +;; emulate set list in vi +(defvar *showtabs* nil) +(defun toggle-showtabs () + "toggle the display of tabs and newlines" + (interactive) + (setq *showtabs* (not *showtabs*)) + (let ((disptab (make-display-table))) + (let ((i 0)) + (while (< i 32) + (or (= i ?\t) (= i ?\n) + (aset disptab i (vector ?^ (+ i 64)))) + (setq i (1+ i)))) + (when *showtabs* + (aset disptab 127 (vector ?^ ??)) + (aset disptab ?\t (vector ?- ?>)) + (aset disptab ?\n (vector ?$ ?\n))) + (set-window-display-table (selected-window) disptab))) + + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Auto Insert - Template add-on +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(add-hook 'find-file-hooks 'auto-insert) + +(define-skeleton insert-cvs-tags ;; insert CVS ID Tag + "insert the CVS tags" + nil + comment-start " $Id$" comment-end) + +(define-skeleton insert-gpl-disclaimer ;; insert GPL header + "insert GPL disclaimer" + nil + +comment-start "This file is free software; you can redistribute it and/or modify" comment-end \n +comment-start "it under the terms of the GNU General Public License as published by" comment-end \n +comment-start "the Free Software Foundation; either version 2, or (at your option)" comment-end \n +comment-start "any later version." comment-end \n \n +comment-start "This file is distributed in the hope that it will be useful," comment-end \n +comment-start "but WITHOUT ANY WARRANTY; without even the implied warranty of" comment-end \n +comment-start "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" comment-end \n +comment-start "GNU General Public License for more details." comment-end \n \n +comment-start "You should have received a copy of the GNU General Public License" comment-end \n +comment-start "along with this software; see the file COPYING. If not, write to" comment-end \n +comment-start "the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor," comment-end \n +comment-start "Boston, MA 02110-1301, USA." comment-end \n \n + +) + +(define-skeleton insert-standard-header + "insert a standard header in all programs" + "Purpose or description:" + comment-start "-*- coding: latin-1 -*-" comment-end \n + comment-start (concat "Copyright (c)" (substring (current-time-string) -4) + " " organization " ") comment-end \n + comment-start " " comment-end \n + comment-start " Author: " (user-full-name) " <" user-mail-address "> " comment-end \n + comment-start " Description: " + str + comment-end \n + comment-start comment-end \n + '(insert-cvs-tags)' "" \n + comment-start " " comment-end \n \n) + +;; Python Mode +(define-skeleton insert-python-header + "inserts a Python header" + nil + "#!/usr/bin/env python" \n + '(insert-standard-header)' "" \n \n + "__version__=\"$Revision: 1.5 $\"[11:-2]" \n \n + "") + +(defun my-python-mode-settings () + "My Python programming mode settings." + (interactive) + (setq indent-tabs-mode nil) + (local-set-key (kbd "") 'insert-python-header) + (local-set-key (kbd "") 'beginning-of-python-def-or-class) + (local-set-key (kbd "") 'end-of-python-def-or-class)) + + +(when (locate-library "python-mode") + (add-hook 'python-mode-hook 'my-python-mode-settings) + (add-to-list 'auto-mode-alist '("\\.py$" . python-mode)) + (autoload 'python-mode "python-mode")) + +(custom-set-variables + '(python-python-command "/usr/local/bin/python2.5") +) + +;; CPerl Mode +(setq auto-mode-alist + (append '(("\\.\\([pP][Llm]\\|al\\)$" . cperl-mode)) auto-mode-alist )) + +(setq interpreter-mode-alist (append interpreter-mode-alist + '(("miniperl" . perl-mode)))) +(setq cperl-electric-parens t) +(setq cperl-electric-keywords t) +(setq cperl-electric-brace t) +(setq cperl-electric-backspace t) +(setq cperl-auto-newline-after-colon t) +(setq cperl-auto-newline t) + +(define-skeleton insert-perl-header + "inserts a Perl header" + "Purpose of script: " + "#!/usr/bin/perl" \n + '(insert-standard-header)' "" \n \n + ) + +;;run the current perl program +(defun run-perl () + (interactive "*") + (setq perl-buffer-name buffer-file-name) + (shell) + (setq perl-run-command "perl ") + (insert perl-run-command) + (insert perl-buffer-name) + ) + +;; debug the current perl program +(defun debug-perl () + (interactive "*") + (setq perl-buffer-name buffer-file-name) + (shell) + (setq perl-run-command "perl -d ") + (insert perl-run-command) + (insert perl-buffer-name) + ) + +(dolist (insertion '((("\\.py\\'" . "Python file") . insert-python-header) + (("\\.pl\\'" . "Perl header") . insert-perl-header))) + (add-to-list 'auto-insert-alist insertion)) + +;;;;;;;;;; +;; GNUS +;;;;;;;;;; + +(setq gnus-select-method '(nntp "news.fastwebnet.it")) diff --git a/environment b/environment new file mode 100644 index 0000000..cfbf2fb --- /dev/null +++ b/environment @@ -0,0 +1,46 @@ +# -*- coding: latin-1 -*- +# Copyright (c)2008 CUBE S.p.A. +# +# Author: Andrea Mistrali +# Description: Environment variables definition +# +# $Id: environment,v 1.6 2008-10-09 12:55:23 andre Exp $ + +LESS="-c -x2 -R -MM -PMFile\:?f%f:STDIN. Size\:?B%B:Unknown. Pos\:?pb%pb\%:Unknown. File No.\:%i/%m" + +LANG=it_IT@euro +LESSCHARSET=latin1 + +SAVEHIST=500 +HISTFILE=~/.history +HISTSIZE=10000 + +READNULLCMD=/usr/bin/less +PAGER=/usr/bin/less +MPAGE="-2 -f -P -bA4" + +PS1="%B%m:%n:%~ %#%b " + +PATH="/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/sbin:/usr/sbin:$HOME/bin:." + +LOGCHECK=30 +LOGD=/var/log +REPORTTIME=15 +WATCH=notme +WATCHFMT="%n %a %l (%m) at %t." + +PYTHONSTARTUP=~/.pythonrc.py + +MIBS=all +MINICOM="-c on" +#export CVSROOT=":pserver:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od" +#export CVSROOT=":pserver:andre@lorien:/var/lib/cvs" +CVSROOT=":pserver:cvs:/var/lib/cvs" +EDITOR="vi" + +# Distcc configuration +MAKEFLAGS=CC=distcc +DISTCC_HOSTS="localhost @zeus" +PATH="/usr/local/distcc/bin:$PATH" +CONCURRENCY_LEVEL=10 +MAKEFLAGS="CC=distcc" diff --git a/vim/gvimrc b/vim/gvimrc new file mode 100644 index 0000000..792588f --- /dev/null +++ b/vim/gvimrc @@ -0,0 +1,27 @@ +set guifont=Monaco:h12 +"set guifont=ProFontWindows:h9 +set anti +set lines=50 +"set lines=70 +set columns=132 +set nomousefocus +set ruler +set errorbells +set visualbell +set foldmethod=expr + +if exists('&macatsui') + set nomacatsui +endif + + +"colorscheme zenburn +"colorscheme freya +colorscheme moria + + + +" Let's do Ctrl-W work as expected, Gvim thinks we use a QZERTY Keyboard +nnoremap +nnoremap :call Zoom() +nnoremap :set list! diff --git a/vim/myfunx.vim b/vim/myfunx.vim new file mode 100644 index 0000000..514a807 --- /dev/null +++ b/vim/myfunx.vim @@ -0,0 +1,33 @@ +" Converts a file to PDF and display it (only on OS X) +function! ToPDF() + "define PS file name + let psname= "/tmp/" . expand("%:t:r") . ".ps" + "save colorscheme name + let g:colorname=g:colors_name + execute "write" + execute "colorscheme default" + execute "hardcopy > " . l:psname + execute "silent !launch -w " . l:psname + execute "silent !rm " . l:psname + execute "colorscheme" g:colorname + redraw! +endfunction + +" Set up menu for the function +an 10.520 &File.-SEP3- +an 10.530 &File.&ToPDF :call ToPDF() +vunmenu &File.&ToPDF +vnoremenu &File.&ToPDF :call ToPDF() + +" Zoom in/out of gvim +function! Zoom() + if has("gui_running") + if &guifont =~ 'Monaco:h12' + set guifont=Monaco:h9 + set lines=70 + else + set guifont=Monaco:h12 + set lines=50 + endif + endif +endfunction diff --git a/vim/skeleton.vim b/vim/skeleton.vim new file mode 100644 index 0000000..cc3cde6 --- /dev/null +++ b/vim/skeleton.vim @@ -0,0 +1,55 @@ +" TEMPLATE SYSTEM FOR VIM +" +" Preserve template files +augroup newfiles + " First we load templates for the file type + autocmd BufNewFile * ks|call OpenFile()|'s + + " Update of "Last Modified" date on writing + autocmd BufWritePre,FileWritePre * ks|call LastMod()|'s + + " Protect templates, removing write commands + autocmd BufRead,BufNewFile ~/.vim/templates/* au! newfiles + + " Reload .vimrc, after modifications + autocmd BufWritePost ~/.vimrc so ~/.vimrc + if has("gui_running") + autocmd BufWritePost ~/.gvimrc so ~/.gvimrc + endif + + " Set up python support + au FileType python source ~/.vim/addon/python.vim +augroup END + + +" Function to modify "Last Modified" date. Works on first 10 lines +function! LastMod() + if line("$") > 20 + let l = 20 + else + let l = line("$") + endif + execute "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " . + \ strftime("%d:%b:%Y %H:%M") +endfunction + +" Function to open a file and set some defaults +function! OpenFile() + let s:filename=expand("") + let l:ext=fnamemodify(s:filename, ":e") + let l:skel = "~/.vim/templates/skeleton.".l:ext + if filereadable(fnamemodify(l:skel,":p")) + execute "0r" l:skel + let s:syn=input("Synopsis: ") + if line("$") > 20 + let l = 20 + else + let l = line("$") + endif + execute "1," . l . "g/First version: /s/First version: .*/First version: ". + \ strftime("%d:%b:%Y %H:%M") + execute "1," . l . "g/Synopsis: /s/Synopsis: .*/Synopsis: ". + \ s:syn + endif +endfunction + diff --git a/vim/templates/skeleton.c b/vim/templates/skeleton.c new file mode 100644 index 0000000..863a2d7 --- /dev/null +++ b/vim/templates/skeleton.c @@ -0,0 +1,19 @@ +/* +-*- coding: latin-1 -*- + +Copyright by Andrea Mistrali . +First version: +Last modified: 06:Apr:2007 10:55 + +Synopsis: + +$Id: skeleton.c,v 1.2 2007-04-06 08:56:27 andre Exp $ + +*/ + +#include +#include + +int main(int argc, char *argv[]) { + return 0 +} diff --git a/vim/templates/skeleton.pl b/vim/templates/skeleton.pl new file mode 100644 index 0000000..2fd3eaf --- /dev/null +++ b/vim/templates/skeleton.pl @@ -0,0 +1,10 @@ +#!/usr/bin/env perl +# -*- coding: latin-1 -*- + +# Copyright by Andrea Mistrali . +# First version: +# Last modified: 06:Apr:2007 10:55 +# +# Synopsis: +# +# $Id: skeleton.pl,v 1.2 2007-04-06 08:56:27 andre Exp $ diff --git a/vim/templates/skeleton.py b/vim/templates/skeleton.py new file mode 100644 index 0000000..2ecbe9b --- /dev/null +++ b/vim/templates/skeleton.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +#-*- coding: latin-1 -*- + +""" + + Copyright by Andrea Mistrali . + First version: + Last modified: 06:Apr:2007 10:56 + + Synopsis: + + $Id: skeleton.py,v 1.2 2007-04-06 08:56:27 andre Exp $ + +""" + +__version__ ='0.1' +__author__ ='Andrea Mistrali ' + + +def main(): + pass + +# If we have been called as 'python