Created
October 20, 2016 13:47
-
-
Save harvzor/cb98f1e58bb6cb3d047c2d67c2571416 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Sections: | |
" -> General | |
" -> VIM user interface | |
" -> Colors and Fonts | |
" -> Files, backups and undo | |
" -> Text, tab and indent related | |
" -> Moving around, tabs and buffers | |
" -> Editing mappings | |
" -> Helper functions | |
" -> Variables | |
" -> Misc | |
" -> Pre stuff | |
" | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => General | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Enable fileype plugins | |
filetype plugin on | |
"filetype indent on | |
" Set to autoread when a file is externally modified | |
set autoread | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => VIM user inteface | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Set 7 lines to the curost - when moving vertically using j/k ? | |
set so=7 | |
" Always show current position | |
set ruler | |
" Height of the command bar | |
set cmdheight=1 | |
" Configure backspace so it acts as normal | |
set backspace=eol,start,indent | |
set whichwrap+=<,>,h,l | |
" Highlight search results | |
set hlsearch | |
" Makes search asct like search in modern browsers | |
set incsearch | |
" Show matching brackets when text indicator is over them | |
set showmatch | |
" How many tenths of a second to blink when matching brackets | |
set mat=2 | |
" No annoying sounds on errors | |
set noerrorbells | |
set visualbell | |
set t_vb= | |
set tm=500 | |
" Allow mouse | |
set mouse=a | |
""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Colors and Fonts | |
""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Enable syntax highlighting | |
syntax enable | |
" Font | |
set guifont=Consolas | |
" Colorscheme | |
set background=dark | |
"let g:solarized_termcolors=256 | |
colorscheme desert | |
" Set extra options when runnning in GUI mode | |
if has("gui_running") | |
set guioptions-=T | |
set guioptions-=m | |
set guioptions+=e | |
set guitablabel=%M\ %t | |
set t_Co=16 | |
endif | |
" Set utf8 as standard encoding and en_US as the standard language | |
scriptencoding utf-8 | |
set encoding=utf-8 | |
" Use Unix as the standard file type | |
set ffs=unix,dos,mac | |
" Highlight whitespace | |
set list | |
set listchars=tab:\:\ | |
au BufNewFile,BufRead *.ejs set filetype=html | |
""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Colors and Fonts | |
""""""""""""""""""""""""""""""""""""""""""""""""" | |
autocmd BufNewFile,BufRead *.less set syntax=scss | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" = Files, backups and undo | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Sets how many lines of history VIM has to remember | |
set history=1000 | |
set undolevels=1000 | |
set confirm "ask about saving rather than having an error | |
set number "add line number | |
set undodir=D:\Backup\Vim\Undo// | |
set backupdir=D:\Backup\Vim\Backups// | |
set dir=D:\Backup\Vim\Swaps// | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Text, tab and indent related | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Be smart when using tabs | |
set smarttab | |
" 1 tab = 4 spaces | |
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab | |
" Line break on 500 characters | |
"set lbr | |
"set tw=500 | |
set ai "Auto indent | |
set si "Smart indent | |
set wrap "Wrap lines | |
" Used for pasting text | |
set pastetoggle=<F3> | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Moving around, tabs, windows and buffers | |
"""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Treat long lines as break lines (useful when moving around in them) | |
map j gj | |
map k gk | |
"Return to the last edit position when opening files (I want this?!) | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line ("'\"") <= line ("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
" Remember info about open buffers on close ? | |
set viminfo^=% | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Status line ? | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" ALways show the status line | |
set laststatus=2 | |
" Format the status line | |
"set statusline=\ %{HasPaste()}%F%m%r%h\ %w \ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Editing mappings | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" Remaps : to ; | |
nnoremap ; : | |
" Pressing <leader>/ will clear the search | |
map <silent> <leader>/ :nohlsearch<CR> | |
" Allows visual selecting with control C (which is then yanked to clipboard) | |
vnoremap <C-c> "*y | |
map <f2> :NERDTreeToggle<CR> :NERDTreeMirror<CR> | |
"quickly edit/reload the vimrc file | |
nmap <silent> <leader>ev :e $MYVIMRC<CR> | |
nmap <silent> <leader>sv :so $MYVIMRC<CR> | |
"autocmd BufReadPre *.scss map <C-S> :w<CR> :!sass --update %<CR><CR> | |
map <S-TAB> <ESC>v< | |
" Disable highlight when <leader><cr> is pressed ? | |
map <silent> <leader><cr> :noh<cr> | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Misc | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" Remove thw Windows ^M - when the encoding gets messed up | |
noremap <leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Helper functions | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" Don't close window when deleting a buffer | |
command! Bclose call <SID>BufcloseCloseIt() | |
function! <SID>BufcloseCloseIt() | |
let l:currentBufNum = bufnr("%") | |
let l:alternateBufNum = bufnr("#") | |
if buflisted(l:alternateBufNum) | |
buffer # | |
else | |
bnext | |
endif | |
if bufnr("%") == l:currentBufNum | |
new | |
endif | |
if buflisted(l:currentBufNum) | |
execute("bdelete! ".l:currentBufNum) | |
endif | |
endfunction | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Variable | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
let $hosts = "C:\\Windows\\System32\\Drivers\\etc\\hosts" | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
" => Pre stuff | |
"""""""""""""""""""""""""""""""""""""""""""""""" | |
set nocompatible | |
source $VIMRUNTIME/vimrc_example.vim | |
source $VIMRUNTIME/mswin.vim | |
behave mswin | |
"set autoindent | |
set showcmd | |
call pathogen#helptags() | |
execute pathogen#infect() | |
"Enable modeline | |
set modeline | |
"Powerline | |
let g:Powerline_symbols = "fancy" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment