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>")
|
||||
--jk as escape
|
||||
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")
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
vim.opt.pumheight = 15
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
|
@ -58,22 +59,33 @@ return {
|
|||
end),
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
show_labelDetails = true,
|
||||
|
||||
before = function(entry, vim_item)
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[NVIM LSP]",
|
||||
path = "[Path]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
fields = { "kind", "abbr" },
|
||||
format = function(entry, vim_item)
|
||||
local formatted_entry = lspkind.cmp_format({
|
||||
mode = "symbol",
|
||||
maxwidth = {
|
||||
menu = 0
|
||||
},
|
||||
show_labelDetails = false
|
||||
})(entry, vim_item)
|
||||
formatted_entry.kind = (formatted_entry.kind or "") .. " "
|
||||
-- local item = entry:get_completion_item()
|
||||
-- if item.detail then
|
||||
-- local detail = item.detail
|
||||
-- if string.find(detail, "->") ~= nil then
|
||||
-- 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,
|
||||
sorting = {
|
||||
|
@ -82,9 +94,6 @@ return {
|
|||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
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
|
||||
function(entry1, entry2)
|
||||
|
@ -98,12 +107,17 @@ return {
|
|||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
--{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
|
@ -117,7 +131,11 @@ return {
|
|||
border = "rounded",
|
||||
winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None",
|
||||
},
|
||||
}
|
||||
},
|
||||
experimental = {
|
||||
native_menu = false,
|
||||
ghost_text = false,
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
|
|
@ -22,7 +22,6 @@ return {
|
|||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "v3.9.0",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
return {
|
||||
|
||||
{
|
||||
"vimpostor/vim-tpipeline",
|
||||
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",
|
||||
event = "VeryLazy",
|
||||
|
|
Loading…
Add table
Reference in a new issue