dotfiles
dotfiles copied to clipboard
This could be impproved
https://github.com/ecly/dotfiles/blob/54845ff900988dbcd5cf25c7cb597bbe776eef0d/.vim/lua/core/options.lua#L69C1-L88C3 instead of checking if you are running on wsl, you may check if win32yank.exe exists like this:
vim.cmd [[
let windows = executable('win32yank.exe')
if windows
let g:clipboard = {
\ 'name': 'win32yank-wsl',
\ 'copy': {
\ '+': 'win32yank.exe -i --crlf',
\ '*': 'win32yank.exe -i --crlf',
\ },
\ 'paste': {
\ '+': 'win32yank.exe -o --lf',
\ '*': 'win32yank.exe -o --lf',
\ },
\ 'cache_enabled': 0,
\ }
endif
]]
The only disadvantage of this is that if you are using WSL and have not installed Win32yank, you will not receive any error messages, unlike with your current implementation.