Source

mindref-etc / vim / vimrc.local

" Vim options
" ===========
" http://vimdoc.sourceforge.net/htmldoc/options.html

set nocompatible

" Detect the type of file
filetype on
" Load filetype plugins
filetype plugin on
" Load indent files for specific filetypes
filetype indent on

" The title of the window
set title
" Show the line and column number of the cursor position
set ruler
" Show (partial) command in status line.
set showcmd
" Comma separated list of screen columns that are highlighted
set colorcolumn=79
" Maximum width of text that is being inserted.  A longer line will be
" broken after white space to get this width.
set textwidth=79

" Enable syntax highlighting
syntax on
" If using a dark background within the editing area and syntax
" highlighting turn on this option as well
set background=dark
" number of colors
set t_Co=256
" Load color scheme
colorscheme wombat256
" Turn on line numbers
set number

" Convert tabs to spaces
set expandtab
" Tabs = 4 spaces
set tabstop=4
" Indent/outdent 4 spaces
set shiftwidth=4

" Show matching brackets
set showmatch
" how many tenths of a second to blink matching brackets for
set matchtime=5

" Do case insensitive matching
set ignorecase
" Do smart case matching
set smartcase
" Incremental search
set incsearch
" Highlight search
set hlsearch
" Do not redraw while running macros
set lazyredraw
" Automatically save before commands like :next and :make
set autowrite
" Hide buffers when they are abandoned
set hidden
" Enable mouse usage (all modes)
set mouse=a
" make backspace work normal (indent, eol, start)
set backspace=2
" shortens messages to avoid 'press a key' prompt
set shortmess=atI

" how automatic formatting is to be done
set formatoptions=tcrqn
" take indent for new line from previous line
set autoindent
" smart autoindenting for C programs
set smartindent

" Switch off automatic creation of backup files
set nobackup
set nowritebackup
set noswapfile

set termencoding=utf-8
set encoding=utf-8
set fileencodings=utf-8,cp1251

" Disable autoindent in VIM
nnoremap <F8> :setl noai nocin nosi inde=<CR>

" Use Ctrl+S to save file is edit and command modes
inoremap <c-s> <c-o>:w<cr>
nnoremap <c-s> :w<cr>

" Folding
" =======
" zM to fold everything
" zR to unfold everything
" za to toggle the current fold
" zA to recursively toggle the current fold

" Folding based on indentation:
set foldmethod=indent
set nofoldenable

" Explore
" =======

" Hide files and directories
let g:netrw_list_hide = '.pyc,.pyo,.o,.hg,.svn,.egg-info'

" NERDTree
" ========
" https://github.com/scrooloose/nerdtree/blob/master/doc/NERD_tree.txt

" Shorter commands to toggle NERDTree display
nnoremap TT :NERDTreeToggle<CR>

" This option is used to specify which files the NERD tree
" should ignore.  It must be a list of regular expressions.
let NERDTreeIgnore=['\.pyc$', '\.egg-info$', '\.pyo$', '\.gz$', '\.zip$',
    \ '^__pycache__$', '\.o$', '^build$', '^dist$', '^env$']

" Autocmd
" =======

if has("autocmd")
    " Remove any trailing whitespace that is in the file
    autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif

    " Uncomment the following to have Vim jump to the last position when
    " reopening a file
    autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$")
        \ | exe "normal! g'\"" | endif
endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.