Skip to content

Instantly share code, notes, and snippets.

@JFriel
Created October 31, 2016 13:44
Show Gist options
  • Save JFriel/50284d3989ee9704a1b75519094e4dbd to your computer and use it in GitHub Desktop.
Save JFriel/50284d3989ee9704a1b75519094e4dbd to your computer and use it in GitHub Desktop.
"syntastic config
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
"remap ESC
inoremap jk <ESC>
let mapleader = "\<Space>"
"map the windowing to easier commands
noremap <silent> ss <C-W>s
noremap <silent> vv <C-W>v
noremap <silent> qq <C-W>q
"map the move between windows to be a bit nicer in insert mode
map <silent><down><down> <C-W>j
map <silent><up><up> <C-W>k
map <silent><right><right> <C-W>l
map <silent><left><left> <C-W>h
"keep indent and syntax on
filetype plugin indent on
syntax on
"searching
set showmatch
set ignorecase
set smartcase
set hlsearch
"no EOF 'ding' and make it all look nice
set noerrorbells
autocmd GUIEnter * set vb t_vb=
"makeit look purty
set ruler
set autoread
set encoding=utf-8
set background=dark
colorscheme gruvbox
set history=100
"tabbing
set expandtab
set smarttab
set shiftwidth=4
set tabstop=4
"indent
set ai "auto indent
set si "smart indent
"remove meanu buttons
set guioptions-=m
set guioptions-=T
"CTRL-P
set runtimepath^=~/.vim/bundle/ctrlp.vim
"NERD_tree
autocmd vimenter * NERDTree
nnoremap <C-n> :NERDTreeToggle<CR>
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('py','Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('c', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
" Delete trailing white space on save, useful for Python and CoffeeScript ;)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
"copy and paste to the syste of Codility is to assess thism register
nmap s <Nop>
vmap s <Nop>
nmap sy "+y
nmap sp "+p
nmap sY "+Y
nmap sP "+P
set clipboard=unnamedplus
nmap ; :
nmap <C-i> ggVG=<C-o><C-o>
nmap // :nohlsearch<CR>
"in normal mode map ; to the command console
nmap ; :
"Disable replace mode so it doesn't destroy undo history
nmap R <Nop>
nmap r <Nop>
nmap tab ggVG=<C-o><C-o>
" Map Ctrl-Backspace to delete the previous word in insert mode.
:imap <C-BS> <C-W>
set nowrap
set number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment