Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make mapping configurable

  • Loading branch information...
commit ff6b1561f825280ce98d8272f1c8aac9b5756a58 1 parent 736e2df
@sickill authored
Showing with 27 additions and 8 deletions.
  1. +6 −0 README.md
  2. +9 −0 doc/pasta.txt
  3. +12 −8 plugin/pasta.vim
View
6 README.md
@@ -106,6 +106,12 @@ To white-list some filetypes put following in your .vimrc:
*Note: if white list is defined no black list checking is performed.*
+If you don't want pasta to override default `p` and `P` mappings you can
+change it like this:
+
+ let g:pasta_paste_before_mapping = ',P'
+ let g:pasta_paste_after_mapping = ',p'
+
## Author
Marcin Kulik (@sickill)
View
9 doc/pasta.txt
@@ -13,6 +13,9 @@ Basically it opens new, properly indented line (with |o| or |O|) in the place
you're pasting to then it pastes the text with |]p|. The result is nicely
indented code with relative indentation between pasted lines preserved.
+See configuration section below for details on how to use different mapping
+than |p| and |P|.
+
CONFIGURATION *pasta-config*
By default pasta is disabled for python, coffeescript and markdown because
@@ -32,6 +35,12 @@ To white-list some filetypes put following in your .vimrc: >
Note: if white list is defined no black list checking is performed.
+If you don't want pasta to override default |p| and |P| mappings you can
+change it like this: >
+
+ let g:pasta_paste_before_mapping = ',P'
+ let g:pasta_paste_after_mapping = ',p'
+
ABOUT *pasta-about*
Grab the latest version or report a bug on GitHub:
View
20 plugin/pasta.vim
@@ -49,21 +49,25 @@ function! s:SetupPasta()
return
endif
- if maparg('p') ==# ''
- nmap <buffer> p <Plug>AfterPasta
- xmap <buffer> p <Plug>VisualPasta
- endif
+ exe "nmap <buffer> " . g:pasta_paste_before_mapping . " <Plug>BeforePasta"
+ exe "xmap <buffer> " . g:pasta_paste_before_mapping . " <Plug>VisualPasta"
- if maparg('P') ==# ''
- nmap <buffer> P <Plug>BeforePasta
- xmap <buffer> P <Plug>VisualPasta
- endif
+ exe "nmap <buffer> " . g:pasta_paste_after_mapping . " <Plug>AfterPasta"
+ exe "xmap <buffer> " . g:pasta_paste_after_mapping . " <Plug>VisualPasta"
endfunction
if !exists("g:pasta_disabled_filetypes")
let g:pasta_disabled_filetypes = ["python", "coffee", "markdown"]
endif
+if !exists("g:pasta_paste_before_mapping")
+ let g:pasta_paste_before_mapping = 'P'
+endif
+
+if !exists("g:pasta_paste_after_mapping")
+ let g:pasta_paste_after_mapping = 'p'
+endif
+
nnoremap <silent> <Plug>BeforePasta :<C-U>call <SID>NormalPasta('P', 'O')<CR>
nnoremap <silent> <Plug>AfterPasta :<C-U>call <SID>NormalPasta('p', 'o')<CR>
xnoremap <silent> <Plug>VisualPasta :<C-U>call <SID>VisualPasta()<CR>
Please sign in to comment.
Something went wrong with that request. Please try again.