Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to replace text in visual mode with paste #4685

Closed
kubaracek opened this issue Jan 19, 2016 · 17 comments
Closed

Unable to replace text in visual mode with paste #4685

kubaracek opened this issue Jan 19, 2016 · 17 comments
Labels
macOS stale marked as a stale issue/pr (usually by a bot) updated This issue has been updated since becoming stale

Comments

@kubaracek
Copy link

Description

When I yank a word and then in visual mode select a text that I want to replace pressing p seems to delete the highlighted text which yanks it and paste it instead of the originally yanked text making it impossible to replace a text.

Update

Seems like osx layer causes this weird behaviour.

Reproduction guide

Highlight a word in visual mode.
press y to yank the selection
go to a word that you want to replace
go to visual mode and select this word
press p

Right now the word should be replaced with the yanked text but it's replaced with itself == makes no change to the word.

System Info

  • OS: darwin
  • Emacs: 24.5.1
  • Spacemacs: 0.105.7
  • Spacemacs branch: master (rev. 8a94bbf)
  • Distribution: spacemacs
  • Layers:
     '(
     auto-completion
     better-defaults
     ;; Languages
     emacs-lisp
     ruby
     scala
     markdown
     javascript
     shell-scripts
     yaml
     html
     dockerfile
     ruby-on-rails
     ;; org
     (shell :variables
             shell-default-height 30
             shell-default-position 'bottom)
     ;; spell-checking
     syntax-checking
     ;; version-control
     git
     github
     ;; themes
     themes-megapack
     colors
     ;; system
     osx
     tmux
     ;; chat
     erc
     )
@TheBB
Copy link
Contributor

TheBB commented Jan 19, 2016

I can't reproduce this. It works as expected here.

@kubaracek
Copy link
Author

Just tried to comment out all my layers and it works. So there must gotta be a one that causes this. Let me debug it

@kubaracek
Copy link
Author

Ok debugged it by commenting out my active layers and this is caused by osx layer.

@nixmaniack
Copy link
Contributor

I can confirm this and was surprised with this behaviour and wondered this must be the Vim way and continued using it! 😈

@nixmaniack
Copy link
Contributor

I faced this in hybrid style(hybrid state). I think delete-selection-mode would be useful in hybrid-state.

@aspett
Copy link

aspett commented Jan 21, 2016

Have been having this issue for ages. Did you find any good way to configure the osx layer to fix the issue?

@aspett
Copy link

aspett commented Jan 21, 2016

Actually, just tried disabling the osx layer. Issue is still present for me

Steps I used to reproduce:

  • Copy some text from website
  • Visual line mode on some text in a buffer
  • p
  • Doesn't paste what I copied

  • OS: osx yosemite
  • Emacs: 24.5.1
  • Spacemacs: 0.105.6
  • Spacemacs branch: master
  • Distribution: spacemacs
  • Layers:
     emacs-lisp
     git
     ;; osx
     markdown
     org
     ruby-on-rails
     elixir
     restclient

@kubaracek
Copy link
Author

Hi @aspett do you have any layer that uses your system clipboard in emacs? When I copy anything from web/(any other app) then p uses another (emacs) clipboard. Which is what I would except.

I have this simple config defined in dotspacemacs/user-config

(defun pbcopy ()
    (interactive)
    (call-process-region (point) (mark) "pbcopy")
    (setq deactivate-mark t))

  (defun pbpaste ()
    (interactive)
    (call-process-region (point) (if mark-active (mark) (point)) "pbpaste" t t))

  (defun pbcut ()
    (interactive)
    (pbcopy)
    (delete-region (region-beginning) (region-end)))

  (global-set-key (kbd "C-c c") 'pbcopy)
  (global-set-key (kbd "C-c v") 'pbpaste)
  (global-set-key (kbd "C-c x") 'pbcut)

This allows me to copy, paste and cut from/to my system clipboard using C-c c for copy C-c v for paste and C-c x for cut

@aspett
Copy link

aspett commented Jan 21, 2016

Heya @jacobjakub. No, I've tried disabling all layers and reverting to a stock config, but no joy. I was expecting that copying to system clipboard would allow me to paste via p. I'd rather not set up special keybinds for pbcopy etc- having system clipboard copy into another register would be an ideal alternative.

@idrozd
Copy link
Contributor

idrozd commented Jul 25, 2016

Same issue here

While this is not yet solved, one can use kill-ring (SPC r y) to avoid looking for and copying source of attempted paste second time

@Grimi94
Copy link

Grimi94 commented Jan 13, 2017

I am having the same issue with the osx layer

@felipeagc
Copy link

I was having the same issue with spacemacs and my own configuration on Arch Linux. Found this solution here. It worked for me, hope it helps.

@braham-snyder
Copy link
Contributor

this is a duplicate of #3735

@FieryCod
Copy link
Contributor

@felipeagc Thank you so much bro :)

@bobdanek
Copy link

bobdanek commented Jan 1, 2019

I'm having a similar problem that sounds like the same root cause.

If I y something in visual mode, or yank a line while not in visual mode, move elsewhere, delete a word or line (d w or D), then p, the thing that gets pasted is the thing I just deleted, not thing thing I yanked.

System:

  • OS: macOS 10.14.2 (18C54)
  • SpaceMacs version: 0.200.13@26.1
  • Emacs version: d12frosted/emacs-plus/emacs-plus: stable 26.1 (bottled), devel 26.1-rc1, HEAD

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
@kubaracek
Copy link
Author

kubaracek commented Mar 3, 2020

I'm having a similar problem that sounds like the same root cause.

If I y something in visual mode, or yank a line while not in visual mode, move elsewhere, delete a word or line (d w or D), then p, the thing that gets pasted is the thing I just deleted, not thing thing I yanked.

System:

  • OS: macOS 10.14.2 (18C54)
  • SpaceMacs version: 0.200.13@26.1
  • Emacs version: d12frosted/emacs-plus/emacs-plus: stable 26.1 (bottled), devel 26.1-rc1, HEAD

@bobdanek This is a default vim behavior :)) https://vim.fandom.com/wiki/Remembering_previous_deletes/yanks

type :reg to see all the registers

@JAremko JAremko added the updated This issue has been updated since becoming stale label May 26, 2020
@JAremko JAremko closed this as completed May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
macOS stale marked as a stale issue/pr (usually by a bot) updated This issue has been updated since becoming stale
Projects
None yet
Development

No branches or pull requests