mcchrish / nnn.vim

File manager for vim/neovim powered by n³
BSD 2-Clause "Simplified" License
646 stars 25 forks source link

clipboard does not work #150

Closed 0rtz closed 2 years ago

0rtz commented 2 years ago

Describe the bug

When leaving nnn clipboard content seems to dissapear

To Reproduce

So i have this init.vim

let data_dir = stdpath('data') . '/site'
if empty(glob(data_dir . '/autoload/plug.vim'))
    silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
endif

call plug#begin()
Plug 'mcchrish/nnn.vim'
call plug#end()

nnoremap <silent> \f :NnnPicker<CR>
let g:nnn#command = 'nnn'

and this bash script which i use as an nnn module

#!/usr/bin/env sh

echo $1 | tr -d '\n' | xclip -i -selection clipboard

I set module as export NNN_PLUG="y:nnn_file_path_yank;" in my .zshrc

And when i launch nnn from inside neovim, do ;y and quit nnn, clipboard content dissapears. Even though it's there until i quit nnn, i can paste it, but when i quit nnn - it's lost. Its seems to be a wierd problem and maybe im missing something in my own setup, but if you could take a look it will be great

N-R-K commented 2 years ago

Try this out and report back if it works or not.

#!/usr/bin/env sh

printf "%s" "$1" | setsid -f xclip -i -selection clipboard
jarun commented 2 years ago

Closing as no response.

0rtz commented 2 years ago

@N-R-K yeah, it works, ty