News for hackers. Stuff that matters.
Re:Seven habits of effective text editing (2000) by jimmaswell on Monday October 23, 2017 @08:52AM (#15532761)
I've used vim quite a bit but it still never beat GUI editors for me. The lack of a mouse cursor was always a pain point - for example simple copy/pastes take notably longer. Moving a block of code below another block of code takes 1 second in notepad++ while in vim you have to go V 10d x 13down P or something along those lines, figuring out exactly what numbers to use there probably takes more than 1 second alone. It always feels claustrophobic editing a file in vim, like I'm having tunnel vision, and jumping around files to understand the structure of a program or write a feature that changes many things is more time consuming, and pgup/pgdn and arrow keys just aren't as good as a scroll bar.

Overall I'm glad vim exists so editing config files remotely is easier if I don't have the server mounted locally - it's definitely my favorite shell text editor so far but I'd take notepad++ or visual studio over it any day.

Re:Seven habits of effective text editing (2000) by jonahx on Monday October 23, 2017 @09:35AM (#15533042)
> Moving a block of code below another block of code takes 1 second in notepad++ while in vim you have to go V 10d x 13down P or something along those lines, figuring out exactly what numbers to use there probably takes more than 1 second alone.

    dip}p
which would be pure muscle memory to an experienced vim user, and certainly faster than doing it with a mouse.

Vim isn't for everyone, but I mean, it's not really fair to criticize something because you don't know how to use it well yet (though complaining about the learning curve would be reasonable)...

Re:Seven habits of effective text editing (2000) by geofft on Monday October 23, 2017 @10:30AM (#15533398)
> it's not really fair to criticize something because you don't know how to use it well yet

I don't see any criticizing, just "it doesn't work as well for me," which I think is entirely fair.

In particular, it seems like 'jimmaswell prefers an editor where you think of blocks of code as "I can see this on the screen" than "up to the end of the current curly brace," which seems like a legitimate difference in mental processing styles, not a consequence of lack of learning.

I've been using vim as my only code editor for probably 10 years now, and dip}p is foreign to me. I'd do it by using /{ to search for the beginning, using Ctrl-V /} or /^} or something to search for the end, then using d and searching again for the place I want to insert it with p.

(Also, I think { and } don't work if you're using Python, whereas "I as a human can understand the structure of this code and identify the beginning and end of functions, which I already do because I'm literally writing code in this language" is portable between languages.)

Re:Seven habits of effective text editing (2000) by jonahx on Monday October 23, 2017 @10:46AM (#15533530)
> I don't see any criticizing, just "it doesn't work as well for me," which I think is entirely fair.

I had no problem with his tone. But he's very much making a statement about a technical problem he has with vim, and which isn't well-founded.

> In particular, it seems like 'jimmaswell prefers an editor where you think of blocks of code as "I can see this on the screen" than "up to the end of the current curly brace," which seems like a legitimate difference in mental processing styles, not a consequence of lack of learning.

There is nothing about vim that impedes a visual mental processing style. I constantly look at a place I want to select and then jump there using any number of methods -- the easymotion plugin is ideal for this.

> (Also, I think { and } don't work if you're using Python, whereas "I as a human can understand the structure of this code and identify the beginning and end of functions, which I already do because I'm literally writing code in this language" is portable between languages.)

Again, even vanilla vim performs better here than a mouse. But you should really have custom text objects installed for any language you work in regularly. Here's one for python: https://github.com/bps/vim-textobj-python

Re:Seven habits of effective text editing (2000) by ethagnawl on Tuesday October 24, 2017 @12:03AM (#15539115)
Thanks for plugging easymotion. I regularly use a similar feature provided by the VimFx Firefox add-on, but never bothered to look for a way to move similarly inside Vim itself.
Re:Seven habits of effective text editing (2000) by lenkite on Tuesday October 24, 2017 @03:30AM (#15539851)
I find vim sneak better than easy motion: https://github.com/justinmk/vim-sneak

This is so popular, it made it to emacs too: https://github.com/hlissner/evil-snipe

I love the 2 char lookahead/lookbehind. It is so fast and useful.

Re:Seven habits of effective text editing (2000) by jonahx on Tuesday October 24, 2017 @01:50PM (#15543567)
Thanks for the rec. What are the advantages of vim-sneak over easy motion?
Re:Seven habits of effective text editing (2000) by lenkite on Friday October 27, 2017 @06:25AM (#15567100)
Very late responding, but some advantages are described here: https://github.com/goldfeld/vim-seek
Re:Seven habits of effective text editing (2000) by module0000 on Tuesday October 24, 2017 @01:37PM (#15543429)
I had those issues very early on. Forcing myself to do everything in VIM solved it. It's just muscle memory that people are lacking, once you don't have to think about how to indent/move/select/yank and it is an unconscious action: all these difficulties cease to exist.
Re:Seven habits of effective text editing (2000) by vidarh on Monday October 23, 2017 @12:03PM (#15534179)
> where you think of blocks of code as "I can see this on the screen" than "up to the end of the current curly brace," which seems like a legitimate difference in mental processing styles, not a consequence of lack of learning.

I see this a lot. I tend to think of things visually, be it abstract concepts or code. I remember code by how it looks on screen and how it fits together conceptually, rather than the words. I remember the "shape" of pages of specific papers I read 30 years ago that influenced me, but not the precise words - both literally (I remember what the text looks like and how it was laid out on the page) and conceptually (the takeaway of specific "shapes" of text).

To me this seems like a major difference in thinking that alters the type of languages I prefer. E.g. Haskell to me is noise. I can sit down and decipher it. I read many of the original Haskell papers, and implemented my own lambda calculus implementation etc. to try to get my head around it, and many of the concepts stick with me, but the language is too visually messy for me.

I think this distinction of thinking about symbols vs. visual layout is very pervasive.

Re:Seven habits of effective text editing (2000) by joshjje on Monday October 23, 2017 @07:20PM (#15537762)
I think the same way. That is I am extremely visual and remember visual things very well, though like you its more often the shape of it rather than the specific content, depending.

I grew up using Windows though and while I have had to use vi/vim for work and personally before, I dislike it with a passion (due more to that I didnt grow up using it / havent used it extensively im sure). Ill share the linux folder to windows and use Notepad++ when I can lol.

Re:Seven habits of effective text editing (2000) by Crespyl on Monday October 23, 2017 @10:49AM (#15533552)
Pendantry: IIRC `{` and `}` work on paragraphs (or contiguous blocks of lines up to the next blank line) rather than code blocks by default. I'm sure it's possible to change that, but once you're changing things there's no reason not to add support for Python indents or Ruby style `def`/`end` blocks as well.

Like you I also generally just use searches or `%` most of the time.

Re:Seven habits of effective text editing (2000) by fasquoika on Monday October 23, 2017 @04:12PM (#15536561)
Not pedantic at all, tbh. This is an important distinction. Curly braces are my primary way of moving in vim and it works great even without curly braces in the code (even in pieces of code without delimiters, actually)
Re:Seven habits of effective text editing (2000) by Tarean on Monday October 23, 2017 @04:55PM (#15536862)
There are basically three parts to the command

> dip

Delete in paragraph. Command+text object is probably the most frequent pattern in vim for me. It would also would work with other text objects like `di(`, `di{`, `di[` to delete between (...)/{...}/[...] bracket pairs for instance. Or other commands like `cip` for change, `yip` for yank(copy) and so on.

Plus custom text object and commands which give exponential combinations. My most used are `ii` or `ai` for in/around indentation, `s` for surrounding and `gc` for toggling commenting in an area.

`{`/`}` go up/down paragraphs. If the code isn't densely packed this works pretty well to jump between logical sections. For c-like languages there are a bunch of weird jumps like [[ and ]] which you were probably thinking of, they are configurable but don't seem very useful.

p means paste which you probably now anyway.

Re:Seven habits of effective text editing (2000) by smhost on Monday October 23, 2017 @10:54AM (#15533603)
Do you also use something like bde instead of diw, and ?(ld/)<CR> instead of dib? And if the answer is no, how is dip not in your vocabulary after 10 years?
Re:Seven habits of effective text editing (2000) by davidkuhta on Monday October 23, 2017 @09:50AM (#15533121)
^ Hey so for the novice to moderately experienced users, this actually works and is composed of three commands:

  dip   => Operation - delete (cut) inner paragraph

  } => Movement - go to end of paragraph (the end of the paragraph following the one you deleted)

  p => Operation - paste (the paragraph cut using delete)
Edit: Removed 'not sure why dip copies'; Thanks for the TIL PaulBGD_ !

Some other cool diX (delete inner X) commands here: http://vimdoc.sourceforge.net/htmldoc/motion.html#diw

Re:Seven habits of effective text editing (2000) by PaulBGD_ on Monday October 23, 2017 @10:02AM (#15533202)
dip copies because d isn't delete, it's cut.
Re:Seven habits of effective text editing (2000) by fasquoika on Monday October 23, 2017 @04:14PM (#15536571)
Well, the mnemonic is delete, it just also puts the deleted text into your clipboard
Re:Seven habits of effective text editing (2000) by ThatGeoGuy on Monday October 23, 2017 @04:30PM (#15536702)
Since we're talking about pedantry and how it relates to users learning and using vim, let's talk about clipboards. Your clipboard is the '+' register. Cutting or yanking text does not put it into the '+' register, but rather a specified default local register (is it normally 0? Somebody feel free to correct me here). As a consequence, if you delete or yank some text, it doesn't go to the clipboard. If you really want it to go to your clipboard, specify '+' as the default register or call di"+p in place of dip.

This naturally confuses beginners because the concept of registers is completely foreign to other editors. Emacs can provide similar functionality, but by that point Vim is no longer in "weird" mode compared to what you know. We do a lot of simplification when talking about Vim, but small points like this can be immensely confusing for people who just want something to behave the way they're used to.

Re:Seven habits of effective text editing (2000) by hdhzy on Tuesday October 24, 2017 @01:36PM (#15543425)
The default register is unnamed:

> The unnamed register is the default and holds the most recently deleted or yanked text; it’s what’s called upon when you just type p without specifying a register.

Source: https://pbrisbin.com/posts/vim_registers/

Besides + there is also * for accessing alternate clipboard: http://vim.wikia.com/wiki/Accessing_the_system_clipboard

Re:Seven habits of effective text editing (2000) by davidkuhta on Monday October 23, 2017 @10:17AM (#15533310)
That makes sense, thanks.
Re:Seven habits of effective text editing (2000) by pvg on Monday October 23, 2017 @12:09PM (#15534225)
which would be pure muscle memory to an experienced vim user

As selecting some text with a mouse would be for anyone who's ever edited text with a computer. It's hard to see this kind of argument as more than a statement that learning arcana can be enjoyable. It's true, but then you might as well be learning Rust or writing a tutorial on understanding monad tutorials.

Re:Seven habits of effective text editing (2000) by jimmaswell on Monday October 23, 2017 @09:46AM (#15533095)
I didn't mean just blocks of code that would be recognized as a paragraph or are fully enclosed in brackets or anything like that. I mean moving some lines around possibly within the same function, which may or may not have multiple newlines between some of them, and have no lexically distinctive property aside from being the lines you want.
Re:Seven habits of effective text editing (2000) by jonahx on Monday October 23, 2017 @10:09AM (#15533252)
I'd make a few counterpoints there:

1. Even in those situations, I believe a veteran vim user would still beat someone using a mouse.

2. That said, the situation you describe is relatively rare: when coding you typically will be addressing blocks of text defined as functions; sharing an indent level ("ii" selects these); or otherwise selectable by vim in 2-3 keystrokes.

3. Even when that's not the case and the vim selection takes, say, 5 or 6 keystrokes, it has the advantage that your fingers never left the home row, so there is no wasted time "resetting."

4. Just as a tip: doing a "/" search for 2-3 characters after making your visual selection is typically enough to define your block, and will often be faster (and less of a cognitive distraction) than trying to eyeball or count the number of lines and doing a "10j" motion or similar.

Re:Seven habits of effective text editing (2000) by stabbles on Monday October 23, 2017 @10:35AM (#15533440)
> sharing an indent level ("ii" selects these)

That doesn't seem to work. Am I missing something?

Re:Seven habits of effective text editing (2000) by jonahx on Monday October 23, 2017 @10:53AM (#15533588)
I'd forgotten that I get this feature from a plugin:

https://github.com/michaeljsmith/vim-indent-object

Re:Seven habits of effective text editing (2000) by xyzzy_plugh on Monday October 23, 2017 @10:01PM (#15538662)
I've been eyeballing the number of lines (or characters) long enough that I am correct more often than not.

Also, relative line numbering changed my life.

Re:Seven habits of effective text editing (2000) by hellofunk on Monday October 23, 2017 @09:54AM (#15533149)
I used to share your sentiment but kept going with vim for a year, and now I'm spoiled. Any time for some reason I am forced to use a GUI and a mouse, everything just feels so slow to me now.
Re:Seven habits of effective text editing (2000) by btschaegg on Tuesday October 24, 2017 @02:17AM (#15539620)
Same here. Even if I'm forced to work with non-Vim tools (Visual Studio for example) using their often incomplete Vim-emulations makes lightyears of a difference.

If I had to "criticize" one of Vim's concepts, it would be its way of overriding registers in very unintuitive situations, but I'm certain I'll get used to that, too. When you're aware of it, it's simple to avoid using "_ first.

Edit: OTOH, selecting a piece of text and replacing it with p is quite irritating: The 0 register will still contain its original data, but " will contain the replaced text. I am not aware of how to disable this effect ("_p will paste from the black hole register, which doesn't help in this case).

Re:Seven habits of effective text editing (2000) by matthewaveryusa on Monday October 23, 2017 @10:25AM (#15533356)
put a marker at the begining of what you want to cut (mb) b is an arbitrary character but I use b becaues b = begin. find the end of the block with search, or jkl; or whatever. mark the end of the block (me) e is for end. now type `b, that will bring you back to the start. type v, that puts you in visual mode. type `e, that selects your text from begin to end. x to cut it.

so all in all it's mb<search>me`bv`ex

now if your say you can search your text faster with your mouse than with keystrokes you have a different problem: you don't know how to use the search features in vim efficiently.*

I think it's nearly impossible to be faster with a mouse than a keyboard when it comes to search.

*and yes, to be efficient at it there's a 2 month learning curve that pays dividends over the next 30 years of your programming career -- it's up to you if you think it's worth the investment or not. Use it or lose it, if you don't make an effort you'll stay at your local maximum.

Re:Seven habits of effective text editing (2000) by jonahx on Monday October 23, 2017 @10:31AM (#15533406)
> so all in all it's mb<search>me`bv`ex

why not just?

    v<search>x
Re:Seven habits of effective text editing (2000) by matthewaveryusa on Monday October 23, 2017 @10:55AM (#15533614)
Just another suggestion. sometimes visual mode is overwhelming, or you don't want to be in it while your search for the end of the selection without being sure where it is. Another thing is if you start with line visual mode (V), and then you end up not wanting line selection the markers help you out -- it's a finer-grained set of commands that's a bit more flexible and a bit less efficient.
Re:Seven habits of effective text editing (2000) by mbag on Monday October 23, 2017 @09:58AM (#15533172)
Or switch to Visual Line mode (<shift>+v) to select desired lines and you don't need to count how many lines to delete/yank.

Another useful visual mode is Visual Block (<ctrl>+v), for deleting/yanking, replacing block across multiple lines.

Re:Seven habits of effective text editing (2000) by tgb on Monday October 23, 2017 @10:03AM (#15533210)
That's exactly what jimmaswell suggested he didn't like, though.
Re:Seven habits of effective text editing (2000) by mbag on Monday October 23, 2017 @10:51AM (#15533568)
I see, I thought he had problem with counting line numbers to delete :)
Re:Seven habits of effective text editing (2000) by rco8786 on Monday October 23, 2017 @09:51AM (#15533133)
It’s still just a few keystrokes.. 10dd 5j p. Take 10 lines, move down 5 lines, paste those 10 lines. With relative line numbers in the gutter there’s no counting involved either. The whole thing is faster than even just reaching for the mouse.
Re:Seven habits of effective text editing (2000) by throwawayReply on Monday October 23, 2017 @10:31AM (#15533402)
But cursors don't imply mice.

With cursors you just hold shift and use down-arrows to (visually) select the lines you want. Add in Ctrl and you can move word-boundaries, add home-end and you can do beginning/end lines / pages too.

The whole thing is still quicker than vi but with the added benefits of getting much more visual feedback on what is happening and the ability to use the mouse to also quickly select things.

Re:Seven habits of effective text editing (2000) by smelterdemon on Monday October 23, 2017 @12:59PM (#15534674)
Sounds like Visual mode
Re:Seven habits of effective text editing (2000) by makapuf on Monday October 23, 2017 @10:51AM (#15533567)
Add to that by example sublime text Ctrl shift up to move the selection up one line. Really hope other editors would just take sublime key mappings
Re:Seven habits of effective text editing (2000) by aenda on Tuesday October 24, 2017 @12:17AM (#15539172)
selecting something and hitting dP (potentially kdP) will do the same thing in vim
Re:Seven habits of effective text editing (2000) by throwawayReply on Tuesday October 24, 2017 @04:53AM (#15540170)
In sublime text you don't need to select anything, ctrl+up/down will move the whole current line up/down.
Re:Seven habits of effective text editing (2000) by criddell on Monday October 23, 2017 @10:03AM (#15533204)
How far away is your mouse?
Re:Seven habits of effective text editing (2000) by jonahx on Monday October 23, 2017 @10:23AM (#15533346)
As close as you like. Mouse movements are much more finicky than keyboard ones -- they require a physical precision (seeking, alignment, selection) that keyboard movements don't. And if you never leave the keyboard, you don't have to return to the keyboard to continue your typing. I'm confident even a moderately skilled touch typist familiar with vim would outperform someone switching to the mouse on average for these kinds of tasks.
Re:Seven habits of effective text editing (2000) by geofft on Monday October 23, 2017 @10:32AM (#15533413)
I would be very interested to a) see this claim tested b) see if it makes a difference in productivity. (Most of what makes me slow at work is trying to understand technical problems, not trying to find parts of text in my editor.)
Re:Seven habits of effective text editing (2000) by shadowfiend on Monday October 23, 2017 @12:21PM (#15534335)
While not a direct test, there's prior research into the fact that folks who use keyboard shortcuts think they're faster than their mousing counterparts---and are wrong:

http://www.asktog.com/TOI/toi06KeyboardVMouse1.html

> We’ve done a cool $50 million of R & D on the Apple Human Interface. We discovered, among other things, two pertinent facts:

> - Test subjects consistently report that keyboarding is faster than mousing.

> - The stopwatch consistently proves mousing is faster than keyboarding.

(PS and caveat emptor: it's now 30 years since that study was done. Also, I personally firmly enjoy my vim. I just try to stick to liking it because I like it, not because it makes me an uberuser. An uberuser will probably be an uberuser no matter what.)

Re:Seven habits of effective text editing (2000) by vthriller on Monday October 23, 2017 @06:16PM (#15537392)
Ugh, I don't know, a lot of things could skew that result, from font/button sizes (it's hard to miss if you could only fit 5 lines of text on your screen) to insane shortcuts to memorize (I mean c'mon, ⌘-⇧-4 to take a screenshot? There's a line or two about that at the link, but it's presented like inferior and ambiguous combinations are the only one that UI/UX folks can come up with) to ergonomics of the input devices themselves (some cannot stand chiclet keyboards, some can be really productive with trackpoints—sure, this doesn't sound anything like pre-1989 Apple but you get the idea) to even cursor speed/acceleration curve settings. That being said, I'd like to see some details on that R&D.
Re:Seven habits of effective text editing (2000) by e12e on Monday October 23, 2017 @03:41PM (#15536303)
I still think this might hold true. But for me mouse (and touchpads, trackpoints) trigger repetitive stress syndrome - so acme isn't really an alternative - yet.

But I have some hope for merging the ideas of acme with proper touch screens/digitizers.

Re:Seven habits of effective text editing (2000) by tincholio on Tuesday October 24, 2017 @10:27AM (#15541772)
Also, the poor experimental design and lack of peer review about casts some doubt, really.
Re:Seven habits of effective text editing (2000) by jonahx on Monday October 23, 2017 @10:59AM (#15533637)
> I would be very interested to a) see this claim tested

I would too. But I'd be willing to wager on the results beforehand.

> b) see if it makes a difference in productivity. (Most of what makes me slow at work is trying to understand technical problems, not trying to find parts of text in my editor.)

There's no doubt that things like understanding technical problems, avoiding procrastination, and many non-technical factors are the high-order bits of productivity.

That said, the context of this conversation is text-editor optimization. Also, I think the true benefit of an optimized text editor isn't in raw time savings but in increased flow and just the joy of having a tool that feels like the extension of your mind, rather than something your mind works around.

Re:Seven habits of effective text editing (2000) by btschaegg on Tuesday October 24, 2017 @03:41AM (#15539889)
> Also, I think the true benefit of an optimized text editor isn't in raw time savings but in increased flow and just the joy of having a tool that feels like the extension of your mind, rather than something your mind works around.

My thoughts exactly (although mine might not have been worded that well :) ).

Vim-bindings are like a REPL, but on a different level. If you compare a REPL to a loop of "save, compile, run, enter passwords, wait for a specific event to trigger", you might get a grasp of what a Vim-enthusiast gets out of the editor. They've fixed the thing to fix and moved on while you're still trying to find out where your mouse movement went.

That might sound a bit exaggerated, but for the skeptics, I propose an experiment: Switch your keyboard to a different language (say Turkish, if you're very brave) and try to code for a couple of minutes. I do that regularly (my colleagues don't use the same layout as me), and I'd wager it's about the same level of annoyance as not being able to use Vim-bindings if you're used to them.

I'm not saying that there aren't other effective ways of editing text, I'm merely finding that the defaults aren't very good.

Re:Seven habits of effective text editing (2000) by criddell on Monday October 23, 2017 @11:25AM (#15533844)
> Also, I think the true benefit of an optimized text editor isn't in raw time savings but in increased flow and just the joy of having a tool that feels like the extension of your mind, rather than something your mind works around.

I couldn't agree more. For me, that's working with a Logitech Anywhere MX mouse in Sublime Text. I imagine how I want the text on screen to be transformed and it just happens without conscious thought.

Re:Seven habits of effective text editing (2000) by zastavka on Monday October 23, 2017 @02:08PM (#15535440)
Anything special about that particular mouse that makes it good for editing with ST?
Re:Seven habits of effective text editing (2000) by criddell on Monday October 23, 2017 @02:16PM (#15535508)
No. It's just the mouse I've been using for a long time now. It's small, I'm used to how it tracks and accelerates, it fits my hand, and you can disengage the click mechanism on the scroll wheel to spin it freely.

My big complaint is that the buttons eventually start to fail. Single clicks will sometimes register as double clicks and click-drag operations start to drop early.

Re:Seven habits of effective text editing (2000) by Spooky23 on Monday October 23, 2017 @04:06PM (#15536513)
It depends on how much you do the activity.

When I was a DBA, I did all sorts of data normalization stuff, and the Unix pipeline of tools (vim, sed, awk, some perl) was necessary and I was adept at it. Today, I don't do it that often, and it's quicker to just use Excel or whatever for slicing and dicing. It's not worth the overhead to save 10 minutes of manual tasking.

You'd see this when you did green screen to web transformations in enterprise projects. Training would 1/10 the effort, and knowledge based processes would be faster, but the new people would be alot slower than the veteran keyboard operators.

Re:Seven habits of effective text editing (2000) by criddell on Monday October 23, 2017 @10:55AM (#15533611)
> Most of what makes me slow at work is trying to understand technical problems

That's me too. I spend a lot of time each day reading and that's a lot of scrolling with my mouse and ctrl-clicking on works to jump to definitions or declarations. Text editing speed is definitely not a bottleneck for me.

Re:Seven habits of effective text editing (2000) by chucky_z on Monday October 23, 2017 @12:38PM (#15534489)
Have you tried a trackball mouse? That was the magic 'ah-ha' moment for me. I haven't used a normal mouse (at work) in probably 6 years or so. I find in speed it is trackball + kb > kb-only > normal mouse + kb.
Re:Seven habits of effective text editing (2000) by adrianN on Monday October 23, 2017 @09:53AM (#15533145)
I'm not super good with movements myself, so I just use visual mode and the movements I know to select what I want. It doesn't take me longer than reaching for the mouse and moving it around most of the time.
Re:Seven habits of effective text editing (2000) by auggierose on Monday October 23, 2017 @06:37PM (#15537519)
What if your block isn't denoted by curly braces but just indentation?
Re:Seven habits of effective text editing (2000) by et1337 on Monday October 23, 2017 @09:05AM (#15532858)
I feel the exact opposite. Reaching for the mouse and aiming the cursor takes forever. I almost never use number prefixes like "10d" for the same reason you dislike them. There are so many other options. } to skip to the bottom of the paragraph, % to skip to the end of the block, H/M/L to target a position on screen, / or * to navigate by searching, Ctrl-D to scroll down half a screen...

Also try VsVim for vim key bindings inside Visual Studio. Or Sublime with vim bindings on instead of notepad++. :)

Re:Seven habits of effective text editing (2000) by Rainymood on Monday October 23, 2017 @09:06AM (#15532863)
>I've used vim quite a bit

>pgup/pgdn and arrow key

Then you should start learning how to use Vim, properly ;).

Start from the basics, work your way up. From your post it is painfully obvious that you don't really use Vim to it's fullest potential. Vim requires a completely different way of thinking than regular text editors, and, it requires time to learn.

Only use up down with kj for fine movements. Large movements happen with gg, G, preset marks, and <C-d> and <C-u> which are half screens down and up for me respectively. That covers vertical movement. Most of my horizontal movement is done with either f or vim-seek (which is like f but takes 2 characters!)

Re:Seven habits of effective text editing (2000) by sevensor on Monday October 23, 2017 @09:16AM (#15532924)
Also very useful is setting "number" and using :123 to jump to line 123. This helps the most with compiler errors, but it can also help if you've got a lot of lines on the screen.
Re:Seven habits of effective text editing (2000) by nothrabannosir on Monday October 23, 2017 @11:22AM (#15533812)
123G (saves you one “return”, which is an annoying key.)
Re:Seven habits of effective text editing (2000) by mythrwy on Monday October 23, 2017 @07:49PM (#15537950)
123gg saves a shift :)
Re:Seven habits of effective text editing (2000) by sevensor on Monday October 23, 2017 @09:10AM (#15532886)
I think, because you're used to it, you're under-estimating the cognitive overhead of using the mouse. It also sounds like you've bought into some of the worst kind of vim evangelism, the kind that says effective vim users never hit j repeatedly to move between lines. Granted, it's not the best, but if you're moving only ten lines, V followed by repeated j takes basically no thought to create the selection. If it really bothers you, v followed by / will extend a selection to the match. I find that I mostly use / and ? to move around. In that context, setting hlsearch and incsearch might be helpful.

You might also want to use code folding, especially if moving blocks of code around is something you do a lot of. If you delete a fold in vim, the whole fold goes into the paste buffer.

Re:Seven habits of effective text editing (2000) by mercer on Monday October 23, 2017 @09:17AM (#15532933)
What's the cognitive overhead? I'm a huge vim weenie and a pretty fast typist, but I'd never argue that the mouse is obsolete when compared to vim.

For example, I've played FPS games where I had to target something the size of < 10 pixels, in less than a second, and the need to move my mouse from one end of the mouse pad to the other. Basically, the mouse and (in most cases) cursor are barely separate from my body when it comes to pointing at things on the screen.

So when I need to put the cursor somewhere, I still find that using the mouse can be much faster than any vim key combination.

While I do agree that the 'context switch' from keyboard to mouse matters, I still find using a mouse/trackpad worth the relative effort often enough that 'pure' keyboard vim is a degradation in experience.

Re:Seven habits of effective text editing (2000) by sevensor on Monday October 23, 2017 @09:38AM (#15533054)
I don't think the mouse is obsolete, just that it's an obstruction when it comes to editing text. Vim, emacs, and my current favorite, kakoune, all give you a rich language for talking to the computer about how you want your text to be arranged. The mouse doesn't speak that language. It requires you to switch from thinking about text as text to thinking about it as a pixel target. That may only feel natural if you play a lot of FPS games.
Re:Seven habits of effective text editing (2000) by mercer on Monday October 23, 2017 @09:54AM (#15533150)
While I do agree that when it comes to editing Vim/emacs/kaoune might be superior, I spend a nontrivial amount of my coding time in 'discovery' mode. scrolling, clicking around, and mouse stuff in general is very useful in that case, and in my experience definitely faster than keyboard-only.

I could try and make a nuanced argument of when and where a mouse is preferable to a keyboard, but I think even just scrolling is enough of an argument for me. CTRL-D or whatnot just doesn't do justice to scrolling with a mouse.

Anyways, mostly I'm a fan of Vim and using its approach as much as possible. I just get annoyed when Vim-fans try to argue that a mouse is never better, which honestly I feel is a the argument of a fanatic. I've never come across a remotely good argument as to why a mouse is never the answer, and it always feels like a needlessly 'partisan' type thing.

Keyboards are cool. Mice are cool. Can we all just get along?

EDIT: I got a bit carried away and I do agree more with you than this comment might suggest. I just think 'editing' is not the only thing I do when coding, and for some of that other stuff a mouse is a huge advantage, even in a coding context.

Re:Seven habits of effective text editing (2000) by jstimpfle on Monday October 23, 2017 @02:43PM (#15535771)
Re: scrolling, in vim you have CTRL-E and CTRL-Y and there must be a way to adjust the scroll step (usually 1) to the scroll step of your mouse wheel (usually like 3) is bound. Can a mouse do 30 scrollings per second (my keyboard input rate)?

Where the scroll wheel makes a difference is when you want to fine tune the scrolling speed, which you can't do with a keyboard. I don't think I have a usecase for that (but YMMV), and my impression is it often gets me out of text mode and into FPS mode.

What would be really nice for larger scroll steps (like CTRL-D) is smooth scrolling. I suppose there is no terminal support for this? Also gvim doesn't seem to have it.

Anyway I usually don't scroll by fixed amounts, but do * (identifier search), / (regex search), { and }, and maybe more.

EDIT: just added this to my vimrc. I don't think my mouse scrolling ever was this good

   " Triple scrolling "speed"
   nnoremap <C-e> 3<C-e>
   nnoremap <C-y> 3<C-y>
Re:Seven habits of effective text editing (2000) by fao_ on Monday October 30, 2017 @09:35AM (#15584865)
you also have ^f ^b (forward, back (by a page)), and ^u ^d (up, down (by half a page)). I honestly prefer scrolling by paragraph though ({ })
Re:Seven habits of effective text editing (2000) by gjjrfcbugxbhf on Monday October 23, 2017 @11:56AM (#15534116)
> Keyboards are cool. Mice are cool. Can we all just get along?

Agreed.

I'm a vim fanboy - and I use the mouse.

Re:Seven habits of effective text editing (2000) by sevensor on Monday October 23, 2017 @10:22AM (#15533334)
> I do agree more with you than this comment might suggest

Well spoken, that goes for me too. Something about internet discussions amplifies disagreement!

Re:Seven habits of effective text editing (2000) by kej on Monday October 23, 2017 @01:41PM (#15535138)
>Vim/emacs/kaoune might be superior

My google-fu is failing me; what is kaoune?

Re:Seven habits of effective text editing (2000) by Pete_D on Monday October 23, 2017 @02:05PM (#15535404)
Parent probably meant Kakoune: http://kakoune.org
Re:Seven habits of effective text editing (2000) by sevensor on Monday October 23, 2017 @02:12PM (#15535472)
Indeed I did. Kak is great, especially if you find yourself often using visual mode in vim.
Re:Seven habits of effective text editing (2000) by oblio on Monday October 23, 2017 @10:39AM (#15533474)
> That may only feel natural if you play a lot of FPS games.

Or almost any kind of PC games. There is learning curve to using a mouse, but it is quite short and once you're over the hump you can use the mouse without thinking about it. The cognitive overhead of the mouse is minimal. There are studies about this: http://www.asktog.com/TOI/toi22KeyboardVMouse2.html

Re:Seven habits of effective text editing (2000) by dredmorbius on Monday October 23, 2017 @09:36AM (#15533047)
Reaquiring the cursor is an issue for me on systems that "helpfully" make vim mouse (or touchscreen) sensitive.

The cursor's where I left it, damnit. Don't move it and force me to put it back.

There are times when directly pointing to screen elements is useful. Working with text I almost always find it gets in the way

Re:Seven habits of effective text editing (2000) by pmoriarty on Monday October 23, 2017 @12:57PM (#15534654)
"I've played FPS games where I had to target something the size of < 10 pixels, in less than a second, and the need to move my mouse from one end of the mouse pad to the other."

Do you type with just one hand? Because that's what you'd need to do to replicate that performance while coding.

If you type with both hands, now you have to add in the time it takes you to move one hand from the keyboard to the mouse, make the mouse motion (which could be far across the screen) and then back to the keyboard, repeating that cycle for every single operation which involves the mouse.

Meanwhile, someone who knows vim well and is not reliant on the mouse can type with both hands and only has to move their fingers.

Re:Seven habits of effective text editing (2000) by foldr on Monday October 23, 2017 @01:54PM (#15535301)
I have my mouse right next to my keyboard (don't most people?). I can grab it about as quickly a I can press a key.
Re:Seven habits of effective text editing (2000) by pmoriarty on Monday October 23, 2017 @02:06PM (#15535413)
Even if that's true (which is doubtful, as the motion to press a key is much shorter than to move one's arm all the way off a keyboard to the mouse), then you still have the additional time it takes to move the mouse to where it needs to go, and then the time it takes to move your arm back to the keyboard.

There's no way that's going to be as fast. It's also going to be a lot more tiring, if you do that a lot, than merely moving your fingers.

Re:Seven habits of effective text editing (2000) by foldr on Monday October 23, 2017 @02:51PM (#15535868)
Sure, but you usually have to press a bunch of keys in just the right sequence to do the equivalent with the keyboard.

Some things are quicker to do with the mouse and some things are quicker to do using keyboard shortcuts. I don't understand why people take such absolutist positions on this.

My arm doesn't get tired from moving a few inches to grab the mouse.

Re:Seven habits of effective text editing (2000) by pmoriarty on Monday October 23, 2017 @03:10PM (#15536040)
"you usually have to press a bunch of keys in just the right sequence to do the equivalent with the keyboard"

Compared to a veteran vim/emacs user, you'd to do a whole ton of mouse movements to get the same effect of a few keystrokes.

"Some things are quicker to do with the mouse and some things are quicker to do using keyboard shortcuts."

The only things I've found to be quicker to do with the mouse are doing things like drawing in Photoshop/GIMP/Inkscape, or interacting with GUI applications which don't have keyboard shortcuts for most of their functions. Text editing and coding, on the other hand, tends to be much faster, sometimes exponentially faster, than the mouse.

Re:Seven habits of effective text editing (2000) by foldr on Tuesday October 24, 2017 @11:18AM (#15542190)
>Compared to a veteran vim/emacs user, you'd to do a whole ton of mouse movements to get the same effect of a few keystrokes.

Depends on what you're doing. Again with the absolutism!

Re:Seven habits of effective text editing (2000) by jstimpfle on Monday October 23, 2017 @02:23PM (#15535567)
This can not be overstated. I haven't seen many GUI type programmers programming in my live, but none of them was faster than "slow". I die of impatience when I watch them edit.
Re:Seven habits of effective text editing (2000) by Someone on Monday October 23, 2017 @10:54AM (#15533602)
Tog (probably in “Tog on interface”) claims people overestimate the cognitive overhead of the mouse because it is so simple to use, and cites research showing it (including such examples as having to move the mouse over a large screen and back to access a menu item, compared to a keyboard command)

Using the mouse, he claims, is so boring that your mind has time to spend on other things, and that gets perceived as wasting time, while the keyboard continually requires one’s attention, making using the keyboard seem instantaneous

I think that’s why your advice to use repeated j instead of lower keystroke count alternatives is good.

And yes, his research is old (early 1980s) but it wouldn’t surprise me if it held even with die hard vim or meads users. Those keys you press may be close by, but you have to choose between tens of commands every time you issue an editing command.

Re:Seven habits of effective text editing (2000) by tincholio on Monday October 23, 2017 @11:17AM (#15533782)
I've read some of his stuff on this issue, and noticed his experiment design was atrocious, and he has 0 peer-reviewed research. So, I'm taking anything he says with a grain of salt. (I've been doing user research for over 15 years, in a different context, but still I've read tons of HCI/UX work, so I'm not just talking out of my ass here)
Re:Seven habits of effective text editing (2000) by sevensor on Monday October 23, 2017 @11:49AM (#15534037)
By and large, I think vim evangelism is deeply misguided, in that it asks you to learn too many things, it sees golfing your edits down to minimal keystrokes as something other than a total waste of mental energy, it encourages heavy plugin use, and it turns the vimrc into a whole program of its own. The whole point of using an editor like vim is that you don't have to think about it very much. Which is why I encourage using the basic movement and editing keys with reckless abandon. The only thing that justifies learning a new feature is that the simple way is deeply inefficient. Not just less efficient, but so terrible that it's wearing out your fingertips and leaving you annoyed. Global search and replace with regular expressions is a good example. Sooner or later, hitting the letter n and the period key over and over to repeat a replacement is going to get so tiresome that it's worth learning regex, but a novice user can go a long while before doing that and still be quite productive.
Re:Seven habits of effective text editing (2000) by jstimpfle on Monday October 23, 2017 @02:07PM (#15535425)
I put this in my ~/.xsession

    # keyboard autorepeat delay / rate
    xset r rate 170 30
It's tuned to my personal typing to be just slow enough that I never have accidental ddoublette kkeypresses, but fast enough that I can just hold down 'j' or 'k' in vim to move 10 or 15 lines (and easily hit the target). Using the mouse cannot even come close here (assuming you don't have your hand on it already). 15 lines would be 620ms here technically, so including the human factors it's still comfortably below a second. Really it makes a huge difference. (I saw this first in a talk by Edward Kmett).
Re:Seven habits of effective text editing (2000) by brandonmenc on Monday October 23, 2017 @10:25PM (#15538748)
> you're under-estimating the cognitive overhead of using the mouse

What "cognitive overhead?" And how is memorizing a bunch of arcane key combinations for cursor movement and region selection not cognitive overhead?

The (imo, dubious) argument against the mouse has always been that there's a strictly mechanical penalty for moving your hands around - not that there's "cognitive overhead."

Re:Seven habits of effective text editing (2000) by sevensor on Tuesday October 24, 2017 @10:52AM (#15541979)
> What "cognitive overhead?"

Let's break down the cognitive overhead of mouse use. Setting aside the "reaching for the mouse" penalty, there's a lot of work involved in mouse-related tasks like copying a selection:

1. Move your eyes off of the text you're editing so you can find the mouse cursor.

2. Figure out where the mouse cursor is relative to the text you need to edit.

3. Effect that relative movement with your mouse.

4. Highlight the text for copying.

5. ^C or some other key combo to yank the selection.

6. Reorient the mousing hand to the keyboard (find the home row keys again).

Steps 4 and 5 take an equivalent amount of mental effort, but 1-3 and 6 don't exist in vim. That's the cognitive overhead I'm talking about.

> And how is memorizing a bunch of arcane key combinations for cursor movement and region selection not cognitive overhead?

Visual selection is the letter v in vim. There are four keys for basic cursor movement. Then y for yank, d for cut, p for paste. Vim only seems arcane because so many posts about vim are really about demonstrating how smart the author is. I get pretty exercised about this because it's chasing people away who could really benefit from learning vim. Vim is not arcane, vim has a dead simple core with a bunch of entirely optional features on top of it.

Re:Seven habits of effective text editing (2000) by brandonmenc on Tuesday October 24, 2017 @01:42PM (#15543479)
> 1. Move your eyes off of the text you're editing so you can find the mouse cursor.

Try this: keep your eyes fixed on a character, then wiggle the mouse or trackpad. I don't think I ever actively look for the pointer before using the mouse, and I doubt anyone else does either.

I'm guessing that if you can track the mouse pointer without taking your eyes off the text you're editing, most of your listed steps become non-factors.

Re:Seven habits of effective text editing (2000) by Moogs on Monday October 23, 2017 @09:06AM (#15532864)
Vim does have support for mouse usage (depending on the terminal)[0]. You can add the following to your config:

set mouse=a

At that point you can quickly select text, hit "d" to cut it, click where you want it and hit p

[0] http://vimdoc.sourceforge.net/htmldoc/options.html#%27mouse%...

Re:Seven habits of effective text editing (2000) by jimmaswell on Monday October 23, 2017 @10:09AM (#15533254)
I knew about this but I assumed it couldn't be done through ssh/putty.
Re:Seven habits of effective text editing (2000) by kazinator on Monday October 23, 2017 @03:21PM (#15536147)
What cannot be used through SSH/PuTTY is the IDE that you're comparing text-only Vim to.
Re:Seven habits of effective text editing (2000) by jimmaswell on Monday October 23, 2017 @09:52PM (#15538622)
One that runs on X can be tunneled.
Re:Seven habits of effective text editing (2000) by jstimpfle on Monday October 23, 2017 @01:59PM (#15535346)
It works independently of transmission method since the mouse clicks are simply translated into "keyboard presses", i.e. encoded to stdin as escape sequences. It's a single stream.

Of course, the terminal emulator must play nice with the windowing environment and translate mouse events correctly.

Re:Seven habits of effective text editing (2000) by geofft on Monday October 23, 2017 @10:33AM (#15533422)
It works through PuTTY, and moreover it's the default config in Debian 9, which I find sort of annoying because I'm used to using the mouse in PuTTY for copy/paste. But it does work smoothly (including through a screen session and through ssh to other machines).
Re:Seven habits of effective text editing (2000) by shangxiao on Monday October 23, 2017 @10:48AM (#15533541)
Perhaps you should add an [edit] to your original post seeing as it's nabbed top spot and spawning several threads about lack of cursor support?
Re:Seven habits of effective text editing (2000) by exDM69 on Monday October 23, 2017 @10:20AM (#15533327)
Not sure about putty but it definitely works over SSH depending on your terminal emulator.
Re:Seven habits of effective text editing (2000) by shadowfiend on Monday October 23, 2017 @12:14PM (#15534281)
I'd say two things here:

- Recent vim in terminal (and vim in a GUI container like gvim or MacVim) supports mouse interactions. For example, in macOS's Terminal.app, View -> Allow Mouse Reporting will send mouse events to vim, which will allow you to scroll with your touch pad, select with your mouse, etc.

- I think there is definitely a curve to learning many of the movement commands that vim provides to become fully efficient at moving, say, a block of code. When moving blocks of code, I most frequently use % (which jumps to the matching brace/bracket/paren) or } (which jumps to the next blank line).

I agree that it sometimes feels like there's an analysis step in vim interactions that can feel like it's slowing things down rather than speeding them up. In my experience, much of that calms down after you've been doing it a while. But, that doesn't mean it's worth the investment---I think that depends on the person.

I seem to editor-hop every 2-4 years. I generally end up coming back to vim for long stretches, but I've used plenty of other stuff in the past. I think if you feel productive, that's the tool to use. If you feel curious, or whatever, I think it's worth exploring. Vim is peculiar because its interaction mode is so different that it's hard to feel fully at home with it without going all in for an extended period of time and dedicating yourself to learning some of the stuff that's not necessarily immediately apparent. If you do that, sometimes you find it really clicks with you. Sometimes you don't :)

Re:Seven habits of effective text editing (2000) by dozzie on Monday October 23, 2017 @01:09PM (#15534757)
> - Recent vim in terminal (and vim in a GUI container like gvim or MacVim) supports mouse interactions.

...if by "recent" you mean a decade old version.

Re:Seven habits of effective text editing (2000) by mrzool on Monday October 23, 2017 @12:53PM (#15534616)
> Moving a block of code below another block of code takes 1 second in notepad++ while in vim you have to go V 10d x 13down P or something along those lines

Your problem with Vim is that you don't grok vi:

https://stackoverflow.com/a/1220118/3078265

Re:Seven habits of effective text editing (2000) by bananicorn on Monday October 23, 2017 @09:05AM (#15532859)
There's a bunch of things you could try, btw: First off, vim has a GUI version where you can use the mouse (and in some terminal emulators you can too - for example st[0])

Secondly, did you try using splits (horizontal and vertical is possible, you practically have a sort of WM inside vim) or maybe you prefer the tabs-approach to things (even though the purpose of tabs is a different one, but you can bend it to your will so it works kinda like in notepad++)

Also, relative line numbers really help me with the vertical navigation - you practically have the number you need to type at the start of the line (and your current line can have the actual line number, if :set nu is active)

[0]https://st.suckless.org/

Re:Seven habits of effective text editing (2000) by stanmancan on Monday October 23, 2017 @10:24AM (#15533354)
The whole argument of “wasting time” reaching for the mouse has never made sense to me. In a decade of programming its never been a bottleneck for me.

Maybe I’m an outlier here but the whole thinking, planning, and experimenting takes way longer than my hands can move.

Re:Seven habits of effective text editing (2000) by bradford on Monday October 23, 2017 @01:30PM (#15534999)
For me it's not about wasting time, it's that frequently switching between mouse and keyboard is a repetitive stress injury waiting to happen. The accumulated damage that can occur after doing it everyday for a few years really creeps up on you.
Re:Seven habits of effective text editing (2000) by joshribakoff on Monday October 23, 2017 @03:36PM (#15536276)
I concur. If you already have RSI like me (thank you Blizzard games), reaching for the mouse is literally a pain point already.
Re:Seven habits of effective text editing (2000) by oblio on Monday October 23, 2017 @10:34AM (#15533431)
You're not an outlier... The only time when editing takes longer than thinking is when you're processing textual data dump files in their various shapes and forms (logs, database dumps as SQL, etc.). For code thinking definitely takes longer than actually editing :)
Re:Seven habits of effective text editing (2000) by jeromenerf on Monday October 23, 2017 @12:54PM (#15534623)
I think it depends on the task at hand, whether you are jumping around or focused on a long piece; exploring or debugging ...

Anyway, not everything takes place in the editor.

"The acme user interface for programmers" (http://acme.cat-v.org/) is a good inspiration. It focuses on mouse usage and shows how most systems are as nicely integrated as they could be.

I have hacked together a setup that mimicks acme using a tiling wm, vim (and its amazing remote features), a plumber and a terminal that can send the current selection to the plumber. This way I use vim as I like but I can send it some path:line:col from anywhere with a right click.

Re:Seven habits of effective text editing (2000) by somezero on Tuesday October 24, 2017 @02:00AM (#15539558)
Could you explain more about integrating acme ideas into a tiling wm, or possibly share your dotfiles? I've tried doing that with i3, but the window manager has less than optimal mouse support to say the least, and wmii is dead.
Re:Seven habits of effective text editing (2000) by jeromenerf on Tuesday October 24, 2017 @04:01PM (#15544775)
See https://st.suckless.org/patches/right_click_to_plumb/

The setup requires:

- a terminal that is aware of its shell current working directory (OSC7) (I use st or tmux and zsh)

- a terminal that would call a plumbing command with the current selection on a mouse right click (I use st or tmux)

- a plumbing command that would call the appropriate action given the selection string passed in (I use a script and plan9 plumber)

- an editor that supports being called from the plumbing script (I use acme or vim remote with vim-fetch plugin)

- an eventual tiling wm or tmux for window management

My dotfiles aren't public but I guess I could try and package them if you're interested. PM me at the email on the suckless page.

Re:Seven habits of effective text editing (2000) by swiley on Monday October 23, 2017 @10:44AM (#15533511)
It's not about wasting time, pointing devices are less precise which means they demand more attention and are less flexible.
Re:Seven habits of effective text editing (2000) by metaobject on Monday October 23, 2017 @03:11PM (#15536050)
Going with your theory, I'd say that pointing devices are more precise which means they require more brain-CPU cycles to operate ... pixel-space is large and you must position it within some delta of the target widget you're trying to use.

Whereas in emacs, say, it's a quick "C-x o" to change to the next/other buffer.

Re:Seven habits of effective text editing (2000) by swiley on Tuesday October 24, 2017 @02:51PM (#15544193)
Right, they're more precise and less accurate.
Re:Seven habits of effective text editing (2000) by gumby on Monday October 23, 2017 @02:16PM (#15535509)
> ...it still never beat GUI editors for me. The lack of a mouse cursor was always a pain point - for example simple copy/pastes take notably longer.

Everybody's milage can vary; in my case it's 100% the opposite. Moving my hands off the keyboard is a demonstrable microinterruption.

FWIW I've been using both text and mouse-based editors since I was 14, roughly 40 years. Some of the time was in deeply mouse-oriented environments (e.g. Xerox PARC in the era when Stu Card was proving that the mouse is indeed a better input approach for a plurality of people -- so I'm not claiming that the mouse is a bad idea in principle). But the keyboard is just so much more direct for me -- I don't have to look at it, and often don't move my eye from the insertion point on the screen even when referring to something elsewhere on the screen.

Re:Seven habits of effective text editing (2000) by delta1 on Monday October 23, 2017 @09:03AM (#15532844)
In {G|Mac}Vim you can also use the mouse cursor and selection.
Re:Seven habits of effective text editing (2000) by alwillis on Monday October 23, 2017 @06:06PM (#15537325)
It also sounds like you don't have relative line numbers enabled, which makes highlighting or jumping some number of lines quickly pretty trivial: https://jeffkreeftmeijer.com/vim-number/

A Vim truism: if what you're doing requires too many keystrokes or otherwise seems cumbersome, there's another way to do it that faster and requires fewer keystrokes.

It's just a matter of whether you're interested in learning and not assuming you have it all figured out.

Re:Seven habits of effective text editing (2000) by deathanatos on Monday October 23, 2017 @08:47PM (#15538281)
> while in vim you have to go V 10d x 13down P or something along those lines, figuring out exactly what numbers to use there probably takes more than 1 second alone.

Honestly, I usually just use 9j/9k[1] a bunch to get reasonably close / maybe overshoot a bit, and then adjust with j/k, using visual feedback to guide me. Much quicker than grabbing the mouse, IMO, or computing what line number to go to.

(Admittedly, I should really learn the "go to end of block/paragraph/etc. keys.)

You can also `set relativenumber`, which will change the line numbers on the side to be "relative" (that is, 2 lines down is labelled as "2"); this makes it obvious which number to hit.

[1]: (move down/up 9 lines, 9 being an arbitrary "several")

Re:Seven habits of effective text editing (2000) by Tarean on Monday October 23, 2017 @05:01PM (#15536903)
I really want to say `text objects are faster than using the mouse anyway` but it is probably worth noting that vim has mouse support, even in most terminals. It should be default in neovim. In vim it is disabled by default and the help says

    > Normally you would enable the mouse in all four modes with:   
    > :set mouse=a
so I am not entirely sure why exactly this has to be done manually.
Re:Seven habits of effective text editing (2000) by blfr on Monday October 23, 2017 @05:06PM (#15536934)
Minimap. What I'm missing in all terminal editors is this neat overview of the file I'm editing.

Everything else can be achieved with clever keyboard shortcuts, tmux, or hacking the .vimrc. It's just a matter of time and persistence.

Similarly with mutt it's attachments. It just cannot handle them as well as a graphical/web mail client. (That and I mostly read my private email on the phone nowadays.)

Re:Seven habits of effective text editing (2000) by alwillis on Monday October 23, 2017 @06:15PM (#15537388)
The mouse works fine with gVim; I use the Magic Mouse with MacVim (the Mac GUI version of gVim) for scrolling through large files sometimes.

However, I never use the mouse in visual mode to highlight blocks of text; for that I'm much faster using Vim’s keyboard commands.

Re:Seven habits of effective text editing (2000) by lanius on Monday October 23, 2017 @04:14PM (#15536577)
The individual user's keyboard and mouse proficiency determines their most efficient setup. I'm decent with Vim, but my mouse speed and accuracy is good enough to do many editing tasks with a mouse faster than I could accomplish in Vim.
Re:Seven habits of effective text editing (2000) by rwallace on Monday October 23, 2017 @11:16AM (#15533780)
How do you get moving a block of code to take one second in notepad++? I don't know of a way to get it to take less than a few seconds, but maybe I'm missing something.
Re:Seven habits of effective text editing (2000) by garou on Monday October 23, 2017 @09:18AM (#15532938)
I am not going to say "ViM is better".

Are you intended to keep using vim to edit these remote config files? May it be unnecessary, but if you want to try read this article to figure out how make these things faster using vim.

But IMHO if you are just going for it, there's no reason to learn vim.

It is a long path indeed, but wort it.

Re:Seven habits of effective text editing (2000) by jimmaswell on Monday October 23, 2017 @09:57AM (#15533167)
If I'm in an ssh shell and I want to edit a file, yes, I'll use vim. I've also done some coding in vim which is what I was mainly talking about.
[dead]
Re:Seven habits of effective text editing (2000) by jimmaswell on Monday October 23, 2017 @09:57PM (#15538642)
You're blowing this out of proportion. Read it again, I didn't discount anyone. All I said was I found one thing more efficient for myself than something else.
Re:Seven habits of effective text editing (2000) by coliveira on Monday October 23, 2017 @03:34PM (#15536257)
Vim has had support for mouse for at least 20 years.
Re:Seven habits of effective text editing (2000) by cryptonector on Monday October 23, 2017 @12:45PM (#15534549)
vim has mouse support, though I don't know anything about it since... almost the whole point of vim is to not use a mouse.
Re:Seven habits of effective text editing (2000) by swiley on Monday October 23, 2017 @10:41AM (#15533495)
vim, tmux, and ssh have gpm support.
Re:Seven habits of effective text editing (2000) by siissussjskk on Monday October 23, 2017 @08:53AM (#15532770)
Maybe learn how to grok vim?
Re:Seven habits of effective text editing (2000) by mercer on Monday October 23, 2017 @09:12AM (#15532899)
Surely you'd agree that a mouse as an interface can provide benefit even in the context of a text editor?
Re:Seven habits of effective text editing (2000) by ATsch on Monday October 23, 2017 @09:25AM (#15532988)
Sure, but the question is if the physical and mental context-switch is worth this benefit. I'd say that in editors with a sufficiently expressive keyboard interface like vim, it is not.

One thing I still find myself doing in vim is using the scroll wheel. Browsing and editing is a context switch anyway and I think scroll wheels express scrolling a lot better than keyboards ever can.

Re:Seven habits of effective text editing (2000) by mercer on Monday October 23, 2017 @09:37AM (#15533051)
Fair enough. I would definitely err on the side of vim when it comes to the benefits of staying within vim's 'mental model', because I do agree the context-switch does matter.

Furthermore, the fact that all my vim-context keypresses can be stored as a 'macro' in itself has provided enough of a productivity increase to make it all worth it. And this is even the case in less-than-perfect vim emulators.

And I do agree that for some things, scrolling and perhaps 'exploring' in general being a big one, a mouse can be worth the context switch.

Re:Seven habits of effective text editing (2000) by shangxiao on Monday October 23, 2017 @10:52AM (#15533581)
siisussjsk might've been referring to doing a quick check to see if vim supports mouse as an interface… which it does.
Re:Seven habits of effective text editing (2000) by lighthazard on Monday October 23, 2017 @09:02AM (#15532831)
How do I select Lines 3, 16, 39, 50, 230, 420, 1302, and 2300 at random columns of my needs? With a mouse, I can cntrl/cmd + click the line I am interested in, wherever I am interested, and do any manipulation I want. Can VIM do this easily? I've never tried.
Re:Seven habits of effective text editing (2000) by dredmorbius on Monday October 23, 2017 @09:13AM (#15532909)
And, in all earnestness: why are you doing that?

Is there something about those specific line numbers intrinsically? Is there a pattern or specific text on those lines? Is there a relationship to surrounding text, above or below?

The great thing about vim, or a set of similar tools (ed, ex, sed, awk, perl, cut) is that you can address the text in terms of the text itself. Search by text or regex, move within a line or between lines. Replace text or modify elements, preserving some and changing others.

Or, if I know in advance that I've got to deal with the 8 specific lines mentioned but without otherwise addressible context: 3G <edit stuff> 16G <edit stuff> ... 2300G <edit stuff>.

That's not elegant, but it's doable and fast.

Re:Seven habits of effective text editing (2000) by lighthazard on Monday October 23, 2017 @09:32AM (#15533030)
Line numbers were irrelevant, just a set of random numbers. There is no pattern to the text (say it's a set of words that needs to be edited to become the same). I guess this is more related to working with large blocks of text rather than code. Someone mentioned macros, I'm going to give that shot.
Re:Seven habits of effective text editing (2000) by dredmorbius on Monday October 23, 2017 @11:53AM (#15534084)
What's the characteristc of the text and how do you identify it?

Again, search, paragraph and sentence navigation, and word nav are intrinsic to vim, and fast. If you know what you're looking for, "/<pattern>" and you're there. With incremental search ("set ic" in your ~/.vimrc) thats often a very few keystrokes.

Re:Seven habits of effective text editing (2000) by ATsch on Monday October 23, 2017 @09:19AM (#15532947)
What are you trying to accomplish with this? If you are trying to replace multiple cursors, the approach would be very different.

What I'd do is record a macro for the edit on one line into q, and then apply it to all relevant lines with a regex, e.g. g/regex/norm @q

Re:Seven habits of effective text editing (2000) by bananicorn on Monday October 23, 2017 @09:08AM (#15532873)
Maybe you're looking for visual block mode?[0] Or the multi-cursor plugin[1]? I haven't tried the latter, ut I really like visual block mode for certain things.

It's amazing how much new stuff I learn about vim every day... And I'm nowhere near done :)

[0]https://stackoverflow.com/questions/21806168/vim-use-ctrl-q-... [1]https://github.com/terryma/vim-multiple-cursors

Re:Seven habits of effective text editing (2000) by aoloe on Monday October 23, 2017 @09:12AM (#15532900)
it depends on what you want to do... but my general reflex is:

- go to line 3

- start recording a temporary macro ("qq" in my habits)

- do the editing

- stop the macro ("q")

- go to the line 16 with 16gg and reply the macro with @q - 39gg@q

- 50gg@q

- ...

Re:Seven habits of effective text editing (2000) by bananicorn on Monday October 23, 2017 @09:16AM (#15532929)
this. Macros are something I've never used in other editors, but in vim they're simply... fun to use.

Well, if used for the right purpose.

Re:Seven habits of effective text editing (2000) by BatFastard on Monday October 23, 2017 @11:15AM (#15533773)
Wow, shall we argue over whether tabs or spaces are better too? And after we solve that we can figure out how many angels can dance on the head of a pin!
Re:Seven habits of effective text editing (2000) by metaobject on Monday October 23, 2017 @03:15PM (#15536090)
Btw, the answer is "spaces" because tabs can be interpreted differently from editor to editor.

To take it a step further, its 4-space indents. I've seen code where people pull off 2-spaces, but it gets crowded failrly quickly.

Re:Seven habits of effective text editing (2000) by albedoa on Monday October 23, 2017 @04:19PM (#15536606)
> tabs can be interpreted differently from editor to editor.

You should ask a tabs advocate what they think the primary feature of tabs is :)

Re:Seven habits of effective text editing (2000) by cup-of-tea on Monday October 23, 2017 @09:11AM (#15532892)
Both gvim and graphical emacs support mouse. But if you use it you're doing it wrong anyway. You're using your boot instead of a hammer because you couldn't figure out which end was the handle.