Skip to content

Instantly share code, notes, and snippets.

@azizshamim
Created December 5, 2011 16:48
Show Gist options
  • Save azizshamim/1434267 to your computer and use it in GitHub Desktop.
Save azizshamim/1434267 to your computer and use it in GitHub Desktop.
" This is Aziz's .vimrc file, that he is currently working on.
set nocompatible
syntax enable
" Use pathogen to easily modify the runtime path to include all
" plugins under the ~/.vim/bundle directory
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
let g:JSLintHightlightErrorLine = 0
color koehler
" Colorscheme bullshit
"set background=light
"if has("gui_running")
" augroup RCVisual
" autocmd!
" autocmd GUIEnter * colorscheme solarized
" augroup END
"else
" colorscheme koehler
"endif
"-----------------------------------------------------------------------------
" Change Behaviour
"-----------------------------------------------------------------------------
set hidden
set backspace=indent,eol,start " This sets the backspace function
set ruler " Adds the cursor position at the bottom
set showcmd " shows the commands that are typed into VI next to the ruler
set showmode " shows current mode
"set shortmess+=r " use [RO] for readonly to save space at the bottom of the screen
set history=1000 " sets history to last 50 commands
set number " turn on line numbering
set undolevels=1000 " use mucho levels of undo
set title " change the terminal title ?
set visualbell " no beep
set noerrorbells " no errors
set nobackup " no backups please
set list " set listchars off
set listchars=tab:>-,trail:- "tabs and trailing white spaces show as dashes
set noswapfile " remove the swapfile, save dropbox
set background=dark " fix the colors
"-----------------------------------------------------------------------------
" Mapped Keys
"-----------------------------------------------------------------------------
let mapleader="," " change mapleader from \ to ,
" sudo write
cmap w!! %!sudo tee > /dev/null %
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" use ; just like :
nnoremap ; :
" fast reformat
vmap Q gq
nmap Q gqap
" diable the arrow keys (learn how to move)
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" change how the cursor moves over wrapped lines
"nnoremap j gj
"nnoremap k gk
" Easy window navigation (no more ctrl-w)
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" clear out searching
nmap <silent> ,/ :let @/=""<CR>
" buffer traversal
nmap <silent> <leader>n :bn<CR>
nmap <silent> <leader>p :bp<CR>
"-----------------------------------------------------------------------------
" TEXT FORMATTING -- GENERAL
"-----------------------------------------------------------------------------
set nowrap " sets line not to wrap. shows only line breaks.
set expandtab
set autoindent " sets the indent to be copied down the lines
set copyindent " copy the previous indentation on autoindenting
set tabstop=2 " a tab is four spaces
set shiftwidth=2 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set pastetoggle=<F3> " Use <F3> before pasting to remove autoindenting
"set textwidth=81 " fix the text width
"-----------------------------------------------------------------------------
" NERD Tree Plugin Settings
"-----------------------------------------------------------------------------
" Toggle the NERD Tree on an off with F7
nmap <F7> :NERDTreeToggle<CR>
nmap ,m :NERDTreeClose<CR>:NERDTreeToggle<CR>
" Close the NERD Tree with Shift-F7
"nmap <S-F7> :NERDTreeClose<CR>
" Store the bookmarks file in perforce
let NERDTreeBookmarksFile="~/.vim/NERDTreeBookmarks"
" Don't display these kinds of files
let NERDTreeIgnore=[ '\.ncb$', '\.suo$', '\.vcproj\.RIMNET', '\.obj$',
\ '\.ilk$', '^BuildLog.htm$', '\.pdb$', '\.idb$',
\ '\.embed\.manifest$', '\.embed\.manifest.res$',
\ '\.intermediate\.manifest$', '^mt.dep$' ]
let NERDTreeShowBookmarks=1 " Show the bookmarks table on startup
let NERDTreeShowFiles=1 " Show hidden files, too
let NERDTreeShowHidden=1
let NERDTreeQuitOnOpen=1 " Quit on opening files from the tree
let NERDTreeHighlightCursorline=1 " Highlight the selected entry in the tree
let NERDTreeMouseMode=2 " Use a single click to fold/unfold directories
" and a double click to open files
"-----------------------------------------------------------------------------
" TEXT FORMATING -- SPECIFIC FILES
"-----------------------------------------------------------------------------
filetype on " enable filetype detection
filetype plugin on
filetype indent on
"-----------------------------------------------------------------------------
" PUPPET
"-----------------------------------------------------------------------------
autocmd BufRead,BufNewFile *.pp set filetype=puppet
autocmd FileType puppet set smartindent
autocmd FileType puppet set expandtab tabstop=2 shiftwidth=2
autocmd FileType puppet set background=dark
"-----------------------------------------------------------------------------
" RUBY
"-----------------------------------------------------------------------------
autocmd FileType ruby set smartindent
autocmd FileType ruby set expandtab tabstop=2 shiftwidth=2
autocmd FileType ruby set background=dark
"-----------------------------------------------------------------------------
" for Perl programming, have things in braces indenting themselves:
"-----------------------------------------------------------------------------
autocmd FileType perl set smartindent
autocmd FileType perl set expandtab tabstop=2 shiftwidth=2
"-----------------------------------------------------------------------------
" for HTML, format text except for long lines
"-----------------------------------------------------------------------------
autocmd FileType html set formatoptions+=t1
" for HTML use tab chars for indentation
autocmd FileType html set expandtab tabstop=2
"-----------------------------------------------------------------------------
" ADD FOR PHP PROGRAMMING
"-----------------------------------------------------------------------------
autocmd FileType php set smartindent
"-----------------------------------------------------------------------------
" Add for Makefile
"-----------------------------------------------------------------------------
autocmd FileType make set noexpandtab tabstop=8
"-----------------------------------------------------------------------------
" Clipper
"-----------------------------------------------------------------------------
autocmd FileType clipper set ignorecase
autocmd FileType clipper set tw=0
autocmd FileType clipper map <F6> :call FoxPro_clean()<CR>
autocmd FileType clipper imap <F5> ,&m0invmf..ndx,&m0invcf..ndx,&m0invpf..ndx,&m0invdf..ndx
autocmd FileType clipper map <F8> /arinv<CR>
autocmd FileType clipper map <F7> :call FoxPro_indent()<CR>
"-----------------------------------------------------------------------------
" Javascript
"-----------------------------------------------------------------------------
autocmd BufRead,BufNewFile *.coffee set filetype=coffee
autocmd FileType javascript set expandtab tabstop=2 shiftwidth=2
autocmd FileType coffee set expandtab tabstop=2 shiftwidth=2
"-----------------------------------------------------------------------------
" Functions
"-----------------------------------------------------------------------------
"" Cleans the code by
":function! FoxPro_clean()
"" setting the file format to unix
": set ff=unix
"" replacing the && comment indicators with the more standard //
": %s/&&/\/\//g
"" removing trailing spaces
": %s/\s*$//g
"" making multiple lines, one line
": %s/;\s*\n/ /g
"" replacing * comment indicator with the more standard //
": %s/^\(\s*\)\*\s*/\1\/\//g
"" removing blank lines
": g/^\s*$/d
"" going back to the top
": normal gg
":endfunction
" Removes the indents from the code and runs the prg_align.pl perl program in
" order to add the alignments again.
":function! FoxPro_indent()
": %s/^\s*//g
": %!prg_align.pl
":endfunction
"-----------------------------------------------------------------------------
" Status Line
"-----------------------------------------------------------------------------
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set laststatus=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment