diff --git a/lua/milesvant/init.lua b/lua/milesvant/init.lua index 2eaae6b..00f6df2 100644 --- a/lua/milesvant/init.lua +++ b/lua/milesvant/init.lua @@ -23,3 +23,6 @@ end) keymap_once("v", "J", ":m '>+1gv=gv") keymap_once("v", "K", ":m '>-2gv=gv") + +-- paste without overwriting register +vim.api.nvim_set_keymap('v', 'p', 'P', { noremap = true }) diff --git a/lua/milesvant/opts.lua b/lua/milesvant/opts.lua index 6f00b9b..9b2c182 100644 --- a/lua/milesvant/opts.lua +++ b/lua/milesvant/opts.lua @@ -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"} diff --git a/setup.sh b/setup.sh index 30bf110..426d031 100755 --- a/setup.sh +++ b/setup.sh @@ -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