topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 9:56 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: The AVE  (Read 33829 times)

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
The AVE
« on: April 16, 2014, 05:56 AM »
So, you find yourself reading a discussion somewhere about text editors or IDEs, and that one guy mentions Vim. You start to think about how awesome it would be to know Vim, how all the cool kids seem to do. There's something special about a text editor that works entirely different from all other text editors. You seem to remember sometime last year where you tried to learn Vim, but you can't quite put your finger on why you didn't end up being a Vim pro.

That's right, it's time for ...

The Annual Vim Experiment ;D

It's been long enough since the last time that you've forgotten the time it took to play with .vimrc to get something that looked halfway usable. You've repressed the countless hours of fumbling around and googling just to edit a few lines of text. You can't remember the aggrevation of every single other program on your computer doing random things as you involuntarily used a Vim shortcut that was on it's way into your muscle memory. If you're using Windows, you've forgotten how half the plugins are a pain to install because they assume Ruby or Python or something else. And if you're using a non-US keyboard, you also forgot how 5% of the commands were hard or impossible to press.

All of that is far enough away in your memory that you are ready to give it another try. And who knows, maybe this time you will succeed if you get the right help -- the question is what are the best resources to get you going?

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #1 on: April 16, 2014, 10:03 AM »
I'm in :Thmbsup:

First pointer is an article right on top of the vim web site about installing gvim on Windows.

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #2 on: April 16, 2014, 04:40 PM »
Being able to install it seems like a good starting point :Thmbsup:.

I've managed to get it running, and this time around I decided to try to stop myself from trying to install a bunch of fancy plugins. I seem to remember that was part of what killed me last time -- I had to fight with learning plugins as well as Vim.

So, I've got Vim, pathogen, sensible, commentary, and of course my favorite color scheme solarized.

Hmm, guess I am not doing too well on skipping plugins am I? :-[

Here are some resources I am looking at:

Vim Tips Wiki with some links to resources
Learn Vim Progressively
The Vim Learning Curve is a Myth
Vim Adventures a game, how odd?
Vimcasts

(Btw, I might have sneaked a set guifont=Dina:h8:cANSI into my .vimrc as well :P)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #3 on: April 16, 2014, 08:02 PM »
This year marks my 20th year using vi, but I still don't know that many commands.

I keep forgetting useful ones through lack of use -- this is the sort of thing that I think "standard" GUIs can be helfpul for (i.e. rediscovery).

For emacs I made a small bit of code that presents a menu of commands I'm trying to learn (those that aren't already show via menus).

I'd be interested to see if there's something like that for vi -- as a first step I've installed gvim so that I can leverage the menus.



My .emacs contains a line specifying the Dina font -- when I set up a new machine I often get a start-up error because I haven't installed Dina yet ;)

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #4 on: April 18, 2014, 05:12 AM »
The whole buffer vs window vs tab page distinction seems a little convoluted;

Summary:
   A buffer is the in-memory text of a file.
   A window is a viewport on a buffer.
   A tab page is a collection of windows.

must be written by a programmer ;D.

By default you can't open a file, make a change and then open another file without saving the first one. That seems odd, but I am sure there is some Unix explanation for it.

Also, by default vim doesn't open another file from the same folder as the current one. If you just opened "C:\data\long\path\foo.c", and then want to open foo.h from the same folder, you need the entire path again. I know there's command history, but you get what I mean -- most other editors would start by looking in the same folder.

I think it adds a bit to the complexity of starting to use Vim that you have to fiddle with settings to get it to behave similar to what you would expect.

