vim-yoink
                                
                                 vim-yoink copied to clipboard
                                
                                    vim-yoink copied to clipboard
                            
                            
                            
                        Last action was not paste - swap ignored
I am using the following version of vim: VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 19 2019 12:07:03) macOS version
I installed vim-yoink via Plug. The package did seem to install successfully. For example, if I enter the command :Yanks I get a nonempty list of the items that I have just yanked. However, when I type p in normal mode to paste, and then type <c-n> or <c-n>, I get the message Last action was not paste - swap ignored. Any help that you might be able to provide would be greatly appreciated!
It could be another plugin which makes a change after the past occurred. Can you try narrowing it down by either removing some plugins or starting with an empty vimrc (with only vim-yoink) then adding plugins back?
Removing Plug '907th/vim-auto-save' from my vimrc solved the issue. However, I would still like to use vim-auto-save alongside yoink. Is there any way to make this happen?
I looked into this a bit.  It looks like whenever you save the file, vim increments b:changedtick, and this is the value that yoink relies on to figure out if you just performed a paste and can therefore support swapping.
Can you try updating and then adding this to your vimrc?
let g:yoinkChangeTickThreshold  = 1
I tried it. Unfortunately that change didn't fix the issue.
Can you provide a minimal .vimrc showing the issue? I tested it specifically with vim-auto-save and found that it worked
Sure, I experience the issue with this .vimrc:
set nocompatible filetype plugin on syntax on
call plug#begin('~/.vim/plugged')
Plug 'svermeulen/vim-yoink' let g:yoinkIncludeDeleteOperations = 0 let g:yoinkChangeTickThreshold = 1 Plug '907th/vim-auto-save' let g:auto_save = 1 " enable AutoSave on Vim startup
call plug#end()
nmap p 
nmap 
I have the same problem, for years actually, across different auto-save and yank-stack (e.g. [1]) plugins.
Using
let g:yoinkChangeTickThreshold = 1
works perfectly for me. Thanks for pointing this out. Thank you for this plugin :heart:
Old workaround
diff --git a/autoload/yoink.vim b/autoload/yoink.vim
index 337cf92..e4d513a 100644
--- a/autoload/yoink.vim
+++ b/autoload/yoink.vim
@@ -188,15 +188,6 @@ function s:isCloseEnoughChangeTick(tick)
 endfunction
 
 function! s:tryStartSwap()
-    " If a change occurred that was not a paste or a swap, we do not want to do the undo-redo
-    " Also, if the swap has ended by executing a cursor move, then we don't want to
-    " restart the swap again from the beginning because they would expect to still be at the
-    " previous offset
-    if !s:isCloseEnoughChangeTick(s:lastSwapStartChangedtick) || (!s:isSwapping && s:isCloseEnoughChangeTick(s:lastSwapChangedtick))
-        echo 'Last action was not paste - swap ignored'
-        return 0
-    endif
-
     if !s:isSwapping
         " This is necessary in the case where the default register is different from the first
         " element in the history, which can happen a lot with deletes
:see_no_evil:
[1] https://github.com/maxbrunsfeld/vim-yankstack/issues/61