Wednesday, November 30, 2011

Sample configuration files - vimrc, emacs & Xdefaults

Sample ~/.vimrc file
set nocompatible
set nu incsearch ic
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
colorscheme desert
set formatoptions=t
set textwidth=190
set encoding=utf-8
set termencoding=latin1
set fileformat=unix
"set guifont=courier_new:h10
set guifont=Courier\ New:h10,Courier,Lucida\ Console,Letter\ Gothic,
 \Arial\ Alternative,Bitstream\ Vera\ Sans\ Mono,OCR\ A\ Extended
set nowrap
set shiftwidth=2
set vb t_vb=
set novisualbell
set number
set autoindent
set ruler
set expandtab
set whichwrap=<,>,h,l
set guioptions=bgmrL
set backspace=2
set history=50
set backup
set wildmenu
set nrformats=
set foldlevelstart=99
if has("unix")
  set shcf=-ic
endif

let mapleader = ","
let $ADDED = '~/.vim/added/'
if has("win32")
  let $ADDED = $VIM.'/added/'
endif

map <Leader>cd :exe 'cd ' . expand ("%:p:h")<CR>
nmap <F1> :w<CR>
imap <F1> <ESC>:w<CR>a
map <F8> gg"+yG

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let eq = ''
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      let cmd = '""' . $VIMRUNTIME . '\diff"'
      let eq = '"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
VIM Screenshot -
Sample ~/.emacs file
(global-set-key "\C-xv" 'quoted-insert)
(global-set-key "\C-xc" 'compile)
(global-set-key "\C-xt" 'text-mode);
(global-set-key "\C-xa" 'repeat-complex-command);
(global-set-key "\C-xm" 'manual-entry);
(global-set-key "\C-xw" 'what-line);
(global-set-key "\C-x\C-u" 'shell);
(global-set-key "\C-x0" 'overwrite-mode);
(global-set-key "\C-x\C-r" 'toggle-read-only);
(global-set-key "\C-t" 'kill-word);
(global-set-key "\C-u" 'backward-word);
(global-set-key "\C-h" 'backward-delete-char-untabify);
(global-set-key "\C-x\C-m" 'not-modified);
(setq text-mode-hook 'turn-on-auto-fill)

;; to enable line numbers
(global-linum-mode 1)
;; do off wrapping lines
(setq-default truncate-lines t)
;; to disable start up message
(setq inhibit-startup-message t)
;; to enable column mode
(setq column-number-mode t)

;; for jsp and html mode open with nxml mode
(setq auto-mode-alist (cons '("\\.html$" . nxml-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.jsp$" . nxml-mode) auto-mode-alist))

;; To remove duplicate lines
(defun uniquify-all-lines-region (start end)
      "Find duplicate lines in region START to END keeping first occurrence."
          (interactive "*r")
              (save-excursion
                   (let ((end (copy-marker end)))
                        (while
                           (progn
                             (goto-char start)
                               (re-search-forward "^\\(.*\\)\n\\(\\(.*\n\\)*\\)\\1\n" end t))
                               (replace-match "\\1\n\\2")))))

  (defun remove-duplicate-lines ()
        "Delete duplicate lines in buffer and keep first occurrence."
            (interactive "*")
                (uniquify-all-lines-region (point-min) (point-max)))

Sample ~/.Xdefaults file
emacs*pointerColor: Orchid
emacs*bitmapIcon: on
emacs.geometry: 180x50

Emacs.background: ivory
Emacs.foreground: MidnightBlue

Emacs.modeline*attributeForeground:     MidnightBlue
Emacs.modeline*attributeBackground:     Bisque

Emacs.text-cursor*attributeBackground:  Red3
Emacs.pointer*attributeForeground:      Red3
Emacs.pointer*attributeBackground:      Red3
Emacs*menubar*Foreground:               MidnightBlue
Emacs*menubar*Background:               Bisque1
Emacs*popup*Foreground:                 MidnightBlue
Emacs*popup*Background:                 Bisque1

Emacs.default.attributeFont:  -adobe-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-*

xterm*geometry:        130x40
xterm*faceName:        monofur
xterm*faceSize:        12
xterm*background:    #222222
xterm*foreground:    #ddccbb
xterm*metaSendsEscape:    true
xterm*colorBD:        #ffffff
xterm*colorBDMode:    true
xterm*cursorColor:    #ff9900
xterm*veryBoldColors:    14
xterm*loginShell:    true
xterm*charClass:    33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48,35:48,58:48
xterm*jumpScroll:    true
xterm*multiScroll:    true
xterm*boldMode:        true

Emacs screenshot

xterm screenshot



No comments:

Post a Comment