(defun haroogan/evil-paste-from-clipboard ()
"Paste text from system clipboard."
(evil-define-operator haroogan/evil-yank-to-clipboard (beg end type yank-handler)
"Yank text to system clipboard."
(evil-yank beg end type ?+ yank-handler))
Paste works as intended. Yank works partly:
yanking I can paste this text into other applications;
I cannot paste it into the Emacs itself, i.e. by using haroogan/evil-paste-from-clipboard - it says that the kill-ring is empty; how come?
bell rings when I'm yanking with this function - like if it was
an error - that's very strange too.
For the reference, in my .vimrc I
have the following:
" Cut to the system clipboard.
nnoremap <C-x> "+x
vnoremap <C-x> "+x
cnoremap <C-x> "+x
" Yank to the system clipboard.
nnoremap <C-y> "+y
vnoremap <C-y> "+y
cnoremap <C-y> "+y
" Paste from the system clipboard.
nnoremap <C-p> "+p
vnoremap <C-p> "+p
cnoremap <C-p> "+p
What's the best way to replicate this with Evil?
Evil provides the following function:
(evil-define-command evil-window-new (count file
"Splits the current window horizontally
and opens a new buffer or edits a certain FILE."
(split-window (selected-window) count)
(let ((buffer (generate-new-buffer "*new*")))
(set-window-buffer (selected-window) buffer)
In my opinion the last line reveals a huge flaw.
First of all, recently I've been writing a tiling window manager for
Of course when I create new windows there, I create buffers as well
with the samegenerate-new-buffer
And of course as suggested by theevil-window-new
function presented above, one has to call (with-current-buffer buffer (evil-normal-state))
so that Evil does not break here and works properly in this newly
That's incredibly annoying for 2 reasons.
First, now, for instance, my tiling window manager has to depend on
the Evil package just to make this little hack for those who wish to
use Evil with my tiling window manager (including myself).
Second, you have already probably noticed that such buffers as Emacs
Help and friends do not work with Evil properly.
And I suspect that the reason for that is the same simply because in
case of Emacs Help buffer you could no longer inject this hackish
call:(with-current-buffer buffer (evil-normal-state))
I might be wrong with my implications, and I wish you could prove
that I am.
I'm nowhere near an Emacs hacker, just learning (migrating from
Vim), but may I say that defadvice to me seems to be a
remedy to this problem?
Anyway, please, share your thoughts on this topic, I really hope
that this can somehow be reimplemented in more robust way, so that
Evil has more seamless and natural integration with the whole Emacs