I should probably try vimtutor again :-[.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #5 on: April 18, 2014, 06:23 PM »
Also, by default vim doesn't open another file from the same folder as the current one. If you just opened "C:\data\long\path\foo.c", and then want to open foo.h from the same folder, you need the entire path again. I know there's command history, but you get what I mean -- most other editors would start by looking in the same folder.

I tested this in the default installation of gvim (7.4.214-1) in Manjaro Linux and didn't reproduce -- i.e. I got the behavior of not having to navigate again.  May be it has been tweaked to behave nicely?

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #6 on: April 18, 2014, 06:26 PM »
I think it adds a bit to the complexity of starting to use Vim that you have to fiddle with settings to get it to behave similar to what you would expect.

Can be a tricky issue when everyone doesn't share all expectations ;)

FWWI, I prefer syntax highlighting by default (and even expect it these days), but it doesn't seem on in vim (or gvim) by default...

:syntax on

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #7 on: April 18, 2014, 06:30 PM »
By default you can't open a file, make a change and then open another file without saving the first one. That seems odd, but I am sure there is some Unix explanation for it.

I don't know about the Unix part of it, but if you think of it as opening another file into the buffer you are working in (so you might lose changes if opening is successful), then may be it doesn't seem so odd?

FWIW, at least in gvim here if you choose "Open Tab..." (:tabnew) after making a change in the current buffer, I am not being asked to save changes.

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #8 on: April 19, 2014, 04:28 AM »
Thanks ewemoa, it's great to get some perspective from someone who has used Vim :Thmbsup:.

Also, by default vim doesn't open another file from the same folder as the current one. If you just opened "C:\data\long\path\foo.c", and then want to open foo.h from the same folder, you need the entire path again. I know there's command history, but you get what I mean -- most other editors would start by looking in the same folder.
I tested this in the default installation of gvim (7.4.214-1) in Manjaro Linux and didn't reproduce -- i.e. I got the behavior of not having to navigate again.  May be it has been tweaked to behave nicely?

I guess it might be compiled with different settings. On my default Windows install, if I open "d:\data\foo.c" and then do ":e foo.h" I get a blank new file instead of the header file from the same folder. With autochdir on it works as I expected.

By default you can't open a file, make a change and then open another file without saving the first one. That seems odd, but I am sure there is some Unix explanation for it.
I don't know about the Unix part of it, but if you think of it as opening another file into the buffer you are working in (so you might lose changes if opening is successful), then may be it doesn't seem so odd?

FWIW, at least in gvim here if you choose "Open Tab..." (:tabnew) after making a change in the current buffer, I am not being asked to save changes.

My guess is that it is a remnant from when computers had so little memory you had to unload one file to open another. It looks like :e file will unload the current buffer, unless hidden is on. Perhaps I should be using tabs instead of buffers, I will have to look into that.

Another thing that took me a bit by surprise is that the copy/pasting to/from other programs doesn't work as usual. I had to google to figure out you have to use a special register "* to access the clipboard.

I feel I can get basic editing done now, with a few attempts to do some things. I am still a little surprised sometimes at exactly where visual mode selections end, and often when I paste, it ends up on the wrong side of where I thought it would :-[. So it takes somewhat longer than with ST, but I guess that's a question of getting used enough to it to use more commands.

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,017
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #9 on: April 19, 2014, 05:31 AM »
Devil.png
alias vim='nano'

Seriously, I've done the AVE about 6 times now, every one of them ending up like this:
<Aoi-chan> everyone's first vi session. ^C^C^X^X^X^XquitqQ!qdammit[esc]qwertyuiopasdfghjkl;:xwhat

I have now acquired the seventh edition of "Learning the vi and Vim Editors" from O'Reilly.  Haven't read much of it, because nano does me just fine most of the time ;)

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,017
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #10 on: April 19, 2014, 06:08 AM »

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #11 on: April 19, 2014, 02:09 PM »
Thanks for the links Edvard :Thmbsup:.

I've seen the explanation of the hjkl keys before, I can see how Esc and [ ] are easy to reach and press on that keyboard. On a Danish keyboard, you need to use Alt Gr to get [ ], making it impossible to press Ctrl-[ and Ctrl-].

I can see the idea of keeping your hands on the "home row". But the arrow keys do have the advantage of working a whole lot better in insert mode (though I suppose I shouldn't be moving about in that mode, but I find it hard not to :-[).

Is there some trick to using visual mode to select lines? It seems if you do the obvious of pressing v and then moving down using j, it selects the lines plus the first character on the next line. If I have to select the lines up to the last and then press $ to get the last line, that's just hopeless :huh:.

Edit: Ah, found it with google while fiddling with this post. Apparently you can use Shift-V to enter visual line mode.

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 3,017
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #12 on: April 19, 2014, 04:44 PM »
Wow, that Catonmat.net website is a bit of a gem; look what I found:

Hi all. I am starting a new article series called "Vim Plugins You Should Know About". This series of articles is going to be about Vim plugins that you should know about and perhaps even be using. The first article in this series will be about one of my favorite plugins called "surround.vim".


Links to the rest of the articles at the bottom of that page.
Maybe I should start an AVE today...  ;)


ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #13 on: April 19, 2014, 08:40 PM »
Thanks for that.

I tried the surround plugin with some success.  I didn't find any evidence of the plugin populating the menus unfortunately -- hopefully something will turn up.



On a side note, I learned that something like menus might be possible in vanilla vim:

  http://unix.stackexchange.com/a/57911

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #14 on: May 03, 2014, 06:25 PM »
By using the dwb browser, I seem to be learning some additional key sequences as well as having others reinforced.  For example, 'gg' for moving the cursor to the top of the buffer (didn't remember this one) and 'G' for moving the cursor to the bottom of the buffer.

In IntelliJ IDEA (and perhaps other environments) I think there are plugins to help one learn key sequences -- may be there are some for vim too.

FWIW, I came across the following when looking for a way to describe what 'gg' does:

  http://www.catswhocode.com/blog/130-essential-vim-commands



One such plugin for IDEA is the Key Promoter plugin -- some description via following:

  http://georgik.sinusgear.com/2013/02/02/intellij-idea-must-have-plugin-keypromoter/
« Last Edit: May 03, 2014, 06:39 PM by ewemoa »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #15 on: May 03, 2014, 06:39 PM »
Haven't looked at in detail, but came across following:

  http://learnvimscrip...rdway.stevelosh.com/

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #16 on: May 04, 2014, 12:21 AM »
Thank you for the links ewemoa :Thmbsup:.

Going through that long list of commands now ;D.

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,857
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #17 on: May 04, 2014, 05:00 AM »
I guess I'm not all that sure what the argument is for using Vim in the Windows world - if Windows is the only OS you ever anticipate using.

In the Unix/Linux/BSD world it makes some sense since Vim is found (or easily installable) on any installation you'll run into. So it's sorta the lowest common denominator for editors in that environment. But that doesn't make it an ideal choice unless you're the type of person who is heavily into customizing and extending your editing environment. And most regular Vim users aren’t into it that much either. At least from what I've seen.

It's probably not a bad thing to learn some Vim as an exercise in moving outside your comfort zone. Or for the personal satisfaction of being able to say "been there, done that." I've put enough time in to where I'm moderately comfortable using Vim. But it's more a hobby or a "builds character" exercise for me. Vim certainly wouldn't be my first choice if I needed an editor. Nor my second. Or even my third...

But that's me. YMMV. 8) ;D
« Last Edit: May 04, 2014, 05:13 AM by 40hz »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #18 on: May 04, 2014, 06:18 AM »
Below are some scenarios I recall using vi / vim under:

  • Quick startup time handy for quick / small edits
  • Functions ok over slow connections
  • No other options in certain limited environments (e.g. while installing or restricted scenarios)

Knowing some of the key sequences has turned out to be handy in other contexts -- ofc, learning Emacs-ish key bindings also turned out to be useful too :)

40hz

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 11,857
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #19 on: May 04, 2014, 06:57 AM »
^Is all that primarily under Windows? Or mostly NIX? (Just curious.) :)

