mirror of
https://github.com/amix/vimrc
synced 2025-07-08 18:04:59 +08:00
Merge branch 'master' of https://github.com/amix/vimrc into amix-master
Conflicts: .gitignore
This commit is contained in:
@ -72,6 +72,12 @@ command W w !sudo tee % > /dev/null
|
||||
" Set 7 lines to the cursor - when moving vertically using j/k
|
||||
set so=7
|
||||
|
||||
" Avoid garbled characters in Chinese language windows OS
|
||||
let $LANG='en'
|
||||
set langmenu=en
|
||||
source $VIMRUNTIME/delmenu.vim
|
||||
source $VIMRUNTIME/menu.vim
|
||||
|
||||
" Turn on the WiLd menu
|
||||
set wildmenu
|
||||
|
||||
@ -96,6 +102,11 @@ set hid
|
||||
set backspace=eol,start,indent
|
||||
set whichwrap+=<,>,h,l
|
||||
|
||||
" In many terminal emulators the mouse works just fine, thus enable it.
|
||||
if has('mouse')
|
||||
set mouse=a
|
||||
endif
|
||||
|
||||
" Ignore case when searching
|
||||
set ignorecase
|
||||
|
||||
@ -230,6 +241,12 @@ map <leader>tc :tabclose<cr>
|
||||
map <leader>tm :tabmove
|
||||
map <leader>t<leader> :tabnext
|
||||
|
||||
" Let 'tl' toggle between this and the last accessed tab
|
||||
let g:lasttab = 1
|
||||
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
|
||||
au TabLeave * let g:lasttab = tabpagenr()
|
||||
|
||||
|
||||
" Opens a new tab with the current buffer's path
|
||||
" Super useful when editing files in the same directory
|
||||
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
|
||||
@ -293,23 +310,21 @@ autocmd BufWrite *.coffee :call DeleteTrailingWS()
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => vimgrep searching and cope displaying
|
||||
" => Ack searching and cope displaying
|
||||
" requires ack.vim - it's much better than vimgrep/grep
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" When you press gv you vimgrep after the selected text
|
||||
" When you press gv you Ack after the selected text
|
||||
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
|
||||
|
||||
" Open vimgrep and put the cursor in the right position
|
||||
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>
|
||||
|
||||
" Vimgreps in the current file
|
||||
map <leader><space> :vimgrep // <C-R>%<C-A><right><right><right><right><right><right><right><right><right>
|
||||
" Open Ack and put the cursor in the right position
|
||||
map <leader>g :Ack
|
||||
|
||||
" When you press <leader>r you can search and replace the selected text
|
||||
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
|
||||
|
||||
" Do :help cope if you are unsure what cope is. It's super useful!
|
||||
"
|
||||
" When you search with vimgrep, display your results in cope by doing:
|
||||
" When you search with Ack, display your results in cope by doing:
|
||||
" <leader>cc
|
||||
"
|
||||
" To go to the next search result do:
|
||||
@ -343,14 +358,18 @@ map <leader>s? z=
|
||||
" Remove the Windows ^M - when the encodings gets messed up
|
||||
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||
|
||||
" Quickly open a buffer for scripbble
|
||||
" Quickly open a buffer for scribble
|
||||
map <leader>q :e ~/buffer<cr>
|
||||
|
||||
" Quickly open a markdown buffer for scribble
|
||||
map <leader>x :e ~/buffer.md<cr>
|
||||
|
||||
" Toggle paste mode on and off
|
||||
map <leader>pp :setlocal paste!<cr>
|
||||
|
||||
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Helper functions
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
@ -370,7 +389,7 @@ function! VisualSelection(direction, extra_filter) range
|
||||
if a:direction == 'b'
|
||||
execute "normal ?" . l:pattern . "^M"
|
||||
elseif a:direction == 'gv'
|
||||
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.' . a:extra_filter)
|
||||
call CmdLine("Ack \"" . l:pattern . "\" " )
|
||||
elseif a:direction == 'replace'
|
||||
call CmdLine("%s" . '/'. l:pattern . '/')
|
||||
elseif a:direction == 'f'
|
||||
|
@ -8,16 +8,14 @@
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => GUI related
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
set background=dark
|
||||
|
||||
colorscheme peaksea
|
||||
|
||||
" Set font according to system
|
||||
if has("mac") || has("macunix")
|
||||
set gfn=Menlo:h15
|
||||
set gfn=Source\ Code\ Pro:h15,Menlo:h15
|
||||
elseif has("win16") || has("win32")
|
||||
set gfn=Bitstream\ Vera\ Sans\ Mono:h11
|
||||
set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11
|
||||
elseif has("linux")
|
||||
set gfn=Source\ Code\ Pro:h12,Bitstream\ Vera\ Sans\ Mono:h11
|
||||
elseif has("unix")
|
||||
set gfn=Monospace\ 11
|
||||
endif
|
||||
|
||||
@ -33,6 +31,15 @@ set guioptions-=R
|
||||
set guioptions-=l
|
||||
set guioptions-=L
|
||||
|
||||
" Colorscheme
|
||||
if has("gui_running")
|
||||
set background=dark
|
||||
colorscheme peaksea
|
||||
else
|
||||
colorscheme desert
|
||||
let g:colors_name="desert"
|
||||
endif
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Fast editing and reloading of vimrc configs
|
||||
|
@ -26,7 +26,7 @@ au FileType javascript call JavaScriptFold()
|
||||
au FileType javascript setl fen
|
||||
au FileType javascript setl nocindent
|
||||
|
||||
au FileType javascript imap <c-t> AJS.log();<esc>hi
|
||||
au FileType javascript imap <c-t> $log();<esc>hi
|
||||
au FileType javascript imap <c-a> alert();<esc>hi
|
||||
|
||||
au FileType javascript inoremap <buffer> $r return
|
||||
@ -52,3 +52,5 @@ function! CoffeeScriptFold()
|
||||
setl foldlevelstart=1
|
||||
endfunction
|
||||
au FileType coffee call CoffeeScriptFold()
|
||||
|
||||
au FileType gitcommit call setpos('.', [0, 1, 1, 0])
|
||||
|
@ -8,8 +8,8 @@
|
||||
""""""""""""""""""""""""""""""
|
||||
" => Load pathogen paths
|
||||
""""""""""""""""""""""""""""""
|
||||
call pathogen#infect('~/.vim_runtime/sources_forked')
|
||||
call pathogen#infect('~/.vim_runtime/sources_non_forked')
|
||||
call pathogen#infect('~/.vim_runtime/sources_forked/{}')
|
||||
call pathogen#infect('~/.vim_runtime/sources_non_forked/{}')
|
||||
call pathogen#helptags()
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
@ -45,19 +45,13 @@ endif
|
||||
let g:ctrlp_working_path_mode = 0
|
||||
|
||||
let g:ctrlp_map = '<c-f>'
|
||||
map <leader>j :CtrlP<cr>
|
||||
map <c-b> :CtrlPBuffer<cr>
|
||||
|
||||
let g:ctrlp_max_height = 20
|
||||
let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee'
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" => Peepopen
|
||||
""""""""""""""""""""""""""""""
|
||||
map <leader>j :PeepOpen<cr>
|
||||
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" => ZenCoding
|
||||
""""""""""""""""""""""""""""""
|
||||
@ -99,3 +93,23 @@ let g:multi_cursor_next_key="\<C-s>"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
vmap Si S(i_<esc>f)
|
||||
au FileType mako vmap Si S"i${ _(<esc>2f"a) }<esc>
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => vim-airline config (force color)
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let g:airline_theme="luna"
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Vimroom
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let g:goyo_width=100
|
||||
let g:goyo_margin_top = 2
|
||||
let g:goyo_margin_bottom = 2
|
||||
nnoremap <silent> <leader>z :Goyo<cr>
|
||||
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" => Syntastic (syntax checker)
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
let g:syntastic_python_checkers=['pyflakes']
|
||||
|
Reference in New Issue
Block a user