Skip to content

Commit

Permalink
feat: added user command for diff visual selection with clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
fbosch committed Aug 19, 2024
1 parent 10a19d1 commit fcbe266
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .config/nvim/lua/plugins/editor/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,16 @@ return {
html = {},
marksman = {},
dockerls = {},
vtsls = {},
vtsls = {
filetypes = {
"javascript",
"javascriptreact",
"javascript.jsx",
"typescript",
"typescriptreact",
"typescript.tsx",
},
},
tsserver = {
enabled = false,
},
Expand Down
22 changes: 22 additions & 0 deletions .config/nvim/lua/usercmd.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
-- fix for the Z command
vim.api.nvim_create_user_command("Z", "wa | qa", {})

vim.api.nvim_create_user_command("DiffClip", function()
local ftype = vim.api.nvim_eval("&filetype")
vim.cmd(string.format(
[[
execute "normal! \"xy"
vsplit
enew
normal! P
setlocal buftype=nowrite
set filetype=%s
diffthis
execute "normal! \<C-w>\<C-w>"
enew
set filetype=%s
normal! "xP
diffthis
]],
ftype,
ftype
))
end, { desc = "Compare Active File with Clipboard" })
1 change: 1 addition & 0 deletions .config/nvim/spell/en.utf-8.add
Original file line number Diff line number Diff line change
Expand Up @@ -1239,3 +1239,4 @@ saturday
consistent-type-assertions
eslint-disable-line
dot-notation
viteFinal

0 comments on commit fcbe266

Please sign in to comment.