set registers directly instead of expanding options in exec
This commit is contained in:
parent
16f42fe3a6
commit
ee117b9499
|
@ -59,7 +59,7 @@ hook global BufSetOption filetype=haml %{
|
||||||
|
|
||||||
hook global BufSetOption filetype=html %{
|
hook global BufSetOption filetype=html %{
|
||||||
set-option buffer comment_line ''
|
set-option buffer comment_line ''
|
||||||
set-option buffer comment_block_begin '<lt>!--'
|
set-option buffer comment_block_begin '<!--'
|
||||||
set-option buffer comment_block_end '-->'
|
set-option buffer comment_block_end '-->'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,14 +121,18 @@ define-command comment-block -docstring '(un)comment selections using block comm
|
||||||
execute-keys <a-K>\A\s*\z<ret>
|
execute-keys <a-K>\A\s*\z<ret>
|
||||||
|
|
||||||
try %{
|
try %{
|
||||||
# Assert that the selection has not been commented
|
# Assert that the selection has been commented
|
||||||
execute-keys "<a-K>\A\Q%opt{comment_block_begin}\E.*\Q%opt{comment_block_end}\E\n*\z<ret>"
|
set-register / "\A\Q%opt{comment_block_begin}\E.*\Q%opt{comment_block_end}\E\n*\z"
|
||||||
|
execute-keys "s<ret>"
|
||||||
# Comment the selection
|
# Uncomment it
|
||||||
execute-keys -draft "a%opt{comment_block_end}<esc>i%opt{comment_block_begin}"
|
set-register / "\A\Q%opt{comment_block_begin}\E|\Q%opt{comment_block_end}\E\n*\z"
|
||||||
|
execute-keys s<ret>d
|
||||||
} catch %{
|
} catch %{
|
||||||
# Uncomment the commented selection
|
# Comment the selection
|
||||||
execute-keys -draft "s(\A\Q%opt{comment_block_begin}\E)|(\Q%opt{comment_block_end}\E\n*\z)<ret>d"
|
set-register '"' "%opt{comment_block_begin}"
|
||||||
|
execute-keys P
|
||||||
|
set-register '"' "%opt{comment_block_end}"
|
||||||
|
execute-keys p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,14 +152,13 @@ define-command comment-line -docstring '(un)comment selected lines using line co
|
||||||
execute-keys <a-K>\A\s*\z<ret>
|
execute-keys <a-K>\A\s*\z<ret>
|
||||||
|
|
||||||
try %{
|
try %{
|
||||||
# Assert that the line has not been commented
|
# Select the comment characters and remove them
|
||||||
execute-keys "<a-K>\A\Q%opt{comment_line}\E<ret>"
|
set-register / "\A\Q%opt{comment_line}\E\h*"
|
||||||
|
execute-keys s<ret>d
|
||||||
# Comment the line
|
|
||||||
execute-keys -draft "i%opt{comment_line}"
|
|
||||||
} catch %{
|
} catch %{
|
||||||
# Uncomment the line
|
# Comment the line
|
||||||
execute-keys -draft "s\A\Q%opt{comment_line}\E\h*<ret>d"
|
set-register '"' "%opt{comment_line}"
|
||||||
|
execute-keys P
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user