chore(nvim): some stuff including clipboard stuff
This commit is contained in:
parent
a7432829e5
commit
97cde4780d
4 changed files with 68 additions and 23 deletions
|
@ -9,3 +9,13 @@ vim.keymap.set("n", "<A-h>", "<cmd>bp<CR>")
|
||||||
vim.keymap.set("n", "<A-l>", "<cmd>bn<CR>")
|
vim.keymap.set("n", "<A-l>", "<cmd>bn<CR>")
|
||||||
--jk as escape
|
--jk as escape
|
||||||
vim.keymap.set("i", "jk","<esc>")
|
vim.keymap.set("i", "jk","<esc>")
|
||||||
|
-- Copy to system clipboard
|
||||||
|
vim.keymap.set({ 'n', 'x' }, 'gy', '"+y', { desc = 'Copy to system clipboard' })
|
||||||
|
-- Paste from system clipboard in normal mode
|
||||||
|
vim.keymap.set('n', 'gp', '"+p', { desc = 'Paste from system clipboard' })
|
||||||
|
-- Paste from system clipboard in visual mode without overwriting the clipboard
|
||||||
|
vim.keymap.set('x', 'gp', '"+P', { desc = 'Paste from system clipboard' })
|
||||||
|
--Center screen after some motions
|
||||||
|
vim.keymap.set("n", "<C-d>", "<C-d>zz", {desc = "Center cursor after moving down half-page"})
|
||||||
|
vim.keymap.set("n", "<C-u>", "<C-u>zz", {desc = "Center cursor after moving down half-page"})
|
||||||
|
vim.keymap.set("n", "G", "Gzz", {desc = "Center cursor after moving down half-page"})
|
||||||
|
|
|
@ -21,8 +21,9 @@ return {
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
require("luasnip/loaders/from_vscode").lazy_load()
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
local lspkind = require("lspkind")
|
vim.opt.pumheight = 15
|
||||||
|
|
||||||
|
local lspkind = require("lspkind")
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
|
@ -58,22 +59,33 @@ return {
|
||||||
end),
|
end),
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = { "kind", "abbr", "menu" },
|
fields = { "kind", "abbr" },
|
||||||
format = lspkind.cmp_format({
|
format = function(entry, vim_item)
|
||||||
mode = "symbol_text",
|
local formatted_entry = lspkind.cmp_format({
|
||||||
maxwidth = 50,
|
mode = "symbol",
|
||||||
ellipsis_char = "...",
|
maxwidth = {
|
||||||
show_labelDetails = true,
|
menu = 0
|
||||||
|
},
|
||||||
before = function(entry, vim_item)
|
show_labelDetails = false
|
||||||
vim_item.menu = ({
|
})(entry, vim_item)
|
||||||
nvim_lsp = "[LSP]",
|
formatted_entry.kind = (formatted_entry.kind or "") .. " "
|
||||||
nvim_lua = "[NVIM LSP]",
|
-- local item = entry:get_completion_item()
|
||||||
path = "[Path]",
|
-- if item.detail then
|
||||||
})[entry.source.name]
|
-- local detail = item.detail
|
||||||
return vim_item
|
-- if string.find(detail, "->") ~= nil then
|
||||||
end,
|
-- local return_arrow = vim.split(detail, "->", { trimempty = true })
|
||||||
}),
|
-- detail = vim.trim(return_arrow[2] or "")
|
||||||
|
-- end
|
||||||
|
-- if string.len(detail) <= 10 then
|
||||||
|
-- print("<=10 " .. detail)
|
||||||
|
-- formatted_entry.menu = detail
|
||||||
|
-- else
|
||||||
|
-- print(">10 " .. detail)
|
||||||
|
-- formatted_entry.menu = nil
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
return formatted_entry
|
||||||
|
end
|
||||||
},
|
},
|
||||||
preselect = cmp.PreselectMode.None,
|
preselect = cmp.PreselectMode.None,
|
||||||
sorting = {
|
sorting = {
|
||||||
|
@ -82,9 +94,6 @@ return {
|
||||||
cmp.config.compare.offset,
|
cmp.config.compare.offset,
|
||||||
cmp.config.compare.exact,
|
cmp.config.compare.exact,
|
||||||
cmp.config.compare.score,
|
cmp.config.compare.score,
|
||||||
cmp.config.compare.kind,
|
|
||||||
cmp.config.compare.recently_used,
|
|
||||||
cmp.config.compare.locality,
|
|
||||||
|
|
||||||
--Make entries that start with underline appear after
|
--Make entries that start with underline appear after
|
||||||
function(entry1, entry2)
|
function(entry1, entry2)
|
||||||
|
@ -98,12 +107,17 @@ return {
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
cmp.config.compare.kind,
|
||||||
|
cmp.config.compare.sort_text,
|
||||||
|
cmp.config.compare.length,
|
||||||
|
cmp.config.compare.order,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lua" },
|
{ name = "nvim_lua" },
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" },
|
--{ name = "luasnip" },
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
}, {
|
}, {
|
||||||
{ name = "buffer", keyword_length = 5 },
|
{ name = "buffer", keyword_length = 5 },
|
||||||
|
@ -117,7 +131,11 @@ return {
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None",
|
winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None",
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
experimental = {
|
||||||
|
native_menu = false,
|
||||||
|
ghost_text = false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
|
|
@ -22,7 +22,6 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"epwalsh/obsidian.nvim",
|
"epwalsh/obsidian.nvim",
|
||||||
version = "v3.9.0",
|
version = "v3.9.0",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
return {
|
return {
|
||||||
|
|
||||||
{
|
{
|
||||||
"vimpostor/vim-tpipeline",
|
"vimpostor/vim-tpipeline",
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -73,6 +74,23 @@ return {
|
||||||
-- }
|
-- }
|
||||||
-- }
|
-- }
|
||||||
-- },
|
-- },
|
||||||
|
{
|
||||||
|
"karb94/neoscroll.nvim",
|
||||||
|
config = function()
|
||||||
|
local neoscroll = require('neoscroll')
|
||||||
|
neoscroll.setup({
|
||||||
|
hide_cursor = false,
|
||||||
|
})
|
||||||
|
local keymap = {
|
||||||
|
["<C-u>"] = function() neoscroll.ctrl_u({ duration = 150 }) end,
|
||||||
|
["<C-d>"] = function() neoscroll.ctrl_d({ duration = 150 }) end,
|
||||||
|
}
|
||||||
|
local modes = { 'n', 'v', 'x' }
|
||||||
|
for key, func in pairs(keymap) do
|
||||||
|
vim.keymap.set(modes, key, func)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"folke/zen-mode.nvim",
|
"folke/zen-mode.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
|
|
Loading…
Add table
Reference in a new issue