Skip to content

Instantly share code, notes, and snippets.

@kulbirsaini
Created August 12, 2020 20:00
Show Gist options
  • Save kulbirsaini/3bf85788a84d1398902584e9c7e74c2f to your computer and use it in GitHub Desktop.
Save kulbirsaini/3bf85788a84d1398902584e9c7e74c2f to your computer and use it in GitHub Desktop.
" Vim Tab Navigation
nmap <Tab> :tabnext <CR>
nmap <s-tab> :tabp <CR>
nmap <C-A> :tabn 1 <CR>
set tabpagemax=100
" Some function keys
nmap <F4> :q<CR>
nmap <F5> :w<CR>
imap <F5> <Esc>:w<CR>
" Vundle
set nocompatible " be iMproved, required
filetype off " required
" 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
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The ultimate tab completion
Plugin 'ervandew/supertab'
" Jedi-Vim Python Completion
"Plugin 'davidhalter/jedi-vim'
" Pyenv with jedi-vim
Plugin 'lambdalisue/vim-pyenv'
" Syntax checking
Plugin 'vim-syntastic/syntastic'
" File Structure
Plugin 'scrooloose/nerdtree'
" Python indentation (especially the opening braces on new line)
Plugin 'vim-scripts/indentpython.vim'
" Most Recently Used Files :MRU, t to open in new tab, o to open in new window
Plugin 'vim-scripts/mru.vim'
" PHP-Twig
Plugin 'lumiliet/vim-twig'
" PHP
Plugin 'StanAngeloff/php.vim'
" Markdown
Plugin 'tpope/vim-markdown'
" XML Edit
Plugin 'sukima/xmledit'
" Javascript
Plugin 'pangloss/vim-javascript'
" Surrouding words/sentences cs"'
Plugin 'tpope/vim-surround'
" Status Bar
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" Fuzzy Finder
Plugin 'vim-scripts/L9'
Plugin 'vim-scripts/FuzzyFinder'
" Tabular
Plugin 'godlygeek/tabular'
" 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
" Disable Python docstring window for jedi-vim
autocmd FileType python setlocal completeopt-=preview
" Syntax checker settings for syntastic
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_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
" NERDTree Specific settings
" Close vim when only NERDTree is open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Toggle NERDTree
map <C-X> :NERDTreeToggle<CR>
" NERDTree 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('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', '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')
" PHP Syntax
function! PhpSyntaxOverride()
hi! def link phpDocTags phpDefine
hi! def link phpDocParam phpType
endfunction
augroup phpSyntaxOverride
autocmd!
autocmd FileType php call PhpSyntaxOverride()
augroup END
" Markdown
let g:markdown_fenced_languages = ['html', 'python', 'bash=sh']
" Javascript
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_ngdoc = 1
let g:javascript_plugin_flow = 1
" Airline
let g:airline_theme='zenburn'
" Fuzzy Finder
map <C-T> :tabe<CR>:FufFile<CR>
""""""""""""""""""""""""""""""""""
" NON PLUGIN SETTINGS AFTER THIS "
""""""""""""""""""""""""""""""""""
set hlsearch
set incsearch
set cindent
set autoindent
set smartindent
set undolevels=1000
set mouse=n
set scrolloff=3
" Automatically setting options in various files
set modeline
" Don't add EOF at end of file
set noendofline
" matching braces
set showmatch
set matchtime=2
set matchpairs+=<:>
" time out on mapping after one second, time out on key codes after
" a tenth of a second
set timeout timeoutlen=1000 ttimeoutlen=100
" The screen will not be redrawn while executing macros, registers
" and other commands that have not been typed. To force an updates use |:redraw|.
set lazyredraw
" set dictionary
set dictionary=/usr/share/dict/words
syntax enable
filetype on
filetype plugin on
filetype indent on
set expandtab
" Indent of 1 tab with size of 4 spaces
set tabstop=4
set shiftwidth=4
" Don't save backups of files.
set nobackup
set backupcopy=yes
set noerrorbells
set visualbell
set t_vb=
" Display full file path
set statusline+=%F
" Colors {{{
set background=dark
hi StatusLine term=bold,reverse cterm=bold,reverse ctermbg=Black
hi StatusLineNC term=reverse cterm=reverse
hi User1 term=inverse,bold cterm=inverse,bold ctermfg=Red
hi User2 term=bold cterm=bold ctermfg=Yellow
hi User3 term=inverse,bold cterm=inverse,bold ctermfg=Blue
hi User4 term=inverse,bold cterm=inverse,bold ctermfg=LightBlue
hi User5 term=inverse,bold cterm=inverse,bold ctermfg=Red ctermbg=Green
hi Folded term=standout cterm=bold ctermfg=Black ctermbg=White
hi FoldColumn term=standout ctermfg=DarkCyan ctermbg=Black
hi Comment term=bold ctermfg=DarkCyan
" }}}
" Set filetypes
augroup filetypedetect
au BufRead,BufNewFile *.module set filetype=php
augroup END
"autocmd FileType php set tabstop=4 | set shiftwidth=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment