• Stars
    star
    150
  • Rank 239,793 (Top 5 %)
  • Language
    Vim Script
  • Created over 13 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

easy text manupilation for vim

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 <D-d> <Plug>(textmanip-duplicate-down)
nmap <D-d> <Plug>(textmanip-duplicate-down)
xmap <D-D> <Plug>(textmanip-duplicate-up)
nmap <D-D> <Plug>(textmanip-duplicate-up)

xmap <C-j> <Plug>(textmanip-move-down)
xmap <C-k> <Plug>(textmanip-move-up)
xmap <C-h> <Plug>(textmanip-move-left)
xmap <C-l> <Plug>(textmanip-move-right)

" toggle insert/replace with <F10>
nmap <F10> <Plug>(textmanip-toggle-mode)
xmap <F10> <Plug>(textmanip-toggle-mode)

" use allow key to force replace movement
xmap  <Up>     <Plug>(textmanip-move-up-r)
xmap  <Down>   <Plug>(textmanip-move-down-r)
xmap  <Left>   <Plug>(textmanip-move-left-r)
xmap  <Right>  <Plug>(textmanip-move-right-r)

gVim

xmap <M-d> <Plug>(textmanip-duplicate-down)
nmap <M-d> <Plug>(textmanip-duplicate-down)
xmap <M-D> <Plug>(textmanip-duplicate-up)
nmap <M-D> <Plug>(textmanip-duplicate-up)

xmap <C-j> <Plug>(textmanip-move-down)
xmap <C-k> <Plug>(textmanip-move-up)
xmap <C-h> <Plug>(textmanip-move-left)
xmap <C-l> <Plug>(textmanip-move-right)

" toggle insert/replace with <F10>
nmap <F10> <Plug>(textmanip-toggle-mode)
xmap <F10> <Plug>(textmanip-toggle-mode)

" use allow key to force replace movement
xmap  <Up>     <Plug>(textmanip-move-up-r)
xmap  <Down>   <Plug>(textmanip-move-down-r)
xmap  <Left>   <Plug>(textmanip-move-left-r)
xmap  <Right>  <Plug>(textmanip-move-right-r)

vim on terminal

xmap <Space>d <Plug>(textmanip-duplicate-down)
nmap <Space>d <Plug>(textmanip-duplicate-down)
xmap <Space>D <Plug>(textmanip-duplicate-up)
nmap <Space>D <Plug>(textmanip-duplicate-up)

xmap <C-j> <Plug>(textmanip-move-down)
xmap <C-k> <Plug>(textmanip-move-up)
xmap <C-h> <Plug>(textmanip-move-left)
xmap <C-l> <Plug>(textmanip-move-right)

" toggle insert/replace with <F10>
nmap <F10> <Plug>(textmanip-toggle-mode)
xmap <F10> <Plug>(textmanip-toggle-mode)

keymap advanced macvim (this is my current configuration).

nmap <CR>   <Plug>(textmanip-blank-below)
nmap <S-CR> <Plug>(textmanip-blank-above)
xmap <CR>   <Plug>(textmanip-blank-below)
xmap <S-CR> <Plug>(textmanip-blank-above)

nmap <D-D> <Plug>(textmanip-duplicate-up)
nmap <D-d> <Plug>(textmanip-duplicate-down)
xmap <D-D> <Plug>(textmanip-duplicate-up)
xmap <D-d> <Plug>(textmanip-duplicate-down)

xmap <C-k> <Plug>(textmanip-move-up)
xmap <C-j> <Plug>(textmanip-move-down)
xmap <C-h> <Plug>(textmanip-move-left)
xmap <C-l> <Plug>(textmanip-move-right)

xmap <D-K> <Plug>(textmanip-duplicate-up)
xmap <D-J> <Plug>(textmanip-duplicate-down)
xmap <D-H> <Plug>(textmanip-duplicate-left)
xmap <D-L> <Plug>(textmanip-duplicate-right)
                              
xmap  <Up>    <Plug>(textmanip-move-up-r)
xmap  <Down>  <Plug>(textmanip-move-down-r)
xmap  <Left>  <Plug>(textmanip-move-left-r)
xmap  <Right> <Plug>(textmanip-move-right-r)
                              
nmap <C-s> <Plug>(textmanip-toggle-mode)
xmap <C-s> <Plug>(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

More Repositories

1

atom-vim-mode-plus

vim-mode improved
CoffeeScript
1,404
star
2

vim-choosewin

Land on window you chose like tmux's 'display-pane'
Vim Script
562
star
3

vim-quickhl

quickly highlight <cword> or visually selected word
Vim Script
229
star
4

vagrant-snap

snapshoft management plugin for vagrant
Ruby
119
star
5

vim-ruby-xmpfilter

helper for ruby's xmpfilter or seeing_is_believing
Vim Script
115
star
6

atom-narrow

narrow something
JavaScript
110
star
7

vim-chef

jump to related file in chef's cookbook
Vim Script
70
star
8

vim-smalls

spot your cursor with simple search
Vim Script
64
star
9

vim-transform

Transform syntax!!
Vim Script
59
star
10

atom-cursor-history

Cursor position history manager
JavaScript
59
star
11

dotfiles

dotfiles
JavaScript
44
star
12

awesome-tadoku

Tadoku(多čŖ­)+Ī± ćƒŖć‚½ćƒ¼ć‚¹ćƒŖćƒ³ć‚Æ集ćØäø€å£ć‚³ćƒ”ćƒ³ćƒˆ
Ruby
33
star
13

atom-quick-highlight

Highlight text quickly
JavaScript
33
star
14

atom-vim-mode-plus-ex-mode

Experiment to implement ex-mode for vim-mode-plus
JavaScript
30
star
15

atom-project-folder

Quickly add/remove project folder
JavaScript
26
star
16

vim-ezbar

&statusline configuration helper for minimalist.
Vim Script
25
star
17

atom-lazy-motion

Rapid cursor positioning with fuzzy search.
CoffeeScript
21
star
18

atom-vim-mode-plus-keymaps-for-surround

provides default keymap for surround
21
star
19

atom-open-this

Open file under cursor like `gf`(Vim), `C-x C-f`(Emacs)
CoffeeScript
19
star
20

atom-keystroke

define multi keystroke commands easily
JavaScript
17
star
21

atom-mprettier

Minimalistic prettier runner for more performant Atom startup
JavaScript
16
star
22

atom-vim-mode-visual-block

Add visual-blockwise operation to vim-mode.
CoffeeScript
15
star
23

atom-smalls

Rapid cursor positioning across any visible chars with search and jump.
CoffeeScript
15
star
24

atom-choose-pane

focus pane by label
JavaScript
15
star
25

atom-inline-git-diff

Inline git diffs in editor
JavaScript
14
star
26

vim-surround_custom_mapping

helper utility for tpope's surround.vim , which enables you setup filetype based custom mapping.
Vim Script
13
star
27

vim-unite-ack

narrow the Ack result with unite.vim
Vim Script
12
star
28

atom-markdown-toc-auto

auto insert and update table of contents on save
JavaScript
12
star
29

pxelerator

make PXE installation setup easy
Ruby
10
star
30

cmdline-fu

simple CLI front-end for http://www.commandlinefu.com/
10
star
31

atom-theme-switch

Switch theme quickly
JavaScript
9
star
32

tmux_config

my tmux configration
Ruby
9
star
33

vim-nerdtree_plugin_collections

my personal nerdtree plugin collections
Vim Script
9
star
34

atom-vim-mode-plus-move-selected-text

Move selected text like object
CoffeeScript
8
star
35

cram-vocabulary

JavaScript
7
star
36

js-study

JavaScript self study notes
7
star
37

my-vim-config

my vimrc
Vim Script
7
star
38

build-kikutan

Build kikutan(悭ć‚Æć‚æćƒ³) like sound album from text using GoogleTTS
Ruby
6
star
39

atom-paner

Pane manipulation helper
JavaScript
6
star
40

atom-toggle

Toggle keyword
JavaScript
6
star
41

vim-macvim-transparency

change MacVim's window transparency with shortcut
Vim Script
6
star
42

anki-accelerate-image-drag-and-drop

Accelerate workflow when you drag&drop image to a cards repetitively
Python
5
star
43

go-study

Golang self study notes ā€” Edit
Go
5
star
44

vim-fthook

provide very simple filetype hook facility.
Vim Script
5
star
45

vim-phrase

gather userful phrase for reference
Vim Script
5
star
46

atom-isearch

Incremental search for Atom
CoffeeScript
5
star
47

atom-project-find-navigation

Improve project-find-result navigation by dirty hack.
CoffeeScript
5
star
48

atom-clip-history

Paste from clipboard history like emacs' kill-ring
JavaScript
5
star
49

phrase-t9md

phrase of t9md
Ruby
4
star
50

vim-textobj-function-ruby

textobj for ruby's method depending on vim-ruby's ]M and [m
Vim Script
4
star
51

atom-demo-mode

Show command dispatch at hover indicator / also provide service for special integration
JavaScript
4
star
52

vim-learn

CSS
4
star
53

atom-transformer

Transform something
JavaScript
3
star
54

chef-solo-quickstart

Quick start to learn chef's DSL with chef-solo
Ruby
3
star
55

vim-underlinetag

underline Tag to know which word I could jump with C-]
Vim Script
3
star
56

atom-narrow-git-ls

narrow-git-ls
JavaScript
3
star
57

vim-unite-experiment

my local experiment for unite.vim
Vim Script
3
star
58

atom-vim-mode-plus-project-find-from-search

Seamless flow from vmp's search to find-and-replace's project-find
CoffeeScript
3
star
59

iTerminitor

iTerm setup easily
Ruby
2
star
60

atom-vim-mode-plus-replace-with-execution

TransformString with result of execution
JavaScript
2
star
61

vagrant_example

several example of vagrant and chef or puppet
Ruby
2
star
62

aptsync

apt-mirror like utility. diff: KISS, short code, use rsync.
Ruby
2
star
63

vim-resizewin

toggle winsize horizontally vertically or both maximized.
Vim Script
2
star
64

vim-snipplr

vim frontend for http://snipplr.com/
2
star
65

vim-unite-lines

nallowing lines from current buffer
Vim Script
2
star
66

puppet-pi-mode.el

Puppet pi mode for emacs enable you to use pi (puppet type reference cmd-line-tool) from Emacs.
Emacs Lisp
2
star
67

bulk-screen-capture

bulk screen capture script intended to use for Anki
Python
2
star
68

vim-quicktag

automatically generate tags
Vim Script
2
star
69

atom-phrase

Collect phrase, and refer quickly.
CoffeeScript
2
star
70

fu

search www.commandlinefu.com from CLI
Go
2
star
71

t9md

test
2
star
72

vim-tryit

try code in sandbox file.
Vim Script
2
star
73

bdd-infra-train

misc files for bdd-infra
Ruby
2
star
74

ruby_kata

practice for ruby over and over again.
Ruby
1
star
75

atom-mgit

minimum git wrapper just for me
JavaScript
1
star
76

atom-vocabuilder

Let me vocabuild!
JavaScript
1
star
77

atom-hydrogen-helpers

misc helpers for hydrogen
JavaScript
1
star
78

snippy

snippet sharing board based on Flask, teach me python and flask
Python
1
star
79

vim-jslike-oop

VimScript JavaScript Like OOP experiment
Vim Script
1
star
80

puppet-tags.rb

generate tags for puppet's external DSL
1
star
81

atom-focus-pane-or-panel

change focus or pane or panel seamlessly
CoffeeScript
1
star
82

vim-ruby_eval

evaluate text fragment as ruby then insert or print
Ruby
1
star
83

atom-vim-mode-plus-plugin-sample

Sample project for package as vim-mode-plus's plugin
JavaScript
1
star
84

atom-vim-mode-plus-auto-ime

automatically change ime when vim mode changes
JavaScript
1
star
85

ruby-network-programming-learning

teach ruby network programming to myself
Ruby
1
star
86

vim2tmux.vim

send line from buffer to tmux's pane!!
Vim Script
1
star
87

vim-misc-experiment

several experimental before becoming plugin.
Vim Script
1
star
88

atom-try

Paste fragment of code into try buffer then try it!
CoffeeScript
1
star
89

vim-paste-marker

vim plugin , this enables you to first put mark as target then yank to distined target.
Vim Script
1
star
90

vim-mapswap

swap keymap temporarily
Vim Script
1
star
91

atom-google-translate

translate and write to editor in dock or split-pane
JavaScript
1
star