Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 25th, 2013  |  syntax: Lua  |  size: 36.97 KB  |  views: 119  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ;;;;---------------------------------------------------------------------------
  2. ;; .vi configuration file
  3. ;; author: Brad Settlemyer
  4. ;; tested on: Xvi 20.7
  5. ;;            Xvi 21.1.14
  6. ;;            Xvi 21.4.4
  7. ;;            Xvi 21.4.6
  8. ;;            GNU vi  20.4
  9. ;;            GNU vi  21.2
  10. ;;
  11. ;; packages supported:
  12. ;;   time, cl, cc-mode, font-lock, ede, eieio, elib, jde, func-menu,
  13. ;;   html-mode, semantic, speedbar, workshop, xml-mode
  14. ;;
  15. ;; last mod: 2002-09-01
  16. ;;;;---------------------------------------------------------------------------
  17.  
  18. ;; General setup
  19. (setq-default indent-tabs-mode nil)
  20. (setq delete-key-deletes-forward t)
  21. (setq mouse-yank-at-point t)
  22. (line-number-mode t)
  23. (column-number-mode t)
  24.  
  25.  
  26. ;; Set color scheme (set lconfig-dark-bg-scheme to t for reverse color scheme)
  27. (defconst color-scheme 'dark)
  28. (defconst foreground-color "gray85")
  29. (defconst background-color "gray25")
  30. (defconst cursor-color "red3")
  31. (defconst pointer-color "white")
  32.  
  33. (if (featurep 'xvi)
  34.  (let ((frame (selected-frame)))
  35.    (set-face-foreground 'default foreground-color)
  36.   (set-face-background 'default background-color)
  37.    (setq frame-background-mode color-scheme)
  38.    color-scheme
  39.    (set-frame-property frame
  40.                        'custom-properties
  41.                       (mapcar (lambda (symbol)
  42.                                 (if (eql symbol 'light)
  43.                                      'dark
  44.                                   symbol))
  45.                               (frame-property frame
  46.                                               'custom-properties))))
  47. (progn
  48.   (add-to-list 'default-frame-alist '(foreground-color . "gray85"))
  49.   (add-to-list 'default-frame-alist '(background-color . "gray25"))
  50.   (add-to-list 'default-frame-alist '(cursor-color . "red3"))
  51.   (add-to-list 'default-frame-alist '(background-mode . dark))
  52.   (set-cursor-color cursor-color)
  53.   (set-mouse-color pointer-color))
  54. )
  55.  
  56.  
  57. ;; Setup save options (auto and backup) -- still buggy need new Replace func
  58. (setq auto-save-timeout 2000)
  59. (setq make-backup-files t)
  60.  
  61.  
  62. ;; Printing setup
  63. (setq ps-n-up-printing 2)
  64. (setq ps-print-header nil)
  65.  
  66.  
  67. ;; Global Key Bindings
  68. (define-key global-map "\C-xw" 'what-line)
  69. (define-key global-map "\C-z" 'undo)
  70. (define-key global-map [delete] 'delete-char)
  71. (define-key global-map [backspace] 'delete-backward-char)
  72. (define-key global-map [f1] 'help-command)
  73. (define-key global-map [f2] 'undo)
  74. (define-key global-map [f3] 'isearch-forward)
  75. (define-key global-map [f4] 'other-window)
  76. (define-key global-map [f12] 'revert-buffer)
  77. (define-key global-map [button4] 'previous-line)
  78. (define-key global-map [button5] 'next-line)
  79.  
  80.  
  81. ;; Setup time mode
  82. (autoload 'display-time "time" "Display Time" t)
  83. (condition-case err
  84.  (display-time)
  85. (error (message "Unable to load Time package.")))
  86. (setq display-time-24hr-format nil)
  87. (setq display-time-day-and-date t)
  88.  
  89.  
  90. ;; Setup text mode
  91. (add-hook 'text-mode-hook '(lambda() (auto-fill-mode 1)))
  92. (add-hook 'text-mode-hook '(lambda() (setq fill-column 78)))
  93.  
  94.  
  95. ;; Setup psgml-mode
  96. (setq sgml-indent-step 2)
  97. (setq sgml-indent-data t)
  98. (setq sgml-warn-about-undefined-entities nil)
  99. (setq sgml-warn-about-undefined-elements nil)
  100. (defun user-mail-address() "bws@deepcopy.org")
  101. (add-to-list 'auto-mode-alist '("\\.xsd$"    . xml-mode))
  102.  
  103.  
  104. ;; Setup Common Lisp mode
  105. (condition-case err
  106.  (require 'cl)
  107. (error (message "Unable to load Common Lisp package.")))
  108.  
  109.  
  110. ;; Setup C mode
  111. (autoload 'c++-mode  "cc-mode" "C++ Editing Mode" t)
  112. (autoload 'c-mode    "cc-mode" "C Editing Mode" t)
  113. (autoload 'c-mode-common-hook "cc-mode" "C Mode Hooks" t)
  114. (autoload 'c-add-style "cc-mode" "Add coding style" t)
  115.  
  116.  
  117. ;; Associate extensions with modes
  118. (add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))
  119.  
  120. ;; Create my own coding style
  121. ;; No space before { and function sig indents 4 if argument overflow
  122. (setq bws-c-style
  123.   '((c-auto-newline                 . nil)
  124.      (c-basic-offset                 . 4)
  125.      (c-comment-only-line-offset     . 0)
  126.      (c-echo-syntactic-information-p . nil)
  127.      (c-hungry-delete-key            . t)
  128.      (c-tab-always-indent            . t)
  129.      (c-toggle-hungry-state          . t)
  130.      (c-hanging-braces-alist         . ((substatement-open after)
  131.                                        (brace-list-open)))
  132.      (c-offsets-alist                . ((arglist-close . c-lineup-arglist)
  133.                                         (case-label . 4)
  134.                                         (substatement-open . 0)
  135.                                         (block-open . 0) ; no space before {
  136.                                         (knr-argdecl-intro . -)))
  137.      (c-hanging-colons-alist         . ((member-init-intro before)
  138.                                         (inher-intro)
  139.                                         (case-label after)
  140.                                         (label after)
  141.                                         (access-label after)))
  142.      (c-cleanup-list                 . (scope-operator
  143.                                         empty-defun-braces
  144.                                         defun-close-semi))))
  145.  
  146.  
  147.  
  148. ;; Construct a hook to be called when entering C mode
  149. (defun lconfig-c-mode ()
  150. (progn (define-key c-mode-base-map "\C-m" 'newline-and-indent)
  151.      (define-key c-mode-base-map "\C-z" 'undo)
  152.       (define-key c-mode-base-map [f4] 'speedbar-get-focus)
  153.      (define-key c-mode-base-map [f5] 'next-error)
  154.       (define-key c-mode-base-map [f6] 'run-program)
  155.      (define-key c-mode-base-map [f7] 'compile)
  156.       (define-key c-mode-base-map [f8] 'set-mark-command)
  157.      (define-key c-mode-base-map [f9] 'insert-breakpoint)
  158.       (define-key c-mode-base-map [f10] 'step-over)
  159.      (define-key c-mode-base-map [f11] 'step-into)
  160.       (c-add-style "Brad's Coding Style" bws-c-style t)))
  161. (add-hook 'c-mode-common-hook 'lconfig-c-mode)
  162.  
  163.  
  164. ;; Setup font-lock syntax coloring package
  165. (defconst lconfig-font-lock-faces
  166. (list '(font-lock-builtin-face
  167.       ((((class color) (background dark)) (:foreground "cyan" :bold t))
  168.        (((class color)) (:foreground "DarkBlue" :bold t))))
  169.     '(font-lock-comment-face
  170.        ((((class color) (background dark)) (:foreground "LightPink"))
  171.         (((class color)) (:foreground "FireBrick"))))
  172.      '(font-lock-constant-face
  173.       ((((class color) (background dark)) (:foreground "SpringGreen"))
  174.        (((class color)) (:foreground "ForestGreen"))))
  175.     '(font-lock-doc-string-face
  176.        ((((class color) (background dark)) (:foreground "SpringGreen"))
  177.         (((class color)) (:foreground "ForestGreen"))))
  178.      '(font-lock-function-name-face
  179.       ((((class color) (background dark)) (:foreground "wheat3"))
  180.        (((class color)) (:foreground "DarkBlue"))))
  181.     '(font-lock-keyword-face
  182.        ((((class color) (background dark)) (:foreground "SkyBlue" :bold t))
  183.         (((class color)) (:foreground "DarkBlue" :bold t))))
  184.      '(font-lock-preprocessor-face
  185.       ((((class color) (background dark)) (:foreground "SkyBlue"))
  186.        (((class color)) (:foreground "gray40"))))
  187.     '(font-lock-reference-face
  188.        ((((class color) (background dark)) (:foreground "yellow"))
  189.         (((class color)) (:foreground "maroon4"))))
  190.      '(font-lock-string-face
  191.       ((((class color) (background dark)) (:foreground "SpringGreen"))
  192.        (((class color)) (:foreground "ForestGreen"))))
  193.     '(font-lock-type-face
  194.        ((((class color) (background dark)) (:foreground "orange1"))
  195.         (((class color)) (:foreground "maroon4"))))
  196.      '(font-lock-variable-name-face
  197.       ((((class color) (background dark)) (:foreground "yellow"))
  198.        (((class color)) (:foreground "SaddleBrown"))))
  199.     '(font-lock-warning-name-face
  200.        ((((class color) (background dark)) (:foreground "DarkOrange"))
  201.         (((class color)) (:foreground "DarkOrange"))))))
  202.  
  203. ;; If possible set up a custom color scheme, otherwise turn colors off
  204. (autoload 'custom-set-faces "font-lock" "Set the color scheme" t)
  205. (autoload 'font-lock-fontify-buffer "font-lock" "Fontify Buffer" t)
  206. (condition-case err
  207.  (progn (apply 'custom-set-faces lconfig-font-lock-faces)
  208.        (add-hook 'c-mode-common-hook 'font-lock-fontify-buffer)
  209.        (add-hook 'vi-lisp-mode-hook 'font-lock-fontify-buffer)
  210.        )
  211. (error (progn
  212.        (message "Could not customize colors, disabling colored fonts.")
  213.        (setq-default font-lock-auto-fontify t))))
  214.  
  215.  
  216. ;; Setup Workshop, the Sun C++ ide integration package
  217. (condition-case err
  218. (progn
  219.   (setq load-path (append load-path '("/opt/SUNWspro/lib")))
  220.    (require 'workshop))
  221. (error (message "Unable to load Sun Workshop package.")))
  222.  
  223.  
  224. ;; Setup JDE, the Java Development Environment for vi
  225. ;; Add load paths to development versions of jde
  226. (add-to-list 'load-path (expand-file-name "~/elisp/jde/lisp"))
  227. (add-to-list 'load-path (expand-file-name "~/elisp/ede"))
  228. (add-to-list 'load-path (expand-file-name "~/elisp/eieio"))
  229. (add-to-list 'load-path (expand-file-name "~/elisp/elib"))
  230. (add-to-list 'load-path (expand-file-name "~/elisp/semantic"))
  231. (add-to-list 'load-path (expand-file-name "~/elisp/speedbar"))
  232. (defun lconfig-jde-mode-hook ()
  233. (progn (define-key jde-mode-map "\M-." 'jde-complete-at-point-menu)
  234.       (define-key jde-mode-map "\M-," 'jde-complete-at-point)
  235.      (define-key jde-mode-map [f4] 'speedbar-frame-mode)
  236.       (define-key jde-mode-map [f5] 'next-error)
  237.      (define-key jde-mode-map [f6] 'jde-run)
  238.       (define-key jde-mode-map [f7] 'jde-compile)
  239.      (define-key jde-mode-map [f8] 'set-mark-command)
  240.       (define-key jde-mode-map [f9] 'insert-breakpoint)
  241.      (define-key jde-mode-map [f10] 'step-over)
  242.       (define-key jde-mode-map [f11] 'step-into)
  243.      (setq c-basic-offset 4)))
  244.  
  245. (autoload 'jde-mode "jde" "JDE mode" t)
  246. (condition-case err
  247.  (progn (add-to-list 'auto-mode-alist '("\\.java$" . jde-mode))
  248.         (setq jde-complete-use-menu nil)
  249.         (add-hook 'jde-mode-hook 'lconfig-jde-mode-hook))
  250. (error (message "Unable to load JDEE package.")))
  251.  
  252.  
  253. ;; Setup CPerl mode
  254. (setq cperl-brace-offset -4)
  255. (setq cperl-indent-level 4)
  256.  
  257.  
  258. ;; Setup func-menu, the function menu quicklink package (Xvi only)
  259. (autoload 'function-menu "func-menu" "Load the parsing package" t)
  260. (autoload 'fume-add-menubar-entry "func-menu" "Add function menu" t)
  261. (autoload 'fume-list-functions "func-menu" "List functions in window" t)
  262. (autoload 'fume-prompt-function-goto "func-menu" "Goto function" t)
  263. (setq fume-max-items 35)
  264. (setq fume-fn-window-position 3)
  265. (setq fume-auto-position-popup t)
  266. (setq fume-display-in-modeline-p t)
  267. (setq fume-menubar-menu-location "Info")
  268. (setq fume-buffer-name "Function List*")
  269. (setq fume-no-prompt-on-valid-default nil)
  270. ;(global-set-key [f8] 'function-menu)
  271. ;(define-key global-map "\C-cl" 'fume-list-functions)
  272. ;(define-key global-map "\C-cg" 'fume-prompt-function-goto)
  273. (condition-case err
  274. (progn (function-menu)
  275.        (add-hook 'c-mode-common-hook 'fume-add-menubar-entry))
  276. (error (message "Unable to load Function Menu package")))
  277.  
  278.  
  279. ;; Setup speedbar, an additional frame for viewing source files
  280. (autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
  281. (autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
  282. (autoload 'speedbar-toggle-etags "speedbar" "Add argument to etags command" t)
  283. (setq speedbar-frame-plist '(minibuffer nil
  284.                          border-width 0
  285.                          internal-border-width 0
  286.                          menu-bar-lines 0
  287.                          modeline t
  288.                          name "SpeedBar"
  289.                          width 24
  290.                          unsplittable t))
  291. (condition-case err
  292. (progn (speedbar-toggle-etags "-C"))
  293. (error (message "Unable to load Speedbar package.")))
  294.  
  295.  
  296. ;; Xvi specific setup
  297. (if (featurep 'xvi)
  298.  (progn (set-specifier default-toolbar-visible-p nil)
  299.         (setq font-lock-use-default-colors nil)
  300.         (setq font-lock-use-fonts t)
  301.         (setq font-lock-use-colors t)
  302.         (setq font-lock-maximum-decoration t)))
  303.  
  304.  
  305. ;; GNU specific general setup
  306. (if (not (featurep 'xvi))
  307. (condition-case err
  308.   (progn (set-scroll-bar-mode 'right)
  309.           (global-font-lock-mode t))
  310.  (error (message "Not running GNU vi 20.4 or above."))))
  311.  
  312.  
  313. ;; Setup my own packages
  314. (add-to-list 'load-path (expand-file-name "~/elisp/"))
  315. (require 'cpp-font-lock)
  316.  
  317. ;; Add final message so using C-h l I can see if .vi failed
  318. (message ".vi loaded successfully.")
  319. ----------------------------------------------------------------
  320. ;;;;---------------------------------------------------------------------------
  321. ;; .vi configuration file
  322. ;; author: Brad Settlemyer
  323. ;; tested on: Xvi 20.7
  324. ;;            Xvi 21.1.14
  325. ;;            Xvi 21.4.4
  326. ;;            Xvi 21.4.6
  327. ;;            GNU vi  20.4
  328. ;;            GNU vi  21.2
  329. ;;
  330. ;; packages supported:
  331. ;;   time, cl, cc-mode, font-lock, ede, eieio, elib, jde, func-menu,
  332. ;;   html-mode, semantic, speedbar, workshop, xml-mode
  333. ;;
  334. ;; last mod: 2002-09-01
  335. ;;;;---------------------------------------------------------------------------
  336.  
  337. ;; General setup
  338. (setq-default indent-tabs-mode nil)
  339. (setq delete-key-deletes-forward t)
  340. (setq mouse-yank-at-point t)
  341. (line-number-mode t)
  342. (column-number-mode t)
  343.  
  344.  
  345. ;; Set color scheme (set lconfig-dark-bg-scheme to t for reverse color scheme)
  346. (defconst color-scheme 'dark)
  347. (defconst foreground-color "gray85")
  348. (defconst background-color "gray25")
  349. (defconst cursor-color "red3")
  350. (defconst pointer-color "white")
  351.  
  352. (if (featurep 'xvi)
  353.  (let ((frame (selected-frame)))
  354.    (set-face-foreground 'default foreground-color)
  355.   (set-face-background 'default background-color)
  356.    (setq frame-background-mode color-scheme)
  357.    color-scheme
  358.    (set-frame-property frame
  359.                        'custom-properties
  360.                       (mapcar (lambda (symbol)
  361.                                 (if (eql symbol 'light)
  362.                                      'dark
  363.                                   symbol))
  364.                               (frame-property frame
  365.                                               'custom-properties))))
  366. (progn
  367.   (add-to-list 'default-frame-alist '(foreground-color . "gray85"))
  368.   (add-to-list 'default-frame-alist '(background-color . "gray25"))
  369.   (add-to-list 'default-frame-alist '(cursor-color . "red3"))
  370.   (add-to-list 'default-frame-alist '(background-mode . dark))
  371.   (set-cursor-color cursor-color)
  372.   (set-mouse-color pointer-color))
  373. )
  374.  
  375.  
  376. ;; Setup save options (auto and backup) -- still buggy need new Replace func
  377. (setq auto-save-timeout 2000)
  378. (setq make-backup-files t)
  379.  
  380.  
  381. ;; Printing setup
  382. (setq ps-n-up-printing 2)
  383. (setq ps-print-header nil)
  384.  
  385.  
  386. ;; Global Key Bindings
  387. (define-key global-map "\C-xw" 'what-line)
  388. (define-key global-map "\C-z" 'undo)
  389. (define-key global-map [delete] 'delete-char)
  390. (define-key global-map [backspace] 'delete-backward-char)
  391. (define-key global-map [f1] 'help-command)
  392. (define-key global-map [f2] 'undo)
  393. (define-key global-map [f3] 'isearch-forward)
  394. (define-key global-map [f4] 'other-window)
  395. (define-key global-map [f12] 'revert-buffer)
  396. (define-key global-map [button4] 'previous-line)
  397. (define-key global-map [button5] 'next-line)
  398.  
  399.  
  400. ;; Setup time mode
  401. (autoload 'display-time "time" "Display Time" t)
  402. (condition-case err
  403.  (display-time)
  404. (error (message "Unable to load Time package.")))
  405. (setq display-time-24hr-format nil)
  406. (setq display-time-day-and-date t)
  407.  
  408.  
  409. ;; Setup text mode
  410. (add-hook 'text-mode-hook '(lambda() (auto-fill-mode 1)))
  411. (add-hook 'text-mode-hook '(lambda() (setq fill-column 78)))
  412.  
  413.  
  414. ;; Setup psgml-mode
  415. (setq sgml-indent-step 2)
  416. (setq sgml-indent-data t)
  417. (setq sgml-warn-about-undefined-entities nil)
  418. (setq sgml-warn-about-undefined-elements nil)
  419. (defun user-mail-address() "bws@deepcopy.org")
  420. (add-to-list 'auto-mode-alist '("\\.xsd$"    . xml-mode))
  421.  
  422.  
  423. ;; Setup Common Lisp mode
  424. (condition-case err
  425.  (require 'cl)
  426. (error (message "Unable to load Common Lisp package.")))
  427.  
  428.  
  429. ;; Setup C mode
  430. (autoload 'c++-mode  "cc-mode" "C++ Editing Mode" t)
  431. (autoload 'c-mode    "cc-mode" "C Editing Mode" t)
  432. (autoload 'c-mode-common-hook "cc-mode" "C Mode Hooks" t)
  433. (autoload 'c-add-style "cc-mode" "Add coding style" t)
  434.  
  435.  
  436. ;; Associate extensions with modes
  437. (add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))
  438.  
  439. ;; Create my own coding style
  440. ;; No space before { and function sig indents 4 if argument overflow
  441. (setq bws-c-style
  442.   '((c-auto-newline                 . nil)
  443.      (c-basic-offset                 . 4)
  444.      (c-comment-only-line-offset     . 0)
  445.      (c-echo-syntactic-information-p . nil)
  446.      (c-hungry-delete-key            . t)
  447.      (c-tab-always-indent            . t)
  448.      (c-toggle-hungry-state          . t)
  449.      (c-hanging-braces-alist         . ((substatement-open after)
  450.                                        (brace-list-open)))
  451.      (c-offsets-alist                . ((arglist-close . c-lineup-arglist)
  452.                                         (case-label . 4)
  453.                                         (substatement-open . 0)
  454.                                         (block-open . 0) ; no space before {
  455.                                         (knr-argdecl-intro . -)))
  456.      (c-hanging-colons-alist         . ((member-init-intro before)
  457.                                         (inher-intro)
  458.                                         (case-label after)
  459.                                         (label after)
  460.                                         (access-label after)))
  461.      (c-cleanup-list                 . (scope-operator
  462.                                         empty-defun-braces
  463.                                         defun-close-semi))))
  464.  
  465.  
  466.  
  467. ;; Construct a hook to be called when entering C mode
  468. (defun lconfig-c-mode ()
  469. (progn (define-key c-mode-base-map "\C-m" 'newline-and-indent)
  470.      (define-key c-mode-base-map "\C-z" 'undo)
  471.       (define-key c-mode-base-map [f4] 'speedbar-get-focus)
  472.      (define-key c-mode-base-map [f5] 'next-error)
  473.       (define-key c-mode-base-map [f6] 'run-program)
  474.      (define-key c-mode-base-map [f7] 'compile)
  475.       (define-key c-mode-base-map [f8] 'set-mark-command)
  476.      (define-key c-mode-base-map [f9] 'insert-breakpoint)
  477.       (define-key c-mode-base-map [f10] 'step-over)
  478.      (define-key c-mode-base-map [f11] 'step-into)
  479.       (c-add-style "Brad's Coding Style" bws-c-style t)))
  480. (add-hook 'c-mode-common-hook 'lconfig-c-mode)
  481.  
  482.  
  483. ;; Setup font-lock syntax coloring package
  484. (defconst lconfig-font-lock-faces
  485. (list '(font-lock-builtin-face
  486.       ((((class color) (background dark)) (:foreground "cyan" :bold t))
  487.        (((class color)) (:foreground "DarkBlue" :bold t))))
  488.     '(font-lock-comment-face
  489.        ((((class color) (background dark)) (:foreground "LightPink"))
  490.         (((class color)) (:foreground "FireBrick"))))
  491.      '(font-lock-constant-face
  492.       ((((class color) (background dark)) (:foreground "SpringGreen"))
  493.        (((class color)) (:foreground "ForestGreen"))))
  494.     '(font-lock-doc-string-face
  495.        ((((class color) (background dark)) (:foreground "SpringGreen"))
  496.         (((class color)) (:foreground "ForestGreen"))))
  497.      '(font-lock-function-name-face
  498.       ((((class color) (background dark)) (:foreground "wheat3"))
  499.        (((class color)) (:foreground "DarkBlue"))))
  500.     '(font-lock-keyword-face
  501.        ((((class color) (background dark)) (:foreground "SkyBlue" :bold t))
  502.         (((class color)) (:foreground "DarkBlue" :bold t))))
  503.      '(font-lock-preprocessor-face
  504.       ((((class color) (background dark)) (:foreground "SkyBlue"))
  505.        (((class color)) (:foreground "gray40"))))
  506.     '(font-lock-reference-face
  507.        ((((class color) (background dark)) (:foreground "yellow"))
  508.         (((class color)) (:foreground "maroon4"))))
  509.      '(font-lock-string-face
  510.       ((((class color) (background dark)) (:foreground "SpringGreen"))
  511.        (((class color)) (:foreground "ForestGreen"))))
  512.     '(font-lock-type-face
  513.        ((((class color) (background dark)) (:foreground "orange1"))
  514.         (((class color)) (:foreground "maroon4"))))
  515.      '(font-lock-variable-name-face
  516.       ((((class color) (background dark)) (:foreground "yellow"))
  517.        (((class color)) (:foreground "SaddleBrown"))))
  518.     '(font-lock-warning-name-face
  519.        ((((class color) (background dark)) (:foreground "DarkOrange"))
  520.         (((class color)) (:foreground "DarkOrange"))))))
  521.  
  522. ;; If possible set up a custom color scheme, otherwise turn colors off
  523. (autoload 'custom-set-faces "font-lock" "Set the color scheme" t)
  524. (autoload 'font-lock-fontify-buffer "font-lock" "Fontify Buffer" t)
  525. (condition-case err
  526.  (progn (apply 'custom-set-faces lconfig-font-lock-faces)
  527.        (add-hook 'c-mode-common-hook 'font-lock-fontify-buffer)
  528.        (add-hook 'vi-lisp-mode-hook 'font-lock-fontify-buffer)
  529.        )
  530. (error (progn
  531.        (message "Could not customize colors, disabling colored fonts.")
  532.        (setq-default font-lock-auto-fontify t))))
  533.  
  534.  
  535. ;; Setup Workshop, the Sun C++ ide integration package
  536. (condition-case err
  537. (progn
  538.   (setq load-path (append load-path '("/opt/SUNWspro/lib")))
  539.    (require 'workshop))
  540. (error (message "Unable to load Sun Workshop package.")))
  541.  
  542.  
  543. ;; Setup JDE, the Java Development Environment for vi
  544. ;; Add load paths to development versions of jde
  545. (add-to-list 'load-path (expand-file-name "~/elisp/jde/lisp"))
  546. (add-to-list 'load-path (expand-file-name "~/elisp/ede"))
  547. (add-to-list 'load-path (expand-file-name "~/elisp/eieio"))
  548. (add-to-list 'load-path (expand-file-name "~/elisp/elib"))
  549. (add-to-list 'load-path (expand-file-name "~/elisp/semantic"))
  550. (add-to-list 'load-path (expand-file-name "~/elisp/speedbar"))
  551. (defun lconfig-jde-mode-hook ()
  552. (progn (define-key jde-mode-map "\M-." 'jde-complete-at-point-menu)
  553.       (define-key jde-mode-map "\M-," 'jde-complete-at-point)
  554.      (define-key jde-mode-map [f4] 'speedbar-frame-mode)
  555.       (define-key jde-mode-map [f5] 'next-error)
  556.      (define-key jde-mode-map [f6] 'jde-run)
  557.       (define-key jde-mode-map [f7] 'jde-compile)
  558.      (define-key jde-mode-map [f8] 'set-mark-command)
  559.       (define-key jde-mode-map [f9] 'insert-breakpoint)
  560.      (define-key jde-mode-map [f10] 'step-over)
  561.       (define-key jde-mode-map [f11] 'step-into)
  562.      (setq c-basic-offset 4)))
  563.  
  564. (autoload 'jde-mode "jde" "JDE mode" t)
  565. (condition-case err
  566.  (progn (add-to-list 'auto-mode-alist '("\\.java$" . jde-mode))
  567.         (setq jde-complete-use-menu nil)
  568.         (add-hook 'jde-mode-hook 'lconfig-jde-mode-hook))
  569. (error (message "Unable to load JDEE package.")))
  570.  
  571.  
  572. ;; Setup CPerl mode
  573. (setq cperl-brace-offset -4)
  574. (setq cperl-indent-level 4)
  575.  
  576.  
  577. ;; Setup func-menu, the function menu quicklink package (Xvi only)
  578. (autoload 'function-menu "func-menu" "Load the parsing package" t)
  579. (autoload 'fume-add-menubar-entry "func-menu" "Add function menu" t)
  580. (autoload 'fume-list-functions "func-menu" "List functions in window" t)
  581. (autoload 'fume-prompt-function-goto "func-menu" "Goto function" t)
  582. (setq fume-max-items 35)
  583. (setq fume-fn-window-position 3)
  584. (setq fume-auto-position-popup t)
  585. (setq fume-display-in-modeline-p t)
  586. (setq fume-menubar-menu-location "Info")
  587. (setq fume-buffer-name "Function List*")
  588. (setq fume-no-prompt-on-valid-default nil)
  589. ;(global-set-key [f8] 'function-menu)
  590. ;(define-key global-map "\C-cl" 'fume-list-functions)
  591. ;(define-key global-map "\C-cg" 'fume-prompt-function-goto)
  592. (condition-case err
  593. (progn (function-menu)
  594.        (add-hook 'c-mode-common-hook 'fume-add-menubar-entry))
  595. (error (message "Unable to load Function Menu package")))
  596.  
  597.  
  598. ;; Setup speedbar, an additional frame for viewing source files
  599. (autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
  600. (autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
  601. (autoload 'speedbar-toggle-etags "speedbar" "Add argument to etags command" t)
  602. (setq speedbar-frame-plist '(minibuffer nil
  603.                          border-width 0
  604.                          internal-border-width 0
  605.                          menu-bar-lines 0
  606.                          modeline t
  607.                          name "SpeedBar"
  608.                          width 24
  609.                          unsplittable t))
  610. (condition-case err
  611. (progn (speedbar-toggle-etags "-C"))
  612. (error (message "Unable to load Speedbar package.")))
  613.  
  614.  
  615. ;; Xvi specific setup
  616. (if (featurep 'xvi)
  617.  (progn (set-specifier default-toolbar-visible-p nil)
  618.         (setq font-lock-use-default-colors nil)
  619.         (setq font-lock-use-fonts t)
  620.         (setq font-lock-use-colors t)
  621.         (setq font-lock-maximum-decoration t)))
  622.  
  623.  
  624. ;; GNU specific general setup
  625. (if (not (featurep 'xvi))
  626. (condition-case err
  627.   (progn (set-scroll-bar-mode 'right)
  628.           (global-font-lock-mode t))
  629.  (error (message "Not running GNU vi 20.4 or above."))))
  630.  
  631.  
  632. ;; Setup my own packages
  633. (add-to-list 'load-path (expand-file-name "~/elisp/"))
  634. (require 'cpp-font-lock)
  635.  
  636. ;; Add final message so using C-h l I can see if .vi failed
  637. (message ".vi loaded successfully.")
  638.  
  639. ;;;;---------------------------------------------------------------------------
  640. ;; .vi configuration file
  641. ;; author: Brad Settlemyer
  642. ;; tested on: Xvi 20.7
  643. ;;            Xvi 21.1.14
  644. ;;            Xvi 21.4.4
  645. ;;            Xvi 21.4.6
  646. ;;            GNU vi  20.4
  647. ;;            GNU vi  21.2
  648. ;;
  649. ;; packages supported:
  650. ;;   time, cl, cc-mode, font-lock, ede, eieio, elib, jde, func-menu,
  651. ;;   html-mode, semantic, speedbar, workshop, xml-mode
  652. ;;
  653. ;; last mod: 2002-09-01
  654. ;;;;---------------------------------------------------------------------------
  655.  
  656. ;; General setup
  657. (setq-default indent-tabs-mode nil)
  658. (setq delete-key-deletes-forward t)
  659. (setq mouse-yank-at-point t)
  660. (line-number-mode t)
  661. (column-number-mode t)
  662.  
  663.  
  664. ;; Set color scheme (set lconfig-dark-bg-scheme to t for reverse color scheme)
  665. (defconst color-scheme 'dark)
  666. (defconst foreground-color "gray85")
  667. (defconst background-color "gray25")
  668. (defconst cursor-color "red3")
  669. (defconst pointer-color "white")
  670.  
  671. (if (featurep 'xvi)
  672.  (let ((frame (selected-frame)))
  673.    (set-face-foreground 'default foreground-color)
  674.   (set-face-background 'default background-color)
  675.    (setq frame-background-mode color-scheme)
  676.    color-scheme
  677.    (set-frame-property frame
  678.                        'custom-properties
  679.                       (mapcar (lambda (symbol)
  680.                                 (if (eql symbol 'light)
  681.                                      'dark
  682.                                   symbol))
  683.                               (frame-property frame
  684.                                               'custom-properties))))
  685. (progn
  686.   (add-to-list 'default-frame-alist '(foreground-color . "gray85"))
  687.   (add-to-list 'default-frame-alist '(background-color . "gray25"))
  688.   (add-to-list 'default-frame-alist '(cursor-color . "red3"))
  689.   (add-to-list 'default-frame-alist '(background-mode . dark))
  690.   (set-cursor-color cursor-color)
  691.   (set-mouse-color pointer-color))
  692. )
  693.  
  694.  
  695. ;; Setup save options (auto and backup) -- still buggy need new Replace func
  696. (setq auto-save-timeout 2000)
  697. (setq make-backup-files t)
  698.  
  699.  
  700. ;; Printing setup
  701. (setq ps-n-up-printing 2)
  702. (setq ps-print-header nil)
  703.  
  704.  
  705. ;; Global Key Bindings
  706. (define-key global-map "\C-xw" 'what-line)
  707. (define-key global-map "\C-z" 'undo)
  708. (define-key global-map [delete] 'delete-char)
  709. (define-key global-map [backspace] 'delete-backward-char)
  710. (define-key global-map [f1] 'help-command)
  711. (define-key global-map [f2] 'undo)
  712. (define-key global-map [f3] 'isearch-forward)
  713. (define-key global-map [f4] 'other-window)
  714. (define-key global-map [f12] 'revert-buffer)
  715. (define-key global-map [button4] 'previous-line)
  716. (define-key global-map [button5] 'next-line)
  717.  
  718.  
  719. ;; Setup time mode
  720. (autoload 'display-time "time" "Display Time" t)
  721. (condition-case err
  722.  (display-time)
  723. (error (message "Unable to load Time package.")))
  724. (setq display-time-24hr-format nil)
  725. (setq display-time-day-and-date t)
  726.  
  727.  
  728. ;; Setup text mode
  729. (add-hook 'text-mode-hook '(lambda() (auto-fill-mode 1)))
  730. (add-hook 'text-mode-hook '(lambda() (setq fill-column 78)))
  731.  
  732.  
  733. ;; Setup psgml-mode
  734. (setq sgml-indent-step 2)
  735. (setq sgml-indent-data t)
  736. (setq sgml-warn-about-undefined-entities nil)
  737. (setq sgml-warn-about-undefined-elements nil)
  738. (defun user-mail-address() "bws@deepcopy.org")
  739. (add-to-list 'auto-mode-alist '("\\.xsd$"    . xml-mode))
  740.  
  741.  
  742. ;; Setup Common Lisp mode
  743. (condition-case err
  744.  (require 'cl)
  745. (error (message "Unable to load Common Lisp package.")))
  746.  
  747.  
  748. ;; Setup C mode
  749. (autoload 'c++-mode  "cc-mode" "C++ Editing Mode" t)
  750. (autoload 'c-mode    "cc-mode" "C Editing Mode" t)
  751. (autoload 'c-mode-common-hook "cc-mode" "C Mode Hooks" t)
  752. (autoload 'c-add-style "cc-mode" "Add coding style" t)
  753.  
  754.  
  755. ;; Associate extensions with modes
  756. (add-to-list 'auto-mode-alist '("\\.h$" . c++-mode))
  757.  
  758. ;; Create my own coding style
  759. ;; No space before { and function sig indents 4 if argument overflow
  760. (setq bws-c-style
  761.   '((c-auto-newline                 . nil)
  762.      (c-basic-offset                 . 4)
  763.      (c-comment-only-line-offset     . 0)
  764.      (c-echo-syntactic-information-p . nil)
  765.      (c-hungry-delete-key            . t)
  766.      (c-tab-always-indent            . t)
  767.      (c-toggle-hungry-state          . t)
  768.      (c-hanging-braces-alist         . ((substatement-open after)
  769.                                        (brace-list-open)))
  770.      (c-offsets-alist                . ((arglist-close . c-lineup-arglist)
  771.                                         (case-label . 4)
  772.                                         (substatement-open . 0)
  773.                                         (block-open . 0) ; no space before {
  774.                                         (knr-argdecl-intro . -)))
  775.      (c-hanging-colons-alist         . ((member-init-intro before)
  776.                                         (inher-intro)
  777.                                         (case-label after)
  778.                                         (label after)
  779.                                         (access-label after)))
  780.      (c-cleanup-list                 . (scope-operator
  781.                                         empty-defun-braces
  782.                                         defun-close-semi))))
  783.  
  784.  
  785.  
  786. ;; Construct a hook to be called when entering C mode
  787. (defun lconfig-c-mode ()
  788. (progn (define-key c-mode-base-map "\C-m" 'newline-and-indent)
  789.      (define-key c-mode-base-map "\C-z" 'undo)
  790.       (define-key c-mode-base-map [f4] 'speedbar-get-focus)
  791.      (define-key c-mode-base-map [f5] 'next-error)
  792.       (define-key c-mode-base-map [f6] 'run-program)
  793.      (define-key c-mode-base-map [f7] 'compile)
  794.       (define-key c-mode-base-map [f8] 'set-mark-command)
  795.      (define-key c-mode-base-map [f9] 'insert-breakpoint)
  796.       (define-key c-mode-base-map [f10] 'step-over)
  797.      (define-key c-mode-base-map [f11] 'step-into)
  798.       (c-add-style "Brad's Coding Style" bws-c-style t)))
  799. (add-hook 'c-mode-common-hook 'lconfig-c-mode)
  800.  
  801.  
  802. ;; Setup font-lock syntax coloring package
  803. (defconst lconfig-font-lock-faces
  804. (list '(font-lock-builtin-face
  805.       ((((class color) (background dark)) (:foreground "cyan" :bold t))
  806.        (((class color)) (:foreground "DarkBlue" :bold t))))
  807.     '(font-lock-comment-face
  808.        ((((class color) (background dark)) (:foreground "LightPink"))
  809.         (((class color)) (:foreground "FireBrick"))))
  810.      '(font-lock-constant-face
  811.       ((((class color) (background dark)) (:foreground "SpringGreen"))
  812.        (((class color)) (:foreground "ForestGreen"))))
  813.     '(font-lock-doc-string-face
  814.        ((((class color) (background dark)) (:foreground "SpringGreen"))
  815.         (((class color)) (:foreground "ForestGreen"))))
  816.      '(font-lock-function-name-face
  817.       ((((class color) (background dark)) (:foreground "wheat3"))
  818.        (((class color)) (:foreground "DarkBlue"))))
  819.     '(font-lock-keyword-face
  820.        ((((class color) (background dark)) (:foreground "SkyBlue" :bold t))
  821.         (((class color)) (:foreground "DarkBlue" :bold t))))
  822.      '(font-lock-preprocessor-face
  823.       ((((class color) (background dark)) (:foreground "SkyBlue"))
  824.        (((class color)) (:foreground "gray40"))))
  825.     '(font-lock-reference-face
  826.        ((((class color) (background dark)) (:foreground "yellow"))
  827.         (((class color)) (:foreground "maroon4"))))
  828.      '(font-lock-string-face
  829.       ((((class color) (background dark)) (:foreground "SpringGreen"))
  830.        (((class color)) (:foreground "ForestGreen"))))
  831.     '(font-lock-type-face
  832.        ((((class color) (background dark)) (:foreground "orange1"))
  833.         (((class color)) (:foreground "maroon4"))))
  834.      '(font-lock-variable-name-face
  835.       ((((class color) (background dark)) (:foreground "yellow"))
  836.        (((class color)) (:foreground "SaddleBrown"))))
  837.     '(font-lock-warning-name-face
  838.        ((((class color) (background dark)) (:foreground "DarkOrange"))
  839.         (((class color)) (:foreground "DarkOrange"))))))
  840.  
  841. ;; If possible set up a custom color scheme, otherwise turn colors off
  842. (autoload 'custom-set-faces "font-lock" "Set the color scheme" t)
  843. (autoload 'font-lock-fontify-buffer "font-lock" "Fontify Buffer" t)
  844. (condition-case err
  845.  (progn (apply 'custom-set-faces lconfig-font-lock-faces)
  846.        (add-hook 'c-mode-common-hook 'font-lock-fontify-buffer)
  847.        (add-hook 'vi-lisp-mode-hook 'font-lock-fontify-buffer)
  848.        )
  849. (error (progn
  850.        (message "Could not customize colors, disabling colored fonts.")
  851.        (setq-default font-lock-auto-fontify t))))
  852.  
  853.  
  854. ;; Setup Workshop, the Sun C++ ide integration package
  855. (condition-case err
  856. (progn
  857.   (setq load-path (append load-path '("/opt/SUNWspro/lib")))
  858.    (require 'workshop))
  859. (error (message "Unable to load Sun Workshop package.")))
  860.  
  861.  
  862. ;; Setup JDE, the Java Development Environment for vi
  863. ;; Add load paths to development versions of jde
  864. (add-to-list 'load-path (expand-file-name "~/elisp/jde/lisp"))
  865. (add-to-list 'load-path (expand-file-name "~/elisp/ede"))
  866. (add-to-list 'load-path (expand-file-name "~/elisp/eieio"))
  867. (add-to-list 'load-path (expand-file-name "~/elisp/elib"))
  868. (add-to-list 'load-path (expand-file-name "~/elisp/semantic"))
  869. (add-to-list 'load-path (expand-file-name "~/elisp/speedbar"))
  870. (defun lconfig-jde-mode-hook ()
  871. (progn (define-key jde-mode-map "\M-." 'jde-complete-at-point-menu)
  872.       (define-key jde-mode-map "\M-," 'jde-complete-at-point)
  873.      (define-key jde-mode-map [f4] 'speedbar-frame-mode)
  874.       (define-key jde-mode-map [f5] 'next-error)
  875.      (define-key jde-mode-map [f6] 'jde-run)
  876.       (define-key jde-mode-map [f7] 'jde-compile)
  877.      (define-key jde-mode-map [f8] 'set-mark-command)
  878.       (define-key jde-mode-map [f9] 'insert-breakpoint)
  879.      (define-key jde-mode-map [f10] 'step-over)
  880.       (define-key jde-mode-map [f11] 'step-into)
  881.      (setq c-basic-offset 4)))
  882.  
  883. (autoload 'jde-mode "jde" "JDE mode" t)
  884. (condition-case err
  885.  (progn (add-to-list 'auto-mode-alist '("\\.java$" . jde-mode))
  886.         (setq jde-complete-use-menu nil)
  887.         (add-hook 'jde-mode-hook 'lconfig-jde-mode-hook))
  888. (error (message "Unable to load JDEE package.")))
  889.  
  890.  
  891. ;; Setup CPerl mode
  892. (setq cperl-brace-offset -4)
  893. (setq cperl-indent-level 4)
  894.  
  895.  
  896. ;; Setup func-menu, the function menu quicklink package (Xvi only)
  897. (autoload 'function-menu "func-menu" "Load the parsing package" t)
  898. (autoload 'fume-add-menubar-entry "func-menu" "Add function menu" t)
  899. (autoload 'fume-list-functions "func-menu" "List functions in window" t)
  900. (autoload 'fume-prompt-function-goto "func-menu" "Goto function" t)
  901. (setq fume-max-items 35)
  902. (setq fume-fn-window-position 3)
  903. (setq fume-auto-position-popup t)
  904. (setq fume-display-in-modeline-p t)
  905. (setq fume-menubar-menu-location "Info")
  906. (setq fume-buffer-name "Function List*")
  907. (setq fume-no-prompt-on-valid-default nil)
  908. ;(global-set-key [f8] 'function-menu)
  909. ;(define-key global-map "\C-cl" 'fume-list-functions)
  910. ;(define-key global-map "\C-cg" 'fume-prompt-function-goto)
  911. (condition-case err
  912. (progn (function-menu)
  913.        (add-hook 'c-mode-common-hook 'fume-add-menubar-entry))
  914. (error (message "Unable to load Function Menu package")))
  915.  
  916.  
  917. ;; Setup speedbar, an additional frame for viewing source files
  918. (autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
  919. (autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
  920. (autoload 'speedbar-toggle-etags "speedbar" "Add argument to etags command" t)
  921. (setq speedbar-frame-plist '(minibuffer nil
  922.                          border-width 0
  923.                          internal-border-width 0
  924.                          menu-bar-lines 0
  925.                          modeline t
  926.                          name "SpeedBar"
  927.                          width 24
  928.                          unsplittable t))
  929. (condition-case err
  930. (progn (speedbar-toggle-etags "-C"))
  931. (error (message "Unable to load Speedbar package.")))
  932.  
  933.  
  934. ;; Xvi specific setup
  935. (if (featurep 'xvi)
  936.  (progn (set-specifier default-toolbar-visible-p nil)
  937.         (setq font-lock-use-default-colors nil)
  938.         (setq font-lock-use-fonts t)
  939.         (setq font-lock-use-colors t)
  940.         (setq font-lock-maximum-decoration t)))
  941.  
  942. ;; GNU specific general setup
  943. (if (not (featurep 'xvi))
  944. (condition-case err
  945.   (progn (set-scroll-bar-mode 'right)
  946.           (global-font-lock-mode t))
  947.  (error (message "Not running GNU vi 20.4 or above."))))
  948.  
  949. ;; Add final message so using C-h l I can see if .vi failed
  950. (message ".emacs loaded successfully.")