emacsorphanage / helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
GNU General Public License v3.0
689 stars 55 forks source link

Why helm-swoop moves cursor at the beginning of line? Issue to get word at point #66

Closed sewkokot closed 9 years ago

sewkokot commented 9 years ago

When I set pre-input to 'ignore, I would like occasionaly insert a word (symbol) at point with hitting C-w. However after running helm-swoop command the cursor moves to the begiining of line (line 630 of the current source el file). This behaviour prevents C-w to use the word at point. Could it be fixed to make yank at point consistent with helm? Thanks.

sewkokot commented 9 years ago

It tried to implement such a function based on a similar functionality in swiper https://github.com/abo-abo/swiper/commit/52a083ec2c317f3450d27550f610827be1228924

It seems to work as a proof of concept. Could it be included in the main source?

  (defun my-helm-swoop-yank-thing-at-point ()
  (interactive)
  (let (amend)
    (with-selected-window helm-swoop-synchronizing-window
      (goto-char (car helm-swoop-last-point))
      (setq amend (thing-at-point 'symbol)))
    (when amend (insert amend))))

then I bound "C-w" to 'my-helm-swoop-yank-thing-at-point in helm-swoop-map

ShingoFukuyama commented 9 years ago

That's a good option for no-pre-input settings. v1.6.0 implements the function :laughing: (define-key helm-swoop-map (kbd "C-w") 'helm-swoop-yank-thing-at-point)

sewkokot commented 9 years ago

Thank you very much :)