301 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			VimL
		
	
	
	
			
		
		
	
	
			301 lines
		
	
	
		
			6.6 KiB
		
	
	
	
		
			VimL
		
	
	
	
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
 | 
						|
" Requires git to be compiled with Ruby support
 | 
						|
" Plugin 'git://git.wincent.com/command-t.git'
 | 
						|
 | 
						|
" git repos on your local machine (i.e. when working on your own plugin)
 | 
						|
"Plugin 'file:///home/gmarik/path/to/plugin'
 | 
						|
" The sparkup vim script is in a subdirectory of this repo called vim.
 | 
						|
" Pass the path to set the runtimepath properly.
 | 
						|
 | 
						|
" 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'}
 | 
						|
 | 
						|
" Nerdtree and nerdtree-git
 | 
						|
Plugin 'scrooloose/nerdtree.git'
 | 
						|
Plugin 'Xuyuanp/nerdtree-git-plugin'
 | 
						|
 | 
						|
"css3-syntax
 | 
						|
Plugin 'hail2u/vim-css3-syntax.git'
 | 
						|
 | 
						|
"scss-syntax
 | 
						|
Plugin 'cakebaker/scss-syntax.vim'
 | 
						|
 | 
						|
"bufexplorer
 | 
						|
Plugin 'jlanzarotta/bufexplorer'
 | 
						|
 | 
						|
"tagbar
 | 
						|
Plugin 'majutsushi/tagbar'
 | 
						|
 | 
						|
"vim-surround
 | 
						|
Plugin 'tpope/vim-surround'
 | 
						|
 | 
						|
"undotree
 | 
						|
Plugin 'mbbill/undotree'
 | 
						|
 | 
						|
" gutentag
 | 
						|
Plugin 'ludovicchabant/vim-gutentags'
 | 
						|
 | 
						|
" Ctrlp
 | 
						|
Plugin 'ctrlpvim/ctrlp.vim'
 | 
						|
 | 
						|
" Obsession
 | 
						|
Plugin 'tpope/vim-obsession'
 | 
						|
 | 
						|
" vim-css-color
 | 
						|
Plugin 'ap/vim-css-color'
 | 
						|
 | 
						|
" 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
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
" better window navigaton
 | 
						|
nnoremap <C-h> <C-w>h
 | 
						|
nnoremap <C-l> <C-w>l
 | 
						|
nnoremap <C-k> <C-w>k
 | 
						|
nnoremap <C-j> <C-w>j
 | 
						|
 | 
						|
" better window resizing
 | 
						|
" need to use <Esc>j because urxvt sends the character prefixed with Escape
 | 
						|
" instead of setting the eighth bit
 | 
						|
" see https://unix.stackexchange.com/a/199705
 | 
						|
nnoremap <Esc>j :resize +1<CR>
 | 
						|
nnoremap <Esc>k :resize -1<CR>
 | 
						|
nnoremap <Esc>l :vertical resize +1<CR>
 | 
						|
nnoremap <Esc>h :vertical resize -1<CR>
 | 
						|
 | 
						|
let mapleader = "\<space>"
 | 
						|
 | 
						|
set hidden
 | 
						|
 | 
						|
set bg=dark
 | 
						|
set number
 | 
						|
" set nonumber
 | 
						|
set autoindent
 | 
						|
 | 
						|
" set width of the fold column to create a margin
 | 
						|
set foldcolumn=1
 | 
						|
 | 
						|
" hi FoldColumn ctermfg=255 ctermbg=226
 | 
						|
colorscheme customred256
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
" statusline format
 | 
						|
set statusline=\ %F\   " filename and path
 | 
						|
"set statusline+=%{SyntaxItem()}
 | 
						|
set statusline+=%h     " help file flag
 | 
						|
set statusline+=%w     " preview window flag
 | 
						|
set statusline+=%m     " modified flag
 | 
						|
set statusline+=%r     " read only flag
 | 
						|
set statusline+=\ 
 | 
						|
set statusline+=[%{strlen(&ft)?&ft:'none'},     " filetype
 | 
						|
set statusline+=%{strlen(&fenc)?&fenc:&enc},    " encoding
 | 
						|
set statusline+=%{&fileformat}]\                " file format
 | 
						|
set statusline+=%{&spelllang}\ \ \ \ \          " Spell language
 | 
						|
set statusline+=%{fugitive#statusline()}
 | 
						|
 | 
						|
set statusline+=%=                              " left/right separator
 | 
						|
set statusline+=[\ %{v:register}\ ]\            " active register 
 | 
						|
set statusline+=[%{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')}]\ \ " session status
 | 
						|
set statusline+=%(%l,%c%V\ %=\ %P%)             " line number,virtual line number, scroll percentage
 | 
						|
 | 
						|
" always show statusline
 | 
						|
set laststatus=2
 | 
						|
 | 
						|
" set status to change the status line based on mode
 | 
						|
if version >= 700
 | 
						|
  au InsertEnter * hi StatusLine term=reverse ctermbg=5 gui=undercurl guisp=Magenta
 | 
						|
  au InsertLeave * hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse
 | 
						|
endif
 | 
						|
 | 
						|
 | 
						|
" set a right margin and it's colour
 | 
						|
set colorcolumn=100
 | 
						|
 | 
						|
set foldmethod=manual
 | 
						|
 | 
						|
syntax on
 | 
						|
" tabs
 | 
						|
set tabstop=2
 | 
						|
set softtabstop=2
 | 
						|
set shiftwidth=0	"use tabstop value
 | 
						|
set mouse=a
 | 
						|
 | 
						|
" rewrapping set to 80
 | 
						|
set tw=180
 | 
						|
" disable automatic wrapping
 | 
						|
set fo=cq
 | 
						|
" disable wrapping based on terminal size
 | 
						|
set wm=0
 | 
						|
 | 
						|
set t_Co=8
 | 
						|
set t_Sf=<Esc>[3%p1%dm
 | 
						|
set t_Sb=<Esc>[4%p1%dm
 | 
						|
 | 
						|
nnoremap <F2> :set invpaste paste?<CR>
 | 
						|
set pastetoggle=<F2>
 | 
						|
set showmode
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
" fix higlight problems such as vertical-align etc
 | 
						|
augroup VimCSS3Syntax
 | 
						|
  autocmd!
 | 
						|
 | 
						|
  autocmd FileType css setlocal iskeyword+=-
 | 
						|
augroup END
 | 
						|
 | 
						|
 | 
						|
" autocommands
 | 
						|
" automatically reload if color scheme file written
 | 
						|
augroup coloreload
 | 
						|
  au!
 | 
						|
	au BufWritePost customred256.vim so $MYVIMRC
 | 
						|
augroup end
 | 
						|
 | 
						|
 | 
						|
 | 
						|
" Automatically reload .vimrc if chanaged
 | 
						|
augroup myvimrc
 | 
						|
    au!
 | 
						|
    au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
 | 
						|
augroup END
 | 
						|
 | 
						|
 | 
						|
" persisitent undo file
 | 
						|
set undodir=/home/ray/.vim/undodir
 | 
						|
set undofile
 | 
						|
 | 
						|
 | 
						|
 | 
						|
" Functions
 | 
						|
 | 
						|
" get name of syntax item
 | 
						|
function! SyntaxItem()
 | 
						|
  return synIDattr(synID(line("."),col("."),1),"name") . " -> " . synIDattr(synIDtrans(synID(line("."),col("."),1)), "name" )
 | 
						|
endfunction
 | 
						|
nnoremap <leader>p :echom SyntaxItem()<CR>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
" plugins stuff
 | 
						|
 | 
						|
" NERDtree
 | 
						|
nnoremap <F3> :NERDTreeFocus<CR>
 | 
						|
nnoremap <leader>nt :NERDTreeFocus<CR>
 | 
						|
" allow closing if only window open is a NERDTree
 | 
						|
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
 | 
						|
 | 
						|
" TagBar
 | 
						|
nnoremap <leader>tb :TagbarOpen fj<CR>
 | 
						|
 | 
						|
 | 
						|
" tagbar css/scss thingy
 | 
						|
nnoremap <leader>] :tag /[.#@]<c-r>=expand('<cword>')<cr><cr>
 | 
						|
 | 
						|
 | 
						|
" bufexploer
 | 
						|
nnoremap <leader>be :BufExplorer<CR> 
 | 
						|
 | 
						|
nnoremap <leader>ut :UndotreeToggle<cr>
 | 
						|
" let g:tagbar_type_css = {
 | 
						|
" \  'ctagstype' : 'css',
 | 
						|
" \  'kinds' : [
 | 
						|
" \    'c:classes',
 | 
						|
" \    'i:ids',
 | 
						|
" \    't:tags',
 | 
						|
" \    'm:medias'
 | 
						|
" \  ]
 | 
						|
" \}
 | 
						|
 | 
						|
let g:tagbar_type_scss = {
 | 
						|
\  'ctagstype' : 'scss',
 | 
						|
\  'kinds' : [
 | 
						|
\    'v:variables',
 | 
						|
\    'c:classes',
 | 
						|
\    'i:ids',
 | 
						|
\    't:tags',
 | 
						|
\    'd:medias',
 | 
						|
\    'm:mixins',
 | 
						|
\    'f:functions'
 | 
						|
\  ]
 | 
						|
\}
 | 
						|
 | 
						|
if !exists("*RangerExplorer")
 | 
						|
	function RangerExplorer()
 | 
						|
			exec "silent !ranger --choosefile=/tmp/vim_ranger_current_file " . expand("%:p:h")
 | 
						|
			if filereadable('/tmp/vim_ranger_current_file')
 | 
						|
					exec 'edit ' . system('cat /tmp/vim_ranger_current_file')
 | 
						|
					call system('rm /tmp/vim_ranger_current_file')
 | 
						|
			endif
 | 
						|
			redraw!
 | 
						|
	endfun
 | 
						|
	map <Leader>ra :call RangerExplorer()<CR>
 | 
						|
endif
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
" ze end
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 |