Merge branch 'main' of https://github.com/LarssonMartin1998/.dotfiles
This commit is contained in:
commit
29859d95ec
8 changed files with 136 additions and 31 deletions
|
|
@ -33,7 +33,7 @@ require("utils").add_keymaps({
|
|||
},
|
||||
|
||||
-- Window
|
||||
["<leader>x"] = {
|
||||
["<C-x>"] = {
|
||||
cmd = "<C-w>q",
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ return {
|
|||
opts = {
|
||||
show_icons = true,
|
||||
leader_key = ",",
|
||||
global_bookmarks = true,
|
||||
global_bookmarks = false,
|
||||
custom_actions = {
|
||||
open = function(filename, _)
|
||||
vim.cmd(string.format(":drop %s", filename))
|
||||
|
|
|
|||
|
|
@ -24,22 +24,23 @@ return {
|
|||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
},
|
||||
{
|
||||
{ name = "buffer" },
|
||||
})
|
||||
{ name = "nvim_lsp" },
|
||||
},
|
||||
{
|
||||
{ name = "buffer" },
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||
}, {
|
||||
sources = cmp.config.sources(
|
||||
{
|
||||
{ name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||
},
|
||||
{
|
||||
{ name = "buffer" },
|
||||
})
|
||||
})
|
||||
|
|
@ -58,10 +59,9 @@ return {
|
|||
sources = cmp.config.sources({
|
||||
{ name = "path" }
|
||||
}, {
|
||||
{ name = "cmdline" }
|
||||
}),
|
||||
{ name = "cmdline" }
|
||||
}),
|
||||
matching = { disallow_symbol_nonprefix_matching = false }
|
||||
})
|
||||
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ return {
|
|||
window = {
|
||||
padding = 0,
|
||||
},
|
||||
hide = {
|
||||
cursorline = true,
|
||||
},
|
||||
render = function(props)
|
||||
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
|
||||
if filename == "" then
|
||||
|
|
|
|||
|
|
@ -1,3 +1,31 @@
|
|||
local buffers_without_inlay_hints = {}
|
||||
local function set_inlay_hints_active(buffers, enable)
|
||||
for _, bufnr in pairs(buffers) do
|
||||
vim.lsp.inlay_hint.enable(bufnr, enable)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_open_buffers_with_inlay_hints()
|
||||
local buffers = {}
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
local bufnr = vim.api.nvim_win_get_buf(win)
|
||||
if vim.lsp.inlay_hint.is_enabled(bufnr) then
|
||||
table.insert(buffers, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
return buffers
|
||||
end
|
||||
|
||||
local function add_leap_autocmd(pattern, callback)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = pattern,
|
||||
callback = function()
|
||||
callback()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
"ggandor/leap.nvim",
|
||||
dependencies = {
|
||||
|
|
@ -7,27 +35,26 @@ return {
|
|||
local leap = require("leap")
|
||||
leap.opts.safe_labels = {}
|
||||
|
||||
-- Hide the (real) cursor when leaping, and restore it afterwards.
|
||||
vim.api.nvim_create_autocmd(
|
||||
"User",
|
||||
local autocmds = {
|
||||
{
|
||||
pattern = "LeapEnter",
|
||||
callback = function()
|
||||
vim.cmd.hi("Cursor", "blend=100")
|
||||
vim.opt.guicursor:append { "a:Cursor/lCursor" }
|
||||
end,
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
"User",
|
||||
cb = function()
|
||||
local open_buffers = get_open_buffers_with_inlay_hints()
|
||||
set_inlay_hints_active(open_buffers, false)
|
||||
buffers_without_inlay_hints = open_buffers
|
||||
end
|
||||
},
|
||||
{
|
||||
pattern = "LeapLeave",
|
||||
callback = function()
|
||||
vim.cmd.hi("Cursor", "blend=0")
|
||||
vim.opt.guicursor:remove { "a:Cursor/lCursor" }
|
||||
end,
|
||||
}
|
||||
)
|
||||
cb = function()
|
||||
set_inlay_hints_active(buffers_without_inlay_hints, true)
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
for _, cmd in ipairs(autocmds) do
|
||||
add_leap_autocmd(cmd.pattern, cmd.cb)
|
||||
end
|
||||
|
||||
require("utils").add_keymaps({
|
||||
n = {
|
||||
|
|
|
|||
22
home/.config/nvim/lua/plugs/obsidian.lua
Normal file
22
home/.config/nvim/lua/plugs/obsidian.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*",
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
local scndbrn_path = vim.fn.has("unixmac") == 1 and
|
||||
"~/rp4-data/obsidian-vault/scndbrn" or
|
||||
"/mnt/rp4-data/obsidian-vault/scndbrn"
|
||||
require("obsidian").setup({
|
||||
workspaces = {
|
||||
{
|
||||
name = "scndbrn",
|
||||
path = scndbrn_path,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
@ -25,6 +25,29 @@ return {
|
|||
end,
|
||||
})
|
||||
end
|
||||
|
||||
require("utils").add_keymaps({
|
||||
n = {
|
||||
["gd"] = {
|
||||
cmd = function()
|
||||
vim.lsp.buf.definition()
|
||||
end,
|
||||
opts = {
|
||||
noremap = true,
|
||||
silent = true
|
||||
}
|
||||
},
|
||||
["gD"] = {
|
||||
cmd = function()
|
||||
vim.lsp.buf.declaration()
|
||||
end,
|
||||
opts = {
|
||||
noremap = true,
|
||||
silent = true
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
30
home/.config/nvim/lua/plugs/trouble.lua
Normal file
30
home/.config/nvim/lua/plugs/trouble.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
"folke/trouble.nvim",
|
||||
branch = "dev",
|
||||
opts = {},
|
||||
config = {
|
||||
|
||||
require("utils").add_keymaps({
|
||||
n = {
|
||||
-- ["<leader>xx"] = {
|
||||
-- cmd = "<cmd>Trouble diagnostics toggle<cr>",
|
||||
-- },
|
||||
-- ["<leader>xX"] = {
|
||||
-- cmd = "<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||
-- },
|
||||
-- ["<leader>cs"] = {
|
||||
-- cmd = "<cmd>Trouble symbols toggle focus=false<cr>",
|
||||
-- },
|
||||
-- ["<leader>cl"] = {
|
||||
-- cmd = "<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||
-- },
|
||||
-- ["<leader>xL"] = {
|
||||
-- cmd = "<cmd>Trouble loclist toggle<cr>",
|
||||
-- },
|
||||
-- ["<leader>xQ"] = {
|
||||
-- cmd = "<cmd>Trouble qflist toggle<cr>",
|
||||
-- },
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue