Created
August 22, 2017 06:51
-
-
Save thehulke/d38acad783b43de9b01efbcf81f9d360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Use the Solarized Dark theme | |
"set background=dark | |
"colorscheme solarized | |
"let g:solarized_termtrans=1 | |
" Make Vim more useful | |
set nocompatible | |
" Use the OS clipboard by default (on versions compiled with `+clipboard`) | |
set clipboard=unnamed | |
" Enhance command-line completion | |
set wildmenu | |
" Allow cursor keys in insert mode | |
set esckeys | |
" Allow backspace in insert mode | |
set backspace=indent,eol,start | |
" Optimize for fast terminal connections | |
set ttyfast | |
" Add the g flag to search/replace by default | |
set gdefault | |
" Use UTF-8 without BOM | |
set encoding=utf-8 nobomb | |
" Change mapleader | |
let mapleader="," | |
" Don’t add empty newlines at the end of files | |
set binary | |
set noeol | |
" Centralize backups, swapfiles and undo history | |
set backupdir=~/.vim/backups | |
set directory=~/.vim/swaps | |
if exists("&undodir") | |
set undodir=~/.vim/undo | |
endif | |
" Don’t create backups when editing files in certain directories | |
set backupskip=/tmp/*,/private/tmp/* | |
" Respect modeline in files | |
set modeline | |
set modelines=4 | |
" Enable per-directory .vimrc files and disable unsafe commands in them | |
set exrc | |
set secure | |
" Enable line numbers | |
set number | |
" Enable syntax highlighting | |
syntax on | |
" Highlight current line | |
set cursorline | |
" Make tabs as wide as two spaces | |
set tabstop=2 | |
" Show “invisible” characters | |
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_ | |
set list | |
" Highlight searches | |
set hlsearch | |
" Ignore case of searches | |
set ignorecase | |
" Highlight dynamically as pattern is typed | |
set incsearch | |
" Always show status line | |
set laststatus=2 | |
" Enable mouse in all modes | |
set mouse=a | |
" Disable error bells | |
set noerrorbells | |
" Don’t reset cursor to start of line when moving around. | |
set nostartofline | |
" Show the cursor position | |
set ruler | |
" Don’t show the intro message when starting Vim | |
set shortmess=atI | |
" Show the current mode | |
set showmode | |
" Show the filename in the window titlebar | |
set title | |
" Show the (partial) command as it’s being typed | |
set showcmd | |
" Use relative line numbers | |
if exists("&relativenumber") | |
set relativenumber | |
au BufReadPost * set relativenumber | |
endif | |
" Start scrolling three lines before the horizontal window border | |
set scrolloff=3 | |
" Strip trailing whitespace (,ss) | |
function! StripWhitespace() | |
let save_cursor = getpos(".") | |
let old_query = getreg('/') | |
:%s/\s\+$//e | |
call setpos('.', save_cursor) | |
call setreg('/', old_query) | |
endfunction | |
noremap <leader>ss :call StripWhitespace()<CR> | |
" Save a file as root (,W) | |
noremap <leader>W :w !sudo tee % > /dev/null<CR> | |
" Automatic commands | |
if has("autocmd") | |
" Enable file type detection | |
filetype on | |
" Treat .json files as .js | |
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript | |
" Treat .md files as Markdown | |
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown | |
endif | |
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 following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
" plugin on GitHub repo | |
Plugin 'tpope/vim-fugitive' | |
" plugin from http://vim-scripts.org/vim/scripts.html | |
" Plugin 'L9' | |
" Git plugin not hosted on GitHub | |
Plugin 'git://git.wincent.com/command-t.git' | |
" git repos on your local machine (i.e. when working on your own plugin) | |
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} | |
" Install L9 and avoid a Naming conflict if you've already installed a | |
" different version somewhere else. | |
" Plugin 'ascenator/L9', {'name': 'newL9'} | |
"Monokai for Vim | |
Plugin 'sickill/vim-monokai' | |
Plugin 'bling/vim-airline' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'othree/javascript-libraries-syntax.vim' | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'mxw/vim-jsx' | |
Plugin 'maksimr/vim-jsbeautify' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'jistr/vim-nerdtree-tabs' | |
Plugin 'Xuyuanp/nerdtree-git-plugin' | |
Plugin 'ryanoasis/vim-devicons' | |
" 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 | |
syntax on | |
colorscheme monokai | |
".vimrc | |
map <c-f> :call JsBeautify()<cr> | |
"" or | |
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr> | |
" for json | |
" autocmd FileType json noremap <buffer> <c-f> :call JsonBeautify()<cr> | |
" " for jsx | |
" autocmd FileType jsx noremap <buffer> <c-f> :call JsxBeautify()<cr> | |
" " for html | |
" autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr> | |
" " for css or scss | |
" autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr> | |
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Plus\ Nerd\ File\ Types:h11 | |
map <C-n> :NERDTreeToggle<CR> | |
let g:airline_powerline_fonts = 1 | |
" 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 | |
" NERDTress File highlighting only the glyph/icon | |
" test highlight just the glyph (icons) in nerdtree: | |
autocmd filetype nerdtree highlight haskell_icon ctermbg=none ctermfg=Red guifg=#ffa500 | |
autocmd filetype nerdtree highlight html_icon ctermbg=none ctermfg=Red guifg=#ffa500 | |
autocmd filetype nerdtree highlight go_icon ctermbg=none ctermfg=Red guifg=#ffa500 | |
autocmd filetype nerdtree syn match haskell_icon ## containedin=NERDTreeFile | |
" if you are using another syn highlight for a given line (e.g. | |
" NERDTreeHighlightFile) need to give that name in the 'containedin' for this | |
" other highlight to work with it | |
autocmd filetype nerdtree syn match html_icon ## containedin=NERDTreeFile,html | |
autocmd filetype nerdtree syn match go_icon ## containedin=NERDTreeFile | |
" | |
if exists("g:loaded_webdevicons") | |
call webdevicons#refresh() | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment