Skip to content

Instantly share code, notes, and snippets.

@jamesfe
Created August 7, 2017 19:29
Show Gist options
  • Select an option

  • Save jamesfe/b6e13378cfdbcfc802204e7785e44f53 to your computer and use it in GitHub Desktop.

Select an option

Save jamesfe/b6e13378cfdbcfc802204e7785e44f53 to your computer and use it in GitHub Desktop.
My VIMRC file
inoremap § <Esc> " fix european keyboards
set tags=tags;/
set clipboard=unnamed
set colorcolumn=120 " Add red line at char 120
set nocompatible " be iMproved, required
filetype off " required
set backspace=2 " Helps with backspace after insert
set number " Line numbers on
" Ack.vim config
let g:ack_mappings = {
\ "t": "<C-W><CR><C-W>T",
\ "T": "<C-W><CR><C-W>TgT<C-W>k",
\ "o": "<CR>",
\ "O": "<CR><C-W>p<C-W>c",
\ "go": "<CR><C-W>p",
\ "j": "<C-W><CR><C-W>J",
\ "J": "<C-W><CR><C-W>J<C-W>b",
\ "v": "<C-W><CR><C-W>H<C-W>b<C-W>K<C-W>t",
\ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>K" }
let g:ycm_autoclose_preview_window_after_completion = 1
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'mileszs/ack.vim' " doesn't seem to be working
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'Yggdroot/indentLine'
" Plugin 'Valloric/YouCompleteMe.git'
" Plugin 'marijnh/tern_for_vim.git'
Plugin 'pangloss/vim-javascript.git' " Turning this on, 18jul2017
Plugin 'scrooloose/syntastic.git' " Turning this on, 18jul2017
Plugin 'scrooloose/nerdtree.git'
Plugin 'leafgarland/typescript-vim.git'
" Avoid a name conflict with L9
"Plugin 'user/L9', {'name': 'newL9'}
" Plugin 'kien/ctrlp.vim'
" Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'andviro/flake8-vim'
" Plugin 'davidhalter/jedi-vim'
Plugin 'avakhov/vim-yaml'
Plugin 'fatih/vim-go'
Plugin 'derekwyatt/vim-scala'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" pUT YOur non-Plugin stuff after this line
" autocmd FileType python set omnifunc=pythoncomplete#Complete
" autocmd FileType {html,xhtml,eruby,xml} set omnifunc=htmlcomplete#CompleteTags
" autocmd FileType css set omnifunc=csscomplete#CompleteCSS
" autocmd FileType php set omnifunc=phpcomplete#CompletePHP
" autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType {xml,xsl,xslt} setlocal iskeyword=@,-,\:,48-57,_,128-167,224-235
autocmd FileType {xsl,xslt} XMLns xhtml10s
autocmd FileType {xsl,xslt} XMLns xsl xsl
" Syntastic has a crummy HTML checker
let g:syntastic_html_checkers=['']
let g:syntastic_check_on_open = 0
set tabstop=4
set shiftwidth=4
set softtabstop=4
set showmatch
set ignorecase
set smartcase
set hlsearch
set showcmd
set cmdheight=2
set laststatus=2
set statusline=%F%m%r%h%w\ %y\ %=[Bfr=%n]\ [%l,%v]\ [%p%%]\
set smarttab
set smartindent
syntax on
set background=dark
set title
set expandtab
set autoindent
" Hide certain files in the explorer
let g:netrw_list_hide= '.*\.swp$,.*\.pyc'
" Command-T Settings Start
set wildignore+=*.swp,*.bak,*.pyc,*.class,*.jar,*.gif,*.png,*.jpg,*.deb,*.whl,*/node_modules/*
let g:CommandTMaxFiles=2000000
let g:CommandTTraverseSCM="pwd"
" Make command t look Ok with a dark bkg
hi PmenuSel term=bold cterm=bold ctermfg=6 guifg=Cyan
" Command-T Settings End
" Keep swp, swo, swn files out of cwd
set backupdir=./.backup,.,/tmp
set directory=.,./.backup,/tmp
" SYNTASTIC SETTINGS START
" 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
" SYNTASTIC SETTINGS END
" Nerd Tree Settings start
map <C-n> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.pyc$', '\.nfs*']
let NERDTreeWinSize=40
let NERDTreeShowHidden=1
" Nerd Tree Settings End
" Mappings for quick js editing
function! JavascriptFiletypeSettings()
imap \f function () {<CR>}<ESC>%?(<CR>a
imap \c console.log();<ESC>jja
imap \d describe("",function () {<CR>});<ESC>F)%f"a
imap \t it("",function () {<CR>});<ESC>F)%f"a
imap \b beforeEach(function () {<CR>});<ESC>O
imap \v var ;<ESC>i
imap \x expect(
imap \s sinon.stub(
set expandtab tabstop=2 softtabstop=2 shiftwidth=2
endfunction
function! PythonFiletypeSettings()
imap <C-y> import pdb; pdb.set_trace()
set expandtab tabstop=4 softtabstop=4 shiftwidth=4
vnoremap # :s#^#\##<cr>:noh<cr>
vnoremap -# :s#^\###<cr>:noh<cr>
" flake 8 thingy
let g:PyFlakeOnWrite = 1
let g:PyFlakeMaxLineLength = 120
let g:PyFlakeDisabledMessages = 'E309,E501'
map <C-p> :PyFlake<CR>
endfunction
function! TypeScriptFiletypeSettings()
set expandtab tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufWrite * :StripWhitespace
endfunction
function! XMLFiletypeSettings()
" Use gg=G to format XML files
set equalprg=xmllint\ --format\ -
endfunction
function! JSONFiletypeSettings()
" Use gg=G to format JSON files
set equalprg=python\ -m\ json\.tool
endfunction
function! GoFiletypeSettings()
vnoremap # :s#^#\/\/#<cr>:noh<cr>
vnoremap -# :s#^\/\/##<cr>:noh<cr>
endfunction
if has('autocmd')
autocmd FileType javascript call JavascriptFiletypeSettings()
autocmd FileType typescript call TypeScriptFiletypeSettings()
autocmd FileType python call PythonFiletypeSettings()
autocmd FileType xml call XMLFiletypeSettings()
autocmd FileType json call JSONFiletypeSettings()
autocmd FileType go call GoFiletypeSettings()
endif
" indent settings start
let g:indentLine_char = '¦'
let g:indentLine_enabled = 0
" indent settings end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment