Friday, March 16, 2007

$MYVIMRC

My current ~/.vimrc file. The {{{ & }}} mark the locations of folds, I elected to ues folding marks for my rc file. And when I have time to read how, I probably will set it to allow sectional jumping.

In short form, the file ensures that Vim does not read my .exrc file, does not try to be strictly vi compatible. Auto reads changes to files, keeps files at 80 char width (see tw), make for a more comfortable movement pattern near EOL. Yank into the clipboard, enable syntax folding on new files (my preference for sources), DOS EOL for new .txt files. Set somes sizes, enable my 'HUD' ^_^, turn on a nice colour scheme, and syntax highlighting. Set fonts, and a few useful keymaps. :help <option> generally works for looking things up in the manual (help can be shortened to he. with no sexist intent.)

"Terry M. P***** personal vimrc file

" vim: set ts=6 sw=6 expandtab foldmethod=marker foldcolumn=1 foldlevelstart=99:
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"    WARNING !!! 
" This file must have UNIX end of lines to avoid errors when starting
" under unix. Use the pdos2unix and punix2dos sh scripts to convert or
"
" perl -p -e 's/\n/\r\n/' inputfile > outputfile  # UNIX to DOS
" perl -p -e 's/\r\n/\n/' inputfile > outputfile  # DOS to UNIX
"
" on the command line
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Abstract
"
" Editing Preferences - set options related to editing tasks
" User Interface Preferences - set options related to appearance
" Keybinds & Commands - mappings / created 


"""""""""""""""""""""""""""""""
"Editing Options {{{
"""""""""""""""""""""""""""""""

"Don't be VI compatible - Keep this at top of file !
set nocompatible
set noexrc

"automatic re-reading of changed open files
set autoread


"ingore case when searching
set ignorecase

" Use the system clipboard as the default register
set clipboard=unnamed

"Buffer related {{{
"Allow backspacing over everything in insert mode
set backspace=indent,eol,start
"Allow to go one space past EOL
set virtualedit=onemore
"Allow left/right movement at EOL to move to start of next line
set whichwrap=hl<>
"Wrap text at n chars with a line break
set textwidth=80
"set wrap
set linebreak

"Folding
if has("gui_running")
      set foldmethod=manual
      set foldcolumn=0
else
      "Use sytanx folding in console mode
      autocmd BufNewFile,BufRead *set foldmethod=syntax foldcolumn=1
endif

"}}}

"Size stuff {{{
"Tab length and shift lengths
set tabstop=8
set shiftwidth=4

"Set min # of spaces for numberwidth. It grows as needed
set numberwidth=2

"Set tab menu 0=never, 1=when more then one, 2=always
set showtabline=1

" Start with folds open
set foldlevelstart=99

"}}}

"File related {{{

"Set prefered line file formats
set ffs=unix,dos,mac
"Enable filetype detection
filetype on
"Turn off ft plugin and indent
filetype plugin off
filetype indent off

" Create new.txt files notepad ready
autocmd BufNewFile *.txt set ff=dos

"Enable syntax highlighting
if &t_Co > 2 || has("gui_running")
      syntax on
endif

" Highlight strings inside C comments
"let c_comment_strings=1


"}}}

" }}}
"""""""""""""""""""""""""""""""
" Keybindings {{{
"""""""""""""""""""""""""""""""

"Maps {{{

"Use the ";" as a duplicate of ":" makes life so much easier
"for some odd reason it cannot be followed with a comment on it's line!
:nma ; :

"F1 turns on spellchecking in current buffer
map  :setlocal spell spelllang=en_us

"F2 turn on line numbering
map  :set number

"F3 turn on self indenting magic
map  :set smartindent autoindent

"F10 rids us of ^M after carriage returns
map  :%s// /g

"}}}

"}}} 
"""""""""""""""""""""""""""""""
"User Interface Options {{{
"""""""""""""""""""""""""""""""

"Always show the status bar with file name e.t.c.
set laststatus=2
"Show %of file in statusbar
set ruler 

"Command line completion lists possible matches
set wildmode=list:full

"Start with mouse support
set mouse=a
"Hide the mouse when typing text
set mousehide 

" Dependant on GUI on/off {{{
if has ("gui_running") 
      "Set colo and options
      colorscheme denim
      " Set 'go' to:
      "autoselect, console dialogs, tabpages, icon, menubar, show grey menu
      "items, tearoff menu items, Toolbar, always right scrollbar.
      set guioptions=aceimgtTr

      "Make pointer an I-Beam in insert mode
      set mouseshape=i:beam
      "for spellchecking
      set mousemodel=popup_setpos
      "set cmd line size
      set cmdheight=2

      "Set windows specifics
      if has("win32")
            "Windows font
            set guifont=Fixedsys:h7:cANSI
      "Set x11 specifics
      elseif has("x11")
            set guifont=Fixed\ Semi-Condensed\ 13 
            set columns=80
            set lines=35
      endif
else
      "set colors for terminal
      colo advantage
      "set cmd line size
      set cmdheight=1
endif

"}}}

" }}}

No comments:

Post a Comment