Skip to content

Instantly share code, notes, and snippets.

@dehuszar
Last active December 21, 2022 05:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dehuszar/5ab46ce3bed4b8b77061 to your computer and use it in GitHub Desktop.
Save dehuszar/5ab46ce3bed4b8b77061 to your computer and use it in GitHub Desktop.
This is my roaming vim config so I can quickly set up my preferred vim set up at new machines
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType html,hbs,handlebars,php setlocal omnifunc=htmlcomplete#CompleteTags
autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
autocmd BufEnter * lcd %:p:h
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
nnoremap <silent> <A-k> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-j> :execute 'silent! tabmove ' . (tabpagenr()+1)<CR>
nmap <C-V> "+gp
imap <C-V> <ESC><C-V>a
vmap <C-C> "+y
map <C-n> :NERDTreeToggle<CR>
map <Enter> o<ESC>
map <S-Enter> O<ESC>
let g:airline#extensions#tabline#enabled = 1
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
" 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
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exe = 'npm run lint --'
" Multi-Cursor config
let g:multi_cursor_use_default_mapping=0
let g:multi_cursor_start_key='<F6>'
let g:multi_cursor_next_key='<C-.>'
let g:multi_cursor_prev_key='<C-,>'
let g:multi_cursor_skip_key='<C-/>'
let g:multi_cursor_quit_key='<Esc>'
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
" let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
" let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
set number
set ruler
syntax on
set background=light
set t_Co=16
let g:solarized_termcolors=256
colorscheme solarized
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
set encoding=utf-8
let g:airline_powerline_fonts = 1 " you need to install fonts from here: https://github.com/powerline/fonts
set gfn=Source\ Code\ Pro\ for\ Powerline
" don't forget to make these folders
set directory=~/.vim/_tmp//
set backupdir=~/.vim/backup//
let g:airline_powerline_fonts = 1 " confirm you actually need to use this line
set nocompatible " be iMproved, required
filetype off " required
" vim-plug configuration
call plug#begin('~/.vim/plugged')
" The following are examples of different formats supported.
" Keep Plug commands between vundle#begin/end.
" plugin on GitHub repo
Plug 'tpope/vim-fugitive'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plug 'rstacruz/sparkup', {'rtp': 'vim/'}
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-surround'
Plug 'shougo/neocomplete.vim'
Plug 'wincent/Command-T'
Plug 'altercation/vim-colors-solarized'
Plug 'kien/ctrlp.vim'
Plug 'rking/ag.vim'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'syngan/vim-vimlint'
Plug 'vim-syntastic/syntastic'
Plug 'mtscout6/syntastic-local-eslint.vim'
Plug 'Raimondi/delimitMate'
Plug 'terryma/vim-multiple-cursors'
Plug 'sheerun/vim-polyglot'
" Initialize plugin system
call plug#end()
" All of your Plugs must be added before the following line
" filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PlugList - list configured plugins
" :PlugInstall(!) - install (update) plugins
" :PlugSearch(!) foo - search (or refresh cache first) for foo
" :PlugClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plug stuff after this line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment