Big Changes to Vim - Colorscheme, Powerline
+ Removed vim-powerline in favor of a more custom, simple statusline
+ new statusline still switches color based on mode
+ still displays about the same information
+ added vim-colorschemes plugin
+ adds many different colorschemes for easy switching
+ switched to jellybeans theme
+ Made it easier to reload vimrc for quick changes
+ changed all function to function! calls (overrides on each save)
+ added check for whether the vimrc has been loaded before to only do things once
+ only loading Vundle plugins once
+ added autocmd to source vimrc.local files on save
This commit is contained in:
@@ -1,43 +1,46 @@
|
|||||||
" vim settings
|
" vim settings
|
||||||
|
|
||||||
filetype off
|
if (!exists('vimrc_already_sourced'))
|
||||||
set rtp+=~/.vim/bundle/vundle/
|
filetype off
|
||||||
call vundle#rc()
|
set rtp+=~/.vim/bundle/vundle/
|
||||||
|
call vundle#rc()
|
||||||
|
|
||||||
" let vundle manage vundle
|
" let vundle manage vundle
|
||||||
Bundle 'gmarik/vundle'
|
Bundle 'gmarik/vundle'
|
||||||
|
|
||||||
" my vim plugins
|
" my vim plugins
|
||||||
Bundle 'kien/ctrlp.vim'
|
Bundle 'kien/ctrlp.vim'
|
||||||
Bundle 'scrooloose/nerdtree'
|
Bundle 'scrooloose/nerdtree'
|
||||||
Bundle 'mileszs/ack.vim'
|
Bundle 'mileszs/ack.vim'
|
||||||
Bundle 'Raimondi/delimitMate'
|
Bundle 'Raimondi/delimitMate'
|
||||||
Bundle 'tpope/vim-commentary'
|
Bundle 'tpope/vim-commentary'
|
||||||
Bundle 'tpope/vim-unimpaired'
|
Bundle 'tpope/vim-unimpaired'
|
||||||
Bundle 'tpope/vim-endwise'
|
Bundle 'tpope/vim-endwise'
|
||||||
Bundle 'tpope/vim-fugitive'
|
Bundle 'tpope/vim-fugitive'
|
||||||
Bundle 'othree/html5.vim'
|
Bundle 'othree/html5.vim'
|
||||||
Bundle 'pangloss/vim-javascript'
|
Bundle 'pangloss/vim-javascript'
|
||||||
Bundle 'itspriddle/vim-jquery'
|
Bundle 'itspriddle/vim-jquery'
|
||||||
Bundle 'tpope/vim-markdown'
|
Bundle 'tpope/vim-markdown'
|
||||||
Bundle 'mmalecki/vim-node.js'
|
Bundle 'mmalecki/vim-node.js'
|
||||||
Bundle 'Lokaltog/vim-powerline'
|
" Bundle 'Lokaltog/vim-powerline'
|
||||||
Bundle 'tpope/vim-ragtag'
|
Bundle 'tpope/vim-ragtag'
|
||||||
Bundle 'tpope/vim-surround'
|
Bundle 'tpope/vim-surround'
|
||||||
Bundle 'duff/vim-scratch'
|
Bundle 'duff/vim-scratch'
|
||||||
" Bundle 'sjl/vitality.vim'
|
" Bundle 'sjl/vitality.vim'
|
||||||
Bundle 'cakebaker/scss-syntax.vim'
|
Bundle 'cakebaker/scss-syntax.vim'
|
||||||
Bundle 'kchmck/vim-coffee-script'
|
Bundle 'kchmck/vim-coffee-script'
|
||||||
Bundle 'groenewege/vim-less'
|
Bundle 'groenewege/vim-less'
|
||||||
Bundle 'tsaleh/vim-matchit'
|
Bundle 'tsaleh/vim-matchit'
|
||||||
Bundle 'benmills/vimux'
|
Bundle 'benmills/vimux'
|
||||||
Bundle 'mattn/zencoding-vim'
|
Bundle 'mattn/zencoding-vim'
|
||||||
Bundle 'ap/vim-css-color'
|
Bundle 'ap/vim-css-color'
|
||||||
Bundle 'nicknisi/ir-whack'
|
" Bundle 'nicknisi/ir-whack'
|
||||||
Bundle 'editorconfig/editorconfig-vim'
|
Bundle 'flazz/vim-colorschemes'
|
||||||
Bundle 'juvenn/mustache.vim'
|
Bundle 'editorconfig/editorconfig-vim'
|
||||||
|
Bundle 'juvenn/mustache.vim'
|
||||||
|
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
@@ -75,6 +78,8 @@ set softtabstop=4
|
|||||||
" set mouse=a
|
" set mouse=a
|
||||||
" endif
|
" endif
|
||||||
|
|
||||||
|
set clipboard=unnamed
|
||||||
|
|
||||||
" faster redrawing
|
" faster redrawing
|
||||||
set ttyfast
|
set ttyfast
|
||||||
|
|
||||||
@@ -84,9 +89,6 @@ set ttyfast
|
|||||||
" highlight conflicts
|
" highlight conflicts
|
||||||
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
|
||||||
|
|
||||||
" Enable file type detection and do language dependent indenting
|
|
||||||
filetype plugin indent on
|
|
||||||
|
|
||||||
" file type specific settings
|
" file type specific settings
|
||||||
if has("autocmd")
|
if has("autocmd")
|
||||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||||
@@ -99,7 +101,8 @@ if has("autocmd")
|
|||||||
|
|
||||||
" automatically resize panes on resize
|
" automatically resize panes on resize
|
||||||
autocmd VimResized * exe "normal! \<c-w>="
|
autocmd VimResized * exe "normal! \<c-w>="
|
||||||
autocmd BufWritePost .vimrc source $MYVIMRC
|
autocmd BufWritePost .vimrc source %
|
||||||
|
autocmd BufWritePost .vimrc.local source %
|
||||||
" save all files on focus lost, ignoring warnings about untitled buffers
|
" save all files on focus lost, ignoring warnings about untitled buffers
|
||||||
autocmd FocusLost * silent! wa
|
autocmd FocusLost * silent! wa
|
||||||
autocmd BufNewFile,BufRead *.json set filetype=javascript
|
autocmd BufNewFile,BufRead *.json set filetype=javascript
|
||||||
@@ -125,6 +128,7 @@ set wildmode=list:longest " complete files like a shell
|
|||||||
set scrolloff=3 " lines of text around cursor
|
set scrolloff=3 " lines of text around cursor
|
||||||
set shell=$SHELL
|
set shell=$SHELL
|
||||||
set ruler " show postiion in file
|
set ruler " show postiion in file
|
||||||
|
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " a ruler on steroids"
|
||||||
set cmdheight=1 " command bar height
|
set cmdheight=1 " command bar height
|
||||||
|
|
||||||
set title " set terminal title
|
set title " set terminal title
|
||||||
@@ -150,8 +154,10 @@ set tm=500
|
|||||||
" switch syntax highlighting on
|
" switch syntax highlighting on
|
||||||
syntax on
|
syntax on
|
||||||
|
|
||||||
|
set encoding=utf8
|
||||||
|
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors"
|
||||||
set background=dark
|
set background=dark
|
||||||
colorscheme ir-whack
|
colorscheme jellybeans
|
||||||
|
|
||||||
" set number " show line numbers
|
" set number " show line numbers
|
||||||
set relativenumber " show relative line numbers
|
set relativenumber " show relative line numbers
|
||||||
@@ -164,8 +170,6 @@ set showbreak=… " show ellipsis at breaking
|
|||||||
|
|
||||||
set autoindent " automatically set indent of new line
|
set autoindent " automatically set indent of new line
|
||||||
|
|
||||||
set encoding=utf8
|
|
||||||
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors"
|
|
||||||
try
|
try
|
||||||
lang en_US
|
lang en_US
|
||||||
catch
|
catch
|
||||||
@@ -185,9 +189,36 @@ set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
|
|||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => StatusLine
|
" => StatusLine
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
set laststatus=2 " show the satus line all the time
|
|
||||||
|
|
||||||
" the status line is set by the powerline plugin
|
set laststatus=2 " show the satus line all the time
|
||||||
|
" set statusline=%f\ %y%m%r%=%-20.(%{fugitive#statusline()}%)%-15.(%l,%c%V%)\ %P
|
||||||
|
set statusline=\ "
|
||||||
|
set statusline+=%-25.80f%*\ " file name minimum 25, maximum 80 (right justified)
|
||||||
|
set statusline+=
|
||||||
|
set statusline+=%h " help file flag
|
||||||
|
set statusline+=%r " read only flag
|
||||||
|
set statusline+=%m " modified flag
|
||||||
|
set statusline+=%w " preview flag
|
||||||
|
set statusline+=%*\ "
|
||||||
|
set statusline+=%y " filetype
|
||||||
|
set statusline+=%= " right align
|
||||||
|
set statusline+=<%{fugitive#head()}%*>\ " Fugitive
|
||||||
|
set statusline+=%-14.(%l,%c%V%)\ %<%P%* " offset
|
||||||
|
|
||||||
|
function! InsertStatuslineColor(mode)
|
||||||
|
if a:mode == 'i'
|
||||||
|
hi statusline ctermbg=magenta
|
||||||
|
elseif a:mode == 'r'
|
||||||
|
hi statusline ctermbg=blue
|
||||||
|
else
|
||||||
|
hi statusline ctermbg=red
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
autocmd InsertEnter * call InsertStatuslineColor(v:insertmode)
|
||||||
|
autocmd InsertChange * call InsertStatuslineColor(v:insertmode)
|
||||||
|
autocmd InsertLeave * hi statusline ctermbg=DarkGray
|
||||||
|
hi statusline ctermbg=DarkGray
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Mappings
|
" => Mappings
|
||||||
@@ -290,7 +321,7 @@ nnoremap <leader>/ :call ToggleNuMode()<cr>
|
|||||||
|
|
||||||
" find out what syntax stack a statement belongs to
|
" find out what syntax stack a statement belongs to
|
||||||
nmap <leader>s :call <SID>SynStack()<cr>
|
nmap <leader>s :call <SID>SynStack()<cr>
|
||||||
function <SID>SynStack()
|
function! <SID>SynStack()
|
||||||
if !exists("*synstack")
|
if !exists("*synstack")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -339,6 +370,23 @@ function! Smart_TabComplete()
|
|||||||
endfunction
|
endfunction
|
||||||
inoremap <tab> <c-r>=Smart_TabComplete()<CR>
|
inoremap <tab> <c-r>=Smart_TabComplete()<CR>
|
||||||
|
|
||||||
|
map <leader>r :call RunCustomCommand()<cr>
|
||||||
|
map <leader>s :call SetCustomCommand()<cr>
|
||||||
|
let g:silent_custom_command = 0
|
||||||
|
|
||||||
|
function! RunCustomCommand()
|
||||||
|
up
|
||||||
|
if g:silent_custom_command
|
||||||
|
execute 'silent !' . s:customcommand
|
||||||
|
else
|
||||||
|
execute '!' . s:customcommand
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! SetCustomCommand()
|
||||||
|
let s:customcommand = input('Enter Custom Command$ ')
|
||||||
|
endfunction
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" => Plugins
|
" => Plugins
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
@@ -375,3 +423,5 @@ let g:ctrlp_custom_ignore = {
|
|||||||
|
|
||||||
" search the nearest ancestor that contains .git, .hg, .svn
|
" search the nearest ancestor that contains .git, .hg, .svn
|
||||||
let g:ctrlp_working_path_mode = 2
|
let g:ctrlp_working_path_mode = 2
|
||||||
|
|
||||||
|
let vimrc_already_sourced = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user