Need help with vim-textmanip?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

t9md
139 Stars 5 Forks 180 Commits 4 Opened issues

Description

easy text manupilation for vim

Services available

!
?

Need anything else?

Contributors list

# 75,769
Less
Atom
repl
jupyter...
169 commits
# 78,803
Sass
dark-sy...
viml
Neovim
1 commit
# 749,620
JavaScr...
TypeScr...
Shell
viml
1 commit
# 13,325
JavaScr...
TypeScr...
React
Shell
1 commit

Move/Duplicate text intuitively.

  • Move selected lines or block area to specified direction ( up/down/right/left ).
  • Duplicate selected lines or block to specified direction ( up/down/right/left ).
  • Two mode: inesrt or replace
  • Count support
  • Keep original cursor position (include 'o'ther pos in visualmode!) while moving / duplicating.
  • Undo with one 'u' by undojoining.

Example

help

Configuration example

GUI macvim ( which I use now )

xmap  (textmanip-duplicate-down)
nmap  (textmanip-duplicate-down)
xmap  (textmanip-duplicate-up)
nmap  (textmanip-duplicate-up)

xmap (textmanip-move-down) xmap (textmanip-move-up) xmap (textmanip-move-left) xmap (textmanip-move-right)

" toggle insert/replace with nmap (textmanip-toggle-mode) xmap (textmanip-toggle-mode)

" use allow key to force replace movement xmap (textmanip-move-up-r) xmap (textmanip-move-down-r) xmap (textmanip-move-left-r) xmap (textmanip-move-right-r)

gVim

xmap  (textmanip-duplicate-down)
nmap  (textmanip-duplicate-down)
xmap  (textmanip-duplicate-up)
nmap  (textmanip-duplicate-up)

xmap (textmanip-move-down) xmap (textmanip-move-up) xmap (textmanip-move-left) xmap (textmanip-move-right)

" toggle insert/replace with nmap (textmanip-toggle-mode) xmap (textmanip-toggle-mode)

" use allow key to force replace movement xmap (textmanip-move-up-r) xmap (textmanip-move-down-r) xmap (textmanip-move-left-r) xmap (textmanip-move-right-r)

vim on terminal

xmap d (textmanip-duplicate-down)
nmap d (textmanip-duplicate-down)
xmap D (textmanip-duplicate-up)
nmap D (textmanip-duplicate-up)

xmap (textmanip-move-down) xmap (textmanip-move-up) xmap (textmanip-move-left) xmap (textmanip-move-right)

" toggle insert/replace with nmap (textmanip-toggle-mode) xmap (textmanip-toggle-mode)

keymap advanced macvim (this is my current configuration).

nmap    (textmanip-blank-below)
nmap  (textmanip-blank-above)
xmap    (textmanip-blank-below)
xmap  (textmanip-blank-above)

nmap (textmanip-duplicate-up) nmap (textmanip-duplicate-down) xmap (textmanip-duplicate-up) xmap (textmanip-duplicate-down)

xmap (textmanip-move-up) xmap (textmanip-move-down) xmap (textmanip-move-left) xmap (textmanip-move-right)

xmap (textmanip-duplicate-up) xmap (textmanip-duplicate-down) xmap (textmanip-duplicate-left) xmap (textmanip-duplicate-right)

xmap (textmanip-move-up-r) xmap (textmanip-move-down-r) xmap (textmanip-move-left-r) xmap (textmanip-move-right-r)

nmap (textmanip-toggle-mode) xmap (textmanip-toggle-mode)

Experimental hook/helper

Currently only

finish
hook point is supported.
finish
is called just before manipulation finish. If you want to additional text manipulation, you can start from following example. The
hook
must accept one argument(
tm
in this example), which is texmanip app instance itself.
let g:textmanip_hooks = {}
function! g:textmanip_hooks.finish(tm)
  let tm = a:tm
  let helper = textmanip#helper#get()
  if tm.linewise
    " if filetype is `html` automatically indent
    if &ft ==# 'html'
      call helper.indent(tm)
    endif
  else
    " When blockwise move/duplicate, remove trailing white space.
    " To use this feature without feeling counterintuitive,
    " I recommend you to ':set virtualedit=block',
    call helper.remove_trailing_WS(tm)
  endif
endfunction

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.