coderifous / textobj-word-column.vim Goto Github PK
View Code? Open in Web Editor NEWAdds text-objects for word-based columns in Vim.
Adds text-objects for word-based columns in Vim.
(Using ea8ff3d.)
Given this text:
let g:ctrlp_extensions = ['funky', 'register']
nmap <C-o>l :CtrlPLastMode<CR>
nmap <C-o>b :CtrlPBuffer<CR>
nmap <C-o>f :call ctrlp#init(ctrlp#funky#id())<CR>
nmap <C-o>r :CtrlPRegister<CR>
If I put my cursor on the first <
and type vic
, then the :
and the column of <
beneath it are selected. But what I wanted was just the column of <
.
I would expect viC
to do what I want, but instead it selects g:ctrlp_extensions
and all of the lines below it. I'm not certain if that's correct. Maybe that's related to #1.
Is there any way to do what I want? vaC
does the same thing as viC
in this case. vac
selects g:
and the lines below it. It seems like I want the selection priority to be on the word that my cursor is on.
On this text:
id: String,
node: String,
lastTried: sql.Timestamp,
lastTriedUri: String,
lastTriedSeeding: sql.Timestamp,
lastTriedDepth: Int,
lastFetched: Option[sql.Timestamp],
lastFetchedStatus: Option[Int],
lastParsed: Option[sql.Timestamp],
lastParsedOutLinks: Option[Int]
I do viC
from here:
and get this selection:
whereas I was expecting a selection more like this:
I wonder whether it would be possible to sum a column, putting the result in the unnamed register ""
.
Right now I can't think of a way because :
will seemingly always operate on new lines, but perhaps someone has a better idea?
(Using ea8ff3d.)
Given this text:
let ctrlp_extensions = ['funky', 'register']
nmap <C-o>l :CtrlPLastMode<CR>
nmap <C-o>b :CtrlPBuffer<CR>
nmap <C-o>f :call ctrlp#init(ctrlp#funky#id())<CR>
nmap <C-o>r :CtrlPRegister<CR>
If I put my cursor on the first <
and type vic
, then part of the first line is selected. I would expect the column of <
to be selected. Instead, the selected block includes ctrlp_extensions
and all five lines. Since the word boundaries are in different columns, I think this is incorrect.
Hi,
Have you already considered using the vim-textobj-user plugin (see https://github.com/kana/vim-textobj-user)?
I think it would be interesting, for several reasons:
s:find_boundary_row is recursive and can cause E132: Function call depth is higher than 'maxfuncdepth'
on selections using more than &maxfuncdepth
lines. (maxfuncdepth defaults to 100) Looks like function could be done iteratively instead.
Also, not really relevant to this issue, but have you seen textobj-user? Might be useful to take care of some boilerplate stuff?
Here's a Github article. You can automate it with this third-party site or here's the MIT template that you can paste into LICENSE.txt.
Great plugin! I love the idea, but unfortunately it doesn't work with tabs. Looks like it's because when using |
to jump to a column, it uses screen columns (instead of actual columns -- see :help bar
). Maybe you could multiply the number of tab characters by the value of tabstop
?
Repro:
Edit word-column.vim
Put cursor on first 'let' in file.
vic
selects all of the lets.
%sm/^ /\t
to switch to tabs.
Put cursor on first 'let' in file.
vic
selects some weird stuff (on ca711dd it selects a bunch of stuff late in the file and on 69c30da it selects from the beginning of the line).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.