And yes...I forgot about the slow connection part. You're absolutely right about that. It's been a real godsend for me in similar situations. :Thmbsup:

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #20 on: May 04, 2014, 07:35 PM »
Mostly *NIX -- on Windows for quick edits I've tended to use Notepad.exe :)

And yes...I forgot about the slow connection part.

He he -- some things seem better these days!

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #21 on: May 05, 2014, 03:55 AM »
I guess I'm not all that sure what the argument is for using Vim in the Windows world - if Windows is the only OS you ever anticipate using.
It's probably not a bad thing to learn some Vim as an exercise in moving outside your comfort zone. Or for the personal satisfaction of being able to say "been there, done that." I've put enough time in to where I'm moderately comfortable using Vim. But it's more a hobby or a "builds character" exercise for me. Vim certainly wouldn't be my first choice if I needed an editor. Nor my second. Or even my third...

But that's me. YMMV. 8) ;D

If you read my initial post again, this is about experimenting with Vim to get to know it, and not about using Vim as your only editor ever ;D. I agree it is a bit of an oddball on Windows, but as you say, it's one of those things that are "nice to know", and which may come in handy if you ever have to do some work on *NIX.

Also, I feel I spend sufficient time in a text editor, that even smaller improvements in efficiency are worth exploring :Thmbsup:.

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: The AVE
« Reply #22 on: May 05, 2014, 05:25 AM »
Also, I feel I spend sufficient time in a text editor, that even smaller improvements in efficiency are worth exploring :Thmbsup:.

I can see that... although for me, twould be a much better thing to get more efficiency or accuracy on what happens on the other side of the keyboard!  :D
vi vi vi - editor of the beast

phitsc

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 1,198
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #23 on: May 05, 2014, 06:04 AM »
I guess I'm not all that sure what the argument is for using Vim in the Windows world - if Windows is the only OS you ever anticipate using.

...

Vim certainly wouldn't be my first choice if I needed an editor. Nor my second. Or even my third...

I'm afraid I have come to the same conclusion. I've uninstalled VIM on the same day I started this AVE :(

What I have done instead is to install VsVim in Visual Studio and Vintageous in Sublime Text 3 to make this a two step process:

1. Learn vi commands in an environment which is familiar (and fully configured)
2. Look into VIM configuration at a later time, after I have learned using VIM (well, the editing parts of it anyway)

I have since found that VsVim is superior to Vintageous (which itself is superior to Sublime's own Vintage mode). But both are actually quite usable.

The one cheat sheet I've consulted most often was this one: http://www.fprintf.n...t/vimCheatSheet.html
although I've started my own with the commands I use most (so I can look them up faster).

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: The AVE
« Reply #24 on: May 07, 2014, 11:04 PM »
Don't know how good it might be but just came across:

  http://dailyvim.blogspot.com/