Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a "reversed order" option #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions autoload/place.vim
Expand Up @@ -3,8 +3,13 @@
"shouldRepeat = Whether or not to reuse values for dot repeat
function! place#insert(shouldPrompt, shouldRepeat)
if !a:shouldRepeat
let s:motion = place#get_motion()
let s:insertion = place#get_insertion(a:shouldPrompt)
if g:place_reversed
let s:insertion = place#get_insertion(a:shouldPrompt)
let s:motion = place#get_motion()
else
let s:motion = place#get_motion()
let s:insertion = place#get_insertion(a:shouldPrompt)
endif
let s:mapping = place#get_type_for_motion(s:motion[0])
endif

Expand Down
14 changes: 14 additions & 0 deletions doc/place.txt
Expand Up @@ -14,6 +14,20 @@ place.vim - Place a character without moving

`let g:place_blink = 0`

`g:place_reversed`
(default '0')

By default, place.vim takes a motion followed by character(s) to insert.
This option reverses things so that the motion goes last.

For example, to add a semicolon to the end of the line,
Default: `ga$;`, mnemonically "place, at end of line, a semicolon"
Reversed: `ga;$`, mnemonically "place semicolon at end of line"

To enable this option, set it to a value other than 0.

`let g:place_reversed = 1`

===============================================================================
2. Mapping *place-mappings*

Expand Down
1 change: 1 addition & 0 deletions plugin/place.vim
@@ -1,4 +1,5 @@
let g:place_blink = get(g:, 'place_blink', 1)
let g:place_reversed = get(g:, 'place_reversed', 0)

nnoremap <silent> <Plug>(place-insert) :<C-U>call place#insert(0,0)<cr>
nnoremap <silent> <Plug>(place-insert-multiple) :<C-U>call place#insert(1,0)<cr>
Expand Down