Skip to content

Instantly share code, notes, and snippets.

@paul-english
Created November 1, 2017 22:49
Show Gist options
  • Save paul-english/63a05d60b89e9e4dee741b46829df7d1 to your computer and use it in GitHub Desktop.
Save paul-english/63a05d60b89e9e4dee741b46829df7d1 to your computer and use it in GitHub Desktop.
set nocompatible
filetype on "make sure it's on first, otherwise bad exit code
filetype off "Required for Vundle
" Using vundle
" Install with git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
set rtp+=~/.vim/bundle/vundle
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/Vundle.vim'
" My Plugins
Plugin 'taterbase/Colour-Sampler-Pack.git'
Plugin 'taterbase/vim-javascript'
Plugin 'kchmck/vim-coffee-script'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'mattn/gist-vim'
Plugin 'wlangstroth/vim-haskell'
Plugin 'digitaltoad/vim-jade'
Plugin 'groenewege/vim-less'
Plugin 'tpope/vim-markdown'
Plugin 'tpope/vim-surround'
Plugin 'mattn/webapi-vim'
Plugin 'walm/jshint.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'godlygeek/tabular'
Plugin 'jnwhiteh/vim-golang'
Plugin 'scrooloose/nerdtree'
Plugin 'nono/vim-handlebars'
Plugin 'wavded/vim-stylus'
Plugin 'othree/html5.vim'
Plugin 'vimwiki/vimwiki'
Plugin 'davidoc/taskpaper.vim'
Plugin 'jceb/vim-orgmode'
call vundle#end()
" My settings
nmap j gj
nmap k gk
set backspace=indent,eol,start
set hlsearch
set incsearch
set ignorecase
set smartcase
set number
set softtabstop=2
set shiftwidth=2
set expandtab
set scrolloff=5
set history=200
set smartindent
set background=dark
" colorscheme lucius
syntax on
filetype plugin indent on
" Go
set rtp+=$GOROOT/misc/vim
let &t_Co=256
"***** GIST SETUP *****"
"Private gists by default
let g:gist_post_private = 1
"Open web browser after making gist
let g:gist_open_browser_after_post = 1
"Copy gist to clipboard
let g:gist_clip_comman = 'pbcopy'
"Detect file type when gisting
let g:gist_detect_filetype = 1
"***** END GIST SETUP *****"
"Remap leader key
let mapleader=","
nnoremap <leader>a :echo("\<leader\> works! It is set to <leader>")<CR>
"Prevent auto-comments
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
"Auto-closing of braces
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {} {}
inoremap <expr> } strpart(getline('.'), col('.')-1, 1) == "}" ? "\<Right>" : "}"
"Auto-closing of brackets
inoremap [ []<Left>
inoremap <expr> ] strpart(getline('.'), col('.')-1, 1) == "]" ? "\<Right>" : "]"
"Auto-closing parens
inoremap ( ()<Left>
inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
"Tab completion (home made)
inoremap <expr> <Tab> AutoComplete()
inoremap <expr> <S-Tab> ShiftAutoComplete()
func AutoComplete()
let str = strpart(getline('.'), col('.')-2, 1)
if !match(str, "[A-Za-z1-9]")
return "\<C-N>"
else
return "\<Tab>"
endfunc
func ShiftAutoComplete()
let str = strpart(getline('.'), col('.')-2, 1)
if !match(str, "[A-Za-z1-9]")
return "\<C-P>"
else
return "\<Tab>"
endfunc
"Typescript
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
"Remove trailing whitespace from files
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd FileType c,cpp,java,php,ruby,python,javascript,coffeescript autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment