Hacker Newsnew | comments | show | ask | jobs | submit login

Better yank/paste | over SSH support



Is there any way to run multiple vim windows from one vim process, with them sharing the same internal clipboard?

To me, the window manager handling the window arrangement feels like The Right Thing, but vim handling the clipboard also feels right (because it interacts with many commands). So I'd like some hybrid of the two options of: 1) running multiple WM-managed vim instances; vs. 2) running one vim with vim-internal window management. I basically agree with the goal of running vim with dwm window management, but it seems wrong to have to reimplement dwm inside of vim, instead of using dwm itself to manage vim windows.

-----


As an aside, you should also note that you can interact with the X clipboard from within vim or gvim. It's represented by the * register, so you can do things like "[asterisk]p to paste from other programs or "*Y to yank to them. Replace [asterisk] with the actual symbol. HN thought I was trying to italicize.

-----


I bound some keys to this and works pretty well

  nnoremap <Leader>y "+yy  
  nnoremap <Leader>d "+dd
  noremap  <Leader>p "+p
  noremap  <Leader>P "+P
  vnoremap <Leader>y "+y
  vnoremap <Leader>d "+d

-----


If your vim is on a box with an X server, look into client/server mode. You can then specify if you want to open a file in its own process or in the server process you spawned earlier.

Also, you can set the default yank register to be your X clipboard. Look into set clipboard = unnamed+ (make sure your vim is complied with X support for both of these)

-----


For 2) you can use tabs in Vim to provide different workspaces, with each workspace having a certain layout of windows.

I've just found out that dwm.vim doesn't work well with tabs just yet though - it copies all buffer windows to the current tab on Ctrl-f (make active window the master focus).

-----


Yep this has to be fixed.

-----


"Is there any way to run multiple vim windows from one vim process, with them sharing the same internal clipboard?"

Yes, though you will need a Vim with support for it built. See `:h client-server` for details. (I never really got into using it regularly)

-----




Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: