Initial commit; latest versions
This commit is contained in:
165
vimrc
Normal file
165
vimrc
Normal file
@@ -0,0 +1,165 @@
|
||||
set history=700
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
set autoread
|
||||
let mapleader = ","
|
||||
let g:mapleader = ","
|
||||
nmap <leader>w :w!<cr>
|
||||
set so=7
|
||||
set wildmenu
|
||||
set wildignore=*.o,*~,*.pyc
|
||||
set ruler
|
||||
set cmdheight=2
|
||||
set hid
|
||||
set backspace=eol,start,indent
|
||||
set whichwrap+=<,>,h,l
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set lazyredraw
|
||||
set magic
|
||||
set showmatch
|
||||
set mat=2
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
set t_vb=
|
||||
set tm=500
|
||||
syntax enable
|
||||
colorscheme desert
|
||||
set background=dark
|
||||
if has("gui_running")
|
||||
set guioptions-=T
|
||||
set guioptions+=e
|
||||
set t_Co=256
|
||||
set guitablabel=%M\ %t
|
||||
endif
|
||||
set encoding=utf8
|
||||
set ffs=unix,dos,mac
|
||||
set nobackup
|
||||
set nowb
|
||||
set noswapfile
|
||||
set expandtab
|
||||
set smarttab
|
||||
set shiftwidth=4
|
||||
set tabstop=4
|
||||
set lbr
|
||||
set tw=500
|
||||
set ai "Auto indent
|
||||
set si "Smart indent
|
||||
set wrap "Wrap lines
|
||||
vnoremap <silent> * :call VisualSelection('f')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b')<CR>
|
||||
map j gj
|
||||
map k gk
|
||||
map <space> /
|
||||
map <c-space> ?
|
||||
map <silent> <leader><cr> :noh<cr>
|
||||
map <C-j> <C-W>j
|
||||
map <C-k> <C-W>k
|
||||
map <C-h> <C-W>h
|
||||
map <C-l> <C-W>l
|
||||
map <leader>bd :Bclose<cr>
|
||||
map <leader>ba :1,1000 bd!<cr>
|
||||
map <leader>tn :tabnew<cr>
|
||||
map <leader>to :tabonly<cr>
|
||||
map <leader>tc :tabclose<cr>
|
||||
map <leader>tm :tabmove
|
||||
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
|
||||
map <leader>cd :cd %:p:h<cr>:pwd<cr>
|
||||
try
|
||||
set switchbuf=useopen,usetab,newtab
|
||||
set stal=2
|
||||
catch
|
||||
endtry
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
set viminfo^=%
|
||||
set laststatus=2
|
||||
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l/%L\ \ Column:\ %c
|
||||
map 0 ^
|
||||
nmap <M-j> mz:m+<cr>`z
|
||||
nmap <M-k> mz:m-2<cr>`z
|
||||
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
|
||||
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
|
||||
if has("mac") || has("macunix")
|
||||
nmap <D-j> <M-j>
|
||||
nmap <D-k> <M-k>
|
||||
vmap <D-j> <M-j>
|
||||
vmap <D-k> <M-k>
|
||||
endif
|
||||
func! DeleteTrailingWS()
|
||||
exe "normal mz"
|
||||
%s/\s\+$//ge
|
||||
exe "normal `z"
|
||||
endfunc
|
||||
autocmd BufWrite *.py :call DeleteTrailingWS()
|
||||
autocmd BufWrite *.coffee :call DeleteTrailingWS()
|
||||
vnoremap <silent> gv :call VisualSelection('gv')<CR>
|
||||
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>
|
||||
map <leader><space> :vimgrep // <C-R>%<C-A><right><right><right><right><right><right><right><right><right>
|
||||
vnoremap <silent> <leader>r :call VisualSelection('replace')<CR>
|
||||
map <leader>cc :botright cope<cr>
|
||||
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
|
||||
map <leader>n :cn<cr>
|
||||
map <leader>p :cp<cr>
|
||||
map <leader>ss :setlocal spell!<cr>
|
||||
map <leader>sn ]s
|
||||
map <leader>sp [s
|
||||
map <leader>sa zg
|
||||
map <leader>s? z=
|
||||
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||
map <leader>q :e ~/buffer<cr>
|
||||
map <leader>pp :setlocal paste!<cr>
|
||||
function! CmdLine(str)
|
||||
exe "menu Foo.Bar :" . a:str
|
||||
emenu Foo.Bar
|
||||
unmenu Foo
|
||||
endfunction
|
||||
function! VisualSelection(direction) range
|
||||
let l:saved_reg = @"
|
||||
execute "normal! vgvy"
|
||||
|
||||
let l:pattern = escape(@", '\\/.*$^~[]')
|
||||
let l:pattern = substitute(l:pattern, "\n$", "", "")
|
||||
|
||||
if a:direction == 'b'
|
||||
execute "normal ?" . l:pattern . "^M"
|
||||
elseif a:direction == 'gv'
|
||||
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.')
|
||||
elseif a:direction == 'replace'
|
||||
call CmdLine("%s" . '/'. l:pattern . '/')
|
||||
elseif a:direction == 'f'
|
||||
execute "normal /" . l:pattern . "^M"
|
||||
endif
|
||||
|
||||
let @/ = l:pattern
|
||||
let @" = l:saved_reg
|
||||
endfunction
|
||||
function! HasPaste()
|
||||
if &paste
|
||||
return 'PASTE MODE '
|
||||
en
|
||||
return ''
|
||||
endfunction
|
||||
command! Bclose call <SID>BufcloseCloseIt()
|
||||
function! <SID>BufcloseCloseIt()
|
||||
let l:currentBufNum = bufnr("%")
|
||||
let l:alternateBufNum = bufnr("#")
|
||||
|
||||
if buflisted(l:alternateBufNum)
|
||||
buffer #
|
||||
else
|
||||
bnext
|
||||
endif
|
||||
|
||||
if bufnr("%") == l:currentBufNum
|
||||
new
|
||||
endif
|
||||
|
||||
if buflisted(l:currentBufNum)
|
||||
execute("bdelete! ".l:currentBufNum)
|
||||
endif
|
||||
endfunction
|
Reference in New Issue
Block a user