Skip to content

Commit

Permalink
hook into tag movements
Browse files Browse the repository at this point in the history
  • Loading branch information
kongo2002 committed May 20, 2010
1 parent 9640d4d commit 4329fff
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
8 changes: 7 additions & 1 deletion doc/space.txt
Expand Up @@ -4,7 +4,7 @@


______ ______ _____ _____ _____ ______ ______ _____ _____ _____
/ _____\ | ___ \ / ___ \ / ___/ / ___/ / _____\ | ___ \ / ___ \ / ___/ / ___/
\ \____ | ___ / | \ / | | | | \__ \ \____ | ___ / | \ / | | | | \__
\___ \ | | | |X| | | |___ | /___ \___ \ | | | |X| | | |___ | /___
/______/ \_| \_/ \_/ \____/ \____/ /______/ \_| \_/ \_/ \____/ \____/


Expand Down Expand Up @@ -135,6 +135,9 @@ Section jumps: |object-motions|
Fold movements: Fold movements:
|zj||zk||]z||[z| |zj||zk||]z||[z|


Tag movements: |tag-commands|
|CTRL-]|

Undolist movements: |undo-branches| Undolist movements: |undo-branches|
|g-||g+| |g-||g+|


Expand Down Expand Up @@ -217,6 +220,9 @@ Disable <Space> for section jumps >
Disable <Space> for fold movements > Disable <Space> for fold movements >
let g:space_no_folds = 1 let g:space_no_folds = 1
Disable <Space> for tag movements >
let g:space_no_tags = 1
Disable <Space> for quickfix and location list commands > Disable <Space> for quickfix and location list commands >
let g:space_no_quickfix = 1 let g:space_no_quickfix = 1
Expand Down
20 changes: 18 additions & 2 deletions plugin/space.vim
Expand Up @@ -82,6 +82,7 @@ if exists("g:space_debug")
let g:space_no_folds = 0 let g:space_no_folds = 0
let g:space_no_quickfix = 0 let g:space_no_quickfix = 0
let g:space_no_undolist = 0 let g:space_no_undolist = 0
let g:space_no_tags = 0
echomsg "Running space.vim in debug mode." echomsg "Running space.vim in debug mode."
elseif exists("g:space_loaded") elseif exists("g:space_loaded")
finish finish
Expand Down Expand Up @@ -245,6 +246,15 @@ if !exists("g:space_no_folds") || !g:space_no_folds
endif endif
endif endif


" tag movement
if !exists("g:space_no_tags") || !g:space_no_tags
noremap <expr> <silent> <C-]> <SID>setup_space("tag", "\<C-]>")
if exists("g:space_disable_select_mode")
silent! sunmap <C-]>
endif
endif

" undolist movement " undolist movement
if !exists("g:space_no_undolist") || !g:space_no_undolist if !exists("g:space_no_undolist") || !g:space_no_undolist
noremap <expr> <silent> g- <SID>setup_space("undo", "g-") noremap <expr> <silent> g- <SID>setup_space("undo", "g-")
Expand Down Expand Up @@ -314,6 +324,8 @@ function! s:remove_space_mappings()
silent! unmap ]z silent! unmap ]z
silent! unmap [z silent! unmap [z


silent! unmap <C-]>

silent! unmap g- silent! unmap g-
silent! unmap g+ silent! unmap g+


Expand Down Expand Up @@ -433,6 +445,10 @@ function! s:setup_space(type, command)
let s:shift_space_move = "\<C-o>" let s:shift_space_move = "\<C-o>"
let s:cmd_type = "jump" let s:cmd_type = "jump"
let cmd = <SID>maybe_open_fold(cmd) let cmd = <SID>maybe_open_fold(cmd)
elseif a:type == "tag"
let s:space_move = "tn"
let s:shift_space_move = "tp"
let s:cmd_type = "tag"
elseif a:type == "qf" elseif a:type == "qf"
let s:space_move = "cn" let s:space_move = "cn"
let s:shift_space_move = "cN" let s:shift_space_move = "cN"
Expand Down Expand Up @@ -478,7 +494,7 @@ endfunc
function! s:maybe_open_fold(cmd) function! s:maybe_open_fold(cmd)
if !exists("g:space_no_foldopen") && &foldopen =~ s:cmd_type if !exists("g:space_no_foldopen") && &foldopen =~ s:cmd_type
" special treatment of :ex commands " special treatment of :ex commands
if s:cmd_type == "quickfix" if s:cmd_type == "quickfix" || s:cmd_type == "tag"
if getcmdtype() == ':' if getcmdtype() == ':'
return "\<CR>" return "\<CR>"
else else
Expand All @@ -503,7 +519,7 @@ function! s:maybe_open_fold(cmd)
endif endif
endif endif
else else
if s:cmd_type == "quickfix" if s:cmd_type == "quickfix" || s:cmd_type == "tag"
if getcmdtype() == ':' if getcmdtype() == ':'
return "\<CR>" return "\<CR>"
else else
Expand Down

0 comments on commit 4329fff

Please sign in to comment.