Git Product home page Git Product logo

vim-columnmove's Introduction

vim-columnmove

Build Status Build status

This plugin implements several keymappings to move cursor in vertical direction.

columnmove-f

columnmove-f and its variants are the motion commands to bring cursor to the position assigned by a character in the same column.

This group has six keymappings, that is, columnmove-f, columnmove-t, columnmove-F, columnmove-T, columnmove-;, columnmove-,. Each of them are the imitations of f, t, F, T, ;, , commands, but work in vertical direction.

Those commands are mapped to <M-f>, <M-t>, <M-F>, <M-T>, <M-;>, <M-,> in default.

columnmove-f

columnmove-w

columnmove-w and its variants are the commands for moving cursor in word-wise. This group has eight keymappings, that is, columnmove-w, columnmove-b, columnmove-e, columnmove-ge, columnmove-W, columnmove-B, columnmove-E, columnmove-gE. Each of them are the imitations of w, b, e, ge, W, B, E, gE commands, but work in vertical direction. These commands regard the column which the cursor is on as a line and search for the head or tail of word to move. These commands regard a empty part of the column (like empty lines) as a space to skip it. For example, assume a vimscript code like this:

echo "first line"
echo "second line"
echo "--- separator ---"

echo "fifth line"
echo "sixth line"
echo "seventh line"

echo "--- separator ---"
echo "tenth line"
echo "eleventh line"

Cut out the seventh column.

f
s
-

f
s
s

-
t
e

Consider it as a line.

fs- fss -te

Empty columns are converted to spaces. Words are defined by using the option 'iskeyword'. Usually - is not keyword in vimscript code. Thus if the cursor is placed on the first f, w command brings cursor like, - -> f -> - -> t. Hence columnmove-w command bring cursor to the third, fifth, and, nineth, and, tenth lines from the first line.

These commands are mapped to <M-w>, <M-b>, <M-e>, <M-g>e, <M-W>, <M-B>, <M-E>, <M-g>E in default.

columnmove-w:strict

However, actually, almost all the programming languages are semantic in line-wise. It means hardly to align characters vertically in semantic way, and these "strict" commands might not be useful always. If you find that, why don't you try "spoiled" commands with following configuration?

let g:columnmove_strict_wbege = 0

With this configuration, columnmove-w and its variants do not think whether characters are included in 'iskeyword' or not. Just judge whether there is a empty or a character. Here, write again the example code.

f
s
-

f
s
s

-
t
e

"spoiled" commands would stop cursor on the fifth and nineth line since fs-, fss, and, -te are strings which are separated by empty line. It means that if there is a space, still stops cursor on the space.

columnmove-w:spoiled

vim-columnmove's People

Contributors

machakann avatar bertrandsim avatar

Stargazers

Anton Styagun avatar Lunaphied avatar  avatar Serene  avatar Qyriad avatar ik5 avatar  avatar theans avatar Mushfiq Mahmud avatar  avatar  avatar Evangelos Constantinou avatar Haruki Matsui avatar emtee avatar György Andorka avatar jdhao avatar Adam Wagner avatar GAURAV avatar milvi avatar kuator avatar  avatar Andy Shevchenko avatar hokorobi avatar Yuta Katayama avatar  avatar  avatar  avatar  avatar  avatar Andrea Greselin avatar Ratheesh(ರತೀಶ್) avatar Daniel Dugas avatar Suraj N. Kurapati avatar Leonard avatar Nedumaran Rajagopal avatar Chris Watson avatar Robert avatar Jerome Castaneda avatar toshi32tony3 avatar Khalid H. Ahmed avatar Karl Yngve Lervåg avatar Jonathan Barratt avatar Nic West avatar Shu Uesugi avatar Mike Funk avatar Kevin MacMartin avatar Sasha Koss avatar Daniel R. avatar Morton Fox avatar Ricardo M. Vilchis avatar haya14busa avatar deris avatar Keith Yang avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

vim-columnmove's Issues

Suggestion for options: block-wise operator mode option

As I suggested in a comment here, I think it makes sense to map the operator mode for columnmove directly to the block wise modes, in order to be able to do deletes and replaces along the columns.

It is very simple to do this with custom mappings, as I've done (see here). However, I think this feature could be added as an optional feature.

Repeat with dot echoes status message

If I do a columnwise motion delete, e.g. with d<c-v><m-f>c from the cursor at the first a in the following example:

aaa
bbb
ccc

And then repeat with dot ., then the plugin echoes call columnmove#ftFT_executer(). This happens with default settings.

With "spoiled" rule, what is difference between columnmove-w and columnmove-W ?

Hello there. With the "spoiled" rule, (let g:columnmove_strict_wbege = 0), I would like to ask, what is difference between columnmove-w,b,e,ge and columnmove-W,B,E,gE ?

From the documentation, it seems that these are the same, since columnmove-w and its variants now only check based on empty spaces; it now does not check based on keywords.

[Announce] I plan to change the behavior of columnmove-w, b, e, ge

Currently these mappings regard spaces and non-character positions as identical and never stop the cursor on a space. However I felt the behavior inconvenient sometimes. For example:

first line
second line
third line


sixth line

eighth line
ninth line

Thinking on a buffer like this, fourth fifth seventh lines are empty, when the cursor is in the sixth column columnmove-w does not stop the cursor at the sixth line, but I want it to stop actually!

So my idea is the cursor should be stopped even on a space if it is adjacent with non-character position. Basically these mappings work almost as same as before but the cursor stops slightly more frequent. I plan to merge the change soon and, probably, I will also implement an option to keep old behavior. Thanks.

Allow w,b,e,ge to jump past leading spaces

Suppose I have the following text

{i}ndent0 i[n]dent0
  indent1 indent1
  indent1 indent1

  indent1
  indent1
  indent1
indent0

and the following settings

let g:columnmove_strict_wbege = 0 
let g:columnmove_stop_on_space = 1

With my cursor on [],
<M-e> moves the cursor to the space on line 3. This is the expected behavior, since g:columnmove_stop_on_space = 1.

Now, with my cursor on {},
<M-e> also takes me to line 3.
However, I hope that <M-e> moves the cursor to the second indent 0 on line 8.
That is, I wish to treat leading spaces in the same way as blank lines.

Would it be possible to add an option for this? Maybe g:columnmove_stop_on_leading_space?

Error when moving past multi byte characters

I was made aware of this plugin due to this question on vi.stackexchage.com. It seems like a very nice plugin!

When testing it, I noticed that the columnwise motions are wrong when there are multi byte characters (or something similar). That is:

aa|a
aaa

bbb
øbb

ccc
ccc

Let | denote where the cursor is (i.e. first line column two). Now do <m-w> twice. This should leave the cursor on the second column on the sixth line, but instead I end up at the first column. The reason is that ø is a multi byte character or something like that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.