* change inside @ 2012-10-26 18:06 shawn wilson 2012-10-27 6:38 ` Bart Schaefer ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: shawn wilson @ 2012-10-26 18:06 UTC (permalink / raw) To: zsh-users i use vim bindkeys and am quite happy with it. however one feature that i use a lot in vim is the 'inside' feature - di, ci, yi, etc. and i don't seem to have this on the shell. what's the best way to make something like this work and/or could this be implemented to make this more like native vim? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change inside 2012-10-26 18:06 change inside shawn wilson @ 2012-10-27 6:38 ` Bart Schaefer 2012-10-27 9:16 ` shawn wilson 2012-10-27 23:55 ` Takeshi Banse 2012-11-16 9:23 ` zzapper 2 siblings, 1 reply; 8+ messages in thread From: Bart Schaefer @ 2012-10-27 6:38 UTC (permalink / raw) To: Zsh Users [-- Attachment #1: Type: text/plain, Size: 1107 bytes --] On Friday, October 26, 2012, shawn wilson wrote: > i use vim bindkeys and am quite happy with it. however one feature > that i use a lot in vim is the 'inside' feature - di, ci, yi, etc. and > i don't seem to have this on the shell. what's the best way to make > something like this work and/or could this be implemented to make this > more like native vim? > You will need to create a custom zle widget, or rather, a set of them. The basics of finding the "inside" or "around" are the same for all of them, so you can probably get by with one function that is attached to several widget names and decides what to do based on the value of $WIDGET. The first thing the function should do is invoke "zle vi-find-next-char", this should take care of reading the target character for the inside/around boundary. Then $BUFFER[CURSOR] is that character, so you can use it to find the previous occurrence of the same. Then you can set $MARK, move the cursor to that previous occurence, and call something such as the kill-region builtin or the narrow-to-region function to implement the action for $WIDGET. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change inside 2012-10-27 6:38 ` Bart Schaefer @ 2012-10-27 9:16 ` shawn wilson 2012-10-27 17:42 ` Bart Schaefer 0 siblings, 1 reply; 8+ messages in thread From: shawn wilson @ 2012-10-27 9:16 UTC (permalink / raw) To: Bart Schaefer; +Cc: Zsh Users On Sat, Oct 27, 2012 at 6:38 AM, Bart Schaefer <schaefer@brasslantern.com> wrote: > On Friday, October 26, 2012, shawn wilson wrote: > >> i use vim bindkeys and am quite happy with it. however one feature >> that i use a lot in vim is the 'inside' feature - di, ci, yi, etc. and >> i don't seem to have this on the shell. what's the best way to make >> something like this work and/or could this be implemented to make this >> more like native vim? >> > > You will need to create a custom zle widget, or rather, a set of them. thanks for the pointers. i'll look at what it'll take to script this out. however, (and i didn't ask this directly because i was unsure if there was just a feature i had missed) what is the general idea behind the vi mode in zsh? is this a feature that is meant to stay compatible with bash/tcsh/etc? or is this meant to bring as much of the vim command set as possible, but without being cumbersome into zsh? if the philosophy is the former, than maybe a pull request to oh-my-zsh is the way to go (who is ~10 months behind on merges). however, if it is the later, than this should really be a feature request. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change inside 2012-10-27 9:16 ` shawn wilson @ 2012-10-27 17:42 ` Bart Schaefer 2012-10-27 18:14 ` Ray Andrews 0 siblings, 1 reply; 8+ messages in thread From: Bart Schaefer @ 2012-10-27 17:42 UTC (permalink / raw) To: Zsh Users On Oct 27, 9:16am, shawn wilson wrote: } } thanks for the pointers. i'll look at what it'll take to script this } out. however, (and i didn't ask this directly because i was unsure if } there was just a feature i had missed) what is the general idea behind } the vi mode in zsh? is this a feature that is meant to stay compatible } with bash/tcsh/etc? or is this meant to bring as much of the vim } command set as possible, but without being cumbersome into zsh? The philosophy *was* to remain as close as possible to the ORIGINAL "vi" and *avoid* any of the new features introduced by the slew of replacement vi-like editors, only one of which at the time was vim. Of course "new features" now means "features less than 20 years old" ... I won't attempt to assert that this still *is* the philosophy, because ever since zsh stopped being interesting as a project for university computer science students to hack on, we've had a hard time finding enough volunteer programmers to change much of anything, and vi mode in the line editor is not something users have been clamoring about. So to that extent there's not much philosophy other than the overarching zsh concept of "don't break anything that's been working for years." I will say that vim is one of the reasons I became an emacs user. The whole point of vi, for me, was to create my own custom macros and attach them to unused keystrokes; if my custom macros aren't loaded, I expect those keystrokes to beep at me, not go off doing some new thing I have no idea how to unwind because the undo action has been "improved". I don't think there's any such thing as an "unused keystroke" in vim, now. Sigh, pardon the curmudgeonly rant, but "don't break anything ..." ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change inside 2012-10-27 17:42 ` Bart Schaefer @ 2012-10-27 18:14 ` Ray Andrews 2012-10-27 20:18 ` shawn wilson 0 siblings, 1 reply; 8+ messages in thread From: Ray Andrews @ 2012-10-27 18:14 UTC (permalink / raw) To: zsh-users On 27/10/12 10:42 AM, Bart Schaefer wrote: > I won't attempt to assert that this still *is* the philosophy, because > ever since zsh stopped being interesting as a project for university > computer science students to hack on, we've had a hard time finding > enough volunteer programmers to change much of anything, How sad, and how difficult to understand. I'm still only using zsh in the most superficial way, and my opinion of it vs. bash isn't worth very much, but for whatever it is worth, I find the bash shell, as it comes ROOTB to be so crippled and horrible and useless as to be almost sadistic. So awful as to drive me right back to DOS, where I had the sublime elegance of 4DOS to work with. I turned to zsh in sheer desperation. It too is rather crippled ROOTB, but it seemed much easier to get to the point where it is a pleasure to use, and now I can't imagine going back to bash. This being so, I don't understand how it might be that keeping zsh brightly polished would *not* be seen as one of the most important tasks in the 'nix world and I would have guessed that there would be hundreds of guys working on it. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change inside 2012-10-27 18:14 ` Ray Andrews @ 2012-10-27 20:18 ` shawn wilson 0 siblings, 0 replies; 8+ messages in thread From: shawn wilson @ 2012-10-27 20:18 UTC (permalink / raw) Cc: zsh-users On Sat, Oct 27, 2012 at 6:14 PM, Ray Andrews <rayandrews@eastlink.ca> wrote: > On 27/10/12 10:42 AM, Bart Schaefer wrote: >> >> I won't attempt to assert that this still *is* the philosophy, because >> ever since zsh stopped being interesting as a project for university >> computer science students to hack on, we've had a hard time finding >> enough volunteer programmers to change much of anything, > > How sad, and how difficult to understand. I'm still only using zsh in the > most superficial way, and my opinion of it vs. bash isn't worth very much, > but for whatever it is worth, I find the bash shell, as it comes ROOTB to be > so crippled and horrible and useless as to be almost sadistic. So awful as > to drive me right back to DOS, where I had the sublime elegance of 4DOS to > work with. I turned to zsh in sheer desperation. It too is rather crippled > ROOTB, but it seemed much easier to get to the point where it is a pleasure > to use, and now I can't imagine going back to bash. This being so, I don't > understand how it might be that keeping zsh brightly polished would *not* be > seen as one of the most important tasks in the 'nix world and I would have > guessed that there would be hundreds of guys working on it. yeah, i had no idea that y'all were in such a need for developers. i mean, that's really interesting since pretty much everyone i know who knows what a shell is uses zsh and most have used it for years. i've only recently gotten past the superficial level but always loved the autocomplete over bash. i mean, i noticed the other day that debian even has a /etc/bash-completion.d/ directory with tons of little scripts for programs. to me that's just kludgy. i sorta like what bart said about vi. maybe i'll get board one day, compile exvi and start scripting out all the features i like with it. :) i do like some things to be loosely built in though - like the module system, but maybe an option to the module to say, give me extended features (like the modes in the vipr emacs module). idk how much i'd be able to help, but i cloned the git (because i wanted a newer shell on debian stable) so maybe i'll look through the code and see if there's any help i can provide. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change inside 2012-10-26 18:06 change inside shawn wilson 2012-10-27 6:38 ` Bart Schaefer @ 2012-10-27 23:55 ` Takeshi Banse 2012-11-16 9:23 ` zzapper 2 siblings, 0 replies; 8+ messages in thread From: Takeshi Banse @ 2012-10-27 23:55 UTC (permalink / raw) To: zsh-users Hi, * shawn wilson <ag4ve.us@gmail.com> [2012-10-27 03:06]: > i use vim bindkeys and am quite happy with it. however one feature > that i use a lot in vim is the 'inside' feature - di, ci, yi, etc. and I did it for my own, but it is imperfect though. https://github.com/hchbaw/opp.zsh Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change inside 2012-10-26 18:06 change inside shawn wilson 2012-10-27 6:38 ` Bart Schaefer 2012-10-27 23:55 ` Takeshi Banse @ 2012-11-16 9:23 ` zzapper 2 siblings, 0 replies; 8+ messages in thread From: zzapper @ 2012-11-16 9:23 UTC (permalink / raw) To: zsh-users shawn wilson wrote in news:CAH_OBicRQa-a9Mv_sr6emgObHD11CjF3hxF3M= 3LdfTxib8YpA@mail.gmail.com: > i use vim bindkeys and am quite happy with it. however one feature > that i use a lot in vim is the 'inside' feature - di, ci, yi, etc. and > i don't seem to have this on the shell. what's the best way to make > something like this work and/or could this be implemented to make this > more like native vim? > the inside/outside operators are relatively new to vim of course. They would be particularly useful when editting commands of course because they often contain a mess of quotes. especially ci' and ca' -- zzapper http://zzapper.co.uk/ Technical Tips ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-11-16 9:23 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-10-26 18:06 change inside shawn wilson 2012-10-27 6:38 ` Bart Schaefer 2012-10-27 9:16 ` shawn wilson 2012-10-27 17:42 ` Bart Schaefer 2012-10-27 18:14 ` Ray Andrews 2012-10-27 20:18 ` shawn wilson 2012-10-27 23:55 ` Takeshi Banse 2012-11-16 9:23 ` zzapper
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).