Skip to content
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.

Add handling for :w #520

Closed
AsaAyers opened this issue Feb 11, 2015 · 24 comments
Closed

Add handling for :w #520

AsaAyers opened this issue Feb 11, 2015 · 24 comments

Comments

@AsaAyers
Copy link

I know it doesn't make sense to include all of the : commands, but :w is muscle memory. Is it possible/advisable to add a subset of these?:wq

@danwoods
Copy link

+1

@ybc37
Copy link

ybc37 commented Feb 12, 2015

I'm not sure if it meets your needs, but as for :w, you can map it in your keymap.cson:

'atom-text-editor.vim-mode:not(.insert-mode)':
  ': w': 'core:save'

I guess you could write a function in init.coffee that saves and quits and map it to :wq (see: http://jasonrudolph.com/blog/2014/03/02/defining-atom-commands-in-your-init-script/). I'm not an Atom expert, so try it on your own risk 😉

@AsaAyers
Copy link
Author

Thanks! that worked.

I'll leave the issue open though, I think it would be nice to include in vim-mode by default.

I got :wa going too:

'atom-text-editor.vim-mode:not(.insert-mode)':
  ': w': 'core:save'
  ': w a': 'window:save-all'

@danwoods
Copy link

@nesmyslny Thanks!

@jacekkopecky
Copy link
Contributor

Interesting; I too thought that :w should really be mapped to save, but then I remembered that I added a mapping in my vim for cmd-s anyway, so I'll be happy to try and retrain my muscle memory on that bit.

I have thought, however, that : could map to cmd-shift-p – open the command palette – that could be more in the spirit of what one does with : – what do you think?

@ybc37
Copy link

ybc37 commented Feb 13, 2015

Actually, that's how I use it: : mapped to the command palette. In vim I mapped save to leader w (and so in Atom now), so that setup with command palette works for me pretty well.

There's already a discussion about that in issue #50 (also #185, #441).

@jacekkopecky
Copy link
Contributor

Awesome; I'm quite late to the party, so thanks for the pointers. 8-)

@Germanika
Copy link

lloeki also started development on an ex-mode package to complement vim-mode, so I'd suggest checking that out: https://atom.io/packages/ex-mode
Personally, I think these should be incorporated into vim-mode by default, but it seems the overall sentiment is to leave them out, so an additional package is the next-best thing.

@maxbrunsfeld
Copy link
Contributor

Yeah, we'd like to leave ex-mode up to other packages to implement. I believe @lloeki is doing a nice job with the ex-mode package mentioned above.

@gerrywastaken
Copy link

Wow, this was the one thing major thing holding me back from using atom. I can't believe I just had to install another package. I would have expected "vim-mode" to add :w

@Qix-
Copy link

Qix- commented Dec 1, 2015

Is :w really ex-mode? I thought ex-mode was something completely different...

@luxigo
Copy link

luxigo commented Jan 3, 2016

+1 for "muscle memory" and "why another package ?"

Maybe you also need https://atom.io/packages/keyboard-localization ....

@aqibos
Copy link

aqibos commented Feb 12, 2016

+1

@avishaan
Copy link

avishaan commented Apr 3, 2016

should be in vim mode by default +1

@AsaAyers
Copy link
Author

AsaAyers commented Apr 3, 2016

Because ex-mode already handles :w it doesn't make any sense to add :w to vim-mode no matter how many people +1 it. But I think it might be worth considering having vim-mode auto-install ex-mode

The linter-* plugins don't do anything without linter installed. linter-eslint uses atom-package-deps to auto-install linter when it loads.

@avishaan
Copy link

avishaan commented Apr 3, 2016

fair point, makes sense

On Apr 3, 2016, at 4:46 PM, Asa Ayers notifications@github.com wrote:

Because ex-mode https://atom.io/packages/ex-mode already handles :w it doesn't make any sense to add :w to vim-mode no matter how many people +1 it. But I think it might be worth considering having vim-mode auto-install ex-mode https://atom.io/packages/ex-mode
The linter-* plugins don't do anything without linter installed. linter-eslint https://github.com/AtomLinter/linter-eslint/blob/master/lib/main.js#L71 uses atom-package-deps https://www.npmjs.com/package/atom-package-deps to auto-install linter when it loads.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub #520 (comment)

@Qix-
Copy link

Qix- commented Apr 4, 2016

But I think it might be worth considering having vim-mode auto-install ex-mode

As someone who came from actual Vim and was confused as to why :w wasn't working, I completely agree.

@ThePrimeagen
Copy link

This just seems like a disconnect from product dev to the end user. The end user reads vim-mode. Ok, i'll vim it up (as I did). So of course, I try to save. Takes me 10 minutes to get to this point reading that command mode is implemented, but in a completely separate package with features I may or may not want.

The linter example is bogus. Its relation to vim would not be for the most quintessential vim feature (saving) but for adding vundles, or color themes, or other non-vim core related items.

Ohh well, I guess users who install vim will have to tribal their knowledge to this forum and find out that ex-mode is how you can save!

+1

@gerrywastaken
Copy link

@AsaAyers I don't think most people who added a +1 really give much of a damn which way :w gets enabled when they install vim-mode, just that it gets enabled.

@AsaAyers
Copy link
Author

Right, and I'm just saying that since there is an existing project that already handles it I think it makes more sense to pair them. vim-mode should bring in ex-mode when you install it. It doesn't make any sense for vim-mode to implement exactly 1 ex-command that conflicts with another package.

@Qix-
Copy link

Qix- commented Jun 10, 2016

Can packages bring in other packages @AsaAyers?

@AsaAyers
Copy link
Author

Yes, most of the linter-* packages will install linter if you don't have it.

The linter-* plugins don't do anything without linter installed. linter-eslint uses atom-package-deps to auto-install linter when it loads.

@Qix-
Copy link

Qix- commented Jun 11, 2016

Then that is what should be happening here IMO; vim-mode should be pulling in ex-mode.

@plbowers
Copy link
Contributor

Fully agree - vim-mode should "depend on" ex-mode so that installing vim-mode automatically installs ex-mode. (Maybe vice versa too, but that's for a different boad)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests