diff --git a/.vimrc b/.vimrc index 83a6b81..d16d207 100644 --- a/.vimrc +++ b/.vimrc @@ -18,6 +18,10 @@ Plugin 'pearofducks/ansible-vim' Plugin 'mechatroner/rainbow_csv' " ChatGPT plugin Plugin 'CamdenClark/flyboy' +" Aider +Plugin 'joshuavial/aider.nvim' +" Black +Plugin 'psf/black' " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required @@ -72,13 +76,37 @@ set statusline +=%2*0x%04B\ %* "character under cursor " Copy to clipboard " set clipboard=unnamedplus -if system('uname -r') =~ "Microsoft" - augroup Yank - autocmd! - autocmd TextYankPost * :call system('/mnt/c/windows/system32/clip.exe ',@") - augroup END +"if system('uname -r') =~ "Microsoft" +" augroup Yank +" autocmd! +" autocmd TextYankPost * :call system('/mnt/c/windows/system32/clip.exe ',@") +" augroup END +"endif + +" only on WSL +if has('unix') && system('uname -r') =~ 'Microsoft' + + augroup YankToWindowsClipboard + autocmd! + autocmd TextYankPost * call s:WslYank() + augroup END + + function! s:WslYank() abort + " get the yanked text + let l:txt = @" + " shell-escape it + let l:esc = shellescape(l:txt) + " pipe through iconv to UTF-16LE, then into clip.exe + call system( + \ 'printf %s '.l:esc. + \ ' | iconv -f utf-8 -t utf-16le'. + \ ' | /mnt/c/Windows/System32/clip.exe' + \ ) + endfunction + endif + "map "=p :r !powershell.exe -Command Get-Clipboard "map! = :r !powershell.exe -Command Get-Clipboard "noremap "+p :exe 'norm a'.system('/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command Get-Clipboard') @@ -108,7 +136,8 @@ endif " generate pw? " r! cmd.exe /c 'python C:\Tools\pw.py 10' " =system("cmd.exe /c 'python C:\\Tools\\pw.py 10' | tr -d '\n' | tr -d '\r'") -let pwcmd = 'cmd.exe /c "python C:\\Tools\\pw.py 10" |tr -d "\\n"|tr -d "\\r"' +"let pwcmd = 'cmd.exe /c "python C:\\Tools\\pw.py 10" |tr -d "\\n"|tr -d "\\r"' +let pwcmd = 'powershell.exe -command "python C:\\Tools\\pw.py 10" |tr -d "\\n"|tr -d "\\r"' :nmap "=system(pwcmd)p :imap =system(pwcmd)