8000 add operation yank-to-last-character-of-line by diogocampos · Pull Request #778 · atom/vim-mode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.

add operation yank-to-last-character-of-line #778

Closed
wants to merge 1 commit into from

Conversation

diogocampos
Copy link

...to allow mapping Y to do this instead of yanking the entire line.

...to allow mapping `Y` to do this instead of yanking the entire line.
@mattr-
Copy link
Contributor
mattr- commented Jul 20, 2015

Any reason you can't create a mapping to do this with the existing yank command and a motion like you would in vim? (map Y y$)

@jacekkopecky
Copy link
Contributor

I suspect the reason is that composing vim-mode's commands can really only be done inside vim-mode; perhaps we need some kind of API for that? Time to look at what those services are all about.

@jacekkopecky
Copy link
Contributor

Oh, combining motions outside of vim-mode is possible: here's what I have in my init.coffee to combine n and zz:

atom.commands.add 'atom-text-editor.vim-mode.command-mode', 'jacek:center-next', ->
  editor = atom.workspace.getActiveTextEditor()
  editorElement = atom.views.getView(editor)
  vimState = VimMode.getEditorState(editor)
  vimState.pushOperations new Motions.RepeatSearch(editor, vimState)
  vimState.pushOperations new Scroll.ScrollCursorToMiddle(editorElement, {leaveCursor: true})

And then in the keymap.cson:

'atom-text-editor.vim-mode:not(.insert-mode)':
  '\\': 'jacek:center-next'

This could, however, be easier.

@jacekkopecky
Copy link
Contributor

I think this should be possible in the author’s own configuration by combining y and $. Currently there's a way outlined above; but should vim-mode provide an API akin to vim’s :map?

@mattr-
Copy link
Contributor
mattr- commented Jul 24, 2015

Vim doesn't provide one, so my vote (initially) is 'no'

@mattr-
Copy link
Contributor
mattr- commented Jul 25, 2015

Oh, wait, I misunderstood the question earlier. Initially, I said 'no' because I wasn't in agreement with providing a default mapping for Y. That being said, I'd love to see a :map command implemented in vim-mode, but Atom's already existing facilities are useful for this too, so ¯_(ツ)_/¯

@romgrk
Copy link
romgrk commented Aug 17, 2015

I do have a personnal :map command but it's not production level.
It allows to write mappings like:

maps =
    '<a-k>': '5k'
    '<a-j>': '5j'
    '<a-d>': '<c-d>'
    '<a-u>': '<c-u>'

nmaps =
    '<CR>':   'o<esc>'
    '<S-CR>': 'O<esc>'
    'Y':    'y$'
    'S':    'v$hs'

If you're interested I could try to bundle something.

@lee-dohm
Copy link
Contributor
lee-dohm commented Apr 5, 2018

As stated in the README, this package is no longer maintained and is deprecated. We recommend that people use the vim-mode-plus package instead. Because of this, we are archiving this repository and closing all issues and pull requests. Thanks very much for your support and contributions!

@lee-dohm lee-dohm closed this Apr 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0