Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use xclip clipboard for yank/delete/change and paste without overwrit… #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lua/milesvant/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ end)

keymap_once("v", "J", ":m '>+1<CR>gv=gv")
keymap_once("v", "K", ":m '>-2<CR>gv=gv")

-- paste without overwriting register
vim.api.nvim_set_keymap('v', 'p', 'P', { noremap = true })
17 changes: 17 additions & 0 deletions lua/milesvant/opts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,20 @@ vim.opt.smartindent = true
vim.opt.hlsearch = true
vim.opt.incsearch = true

-- Use xclip clipboard
vim.g.clipboard = {
name = 'xclip',
copy = {
["+"] = 'xclip -selection clipboard',
["*"] = 'xclip -selection clipboard',
},
paste = {
["+"] = 'xclip -selection clipboard -o',
["*"] = 'xclip -selection clipboard -o',
},
cache_enabled = 1,
}

-- tell nvim to use the clipboard for all yank, delete, change and put operations
-- 'unnamed' for mac, 'unnamedplus' for linux
vim.opt.clipboard = {"unnamed","unnamedplus"}
6 changes: 6 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ chmod u+x nvim.appimage
sudo mv squashfs-root /
sudo ln -s /squashfs-root/AppRun /usr/bin/nvim

echo 'alias vi=nvim' >> ~/.bashrc

# xclip
sudo apt-get update
sudo apt-get install xclip

# packer
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim 2> /dev/null
Expand Down