chore(nvim): obsidian, oil, markdown, fzf-lua, lsp visual code actions

This commit is contained in:
Afonso Franco 2024-10-20 01:40:32 +01:00
parent 64ccf8befe
commit 03622a3c5c
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
6 changed files with 117 additions and 22 deletions

View file

@ -108,6 +108,16 @@ return {
}, {
{ name = "buffer", keyword_length = 5 },
}),
window = {
completion = {
border = "rounded",
winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None",
},
documentation = {
border = "rounded",
winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None",
},
}
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")

View file

@ -22,4 +22,34 @@ return {
})
end,
},
{
"epwalsh/obsidian.nvim",
version = "v3.9.0",
lazy = true,
ft = "markdown",
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = {
workspaces = {
{
name = "tese",
path = "~/vaults/uni/tese/",
},
{
name = "chronolens",
path = "~/vaults/uni/chronolens/",
},
},
completion = {
nvim_cmp = true,
min_chars = 2,
},
picker = {
name = "fzf-lua",
},
},
}
}

View file

@ -8,7 +8,6 @@ return {
fzflua.register_ui_select()
fzflua.setup({
defaults = {
headers = false,
winopts = {
border = "single",
width = 0.6,
@ -19,7 +18,7 @@ return {
previewer = false,
winopts = {
width = 0.5,
height = 0.3,
height = 0.5,
}
},
grep = {
@ -37,6 +36,7 @@ return {
vim.keymap.set('n', '<leader>fg', fzflua.live_grep, {})
vim.keymap.set('n', '<leader>fb', fzflua.buffers, {})
vim.keymap.set('n', '<leader>fh', fzflua.help_tags, {})
vim.keymap.set({'n','v'}, '<leader>fc', fzflua.commands, {})
end
}
}

View file

@ -199,7 +199,7 @@ return {
vim.keymap.set("n", "<space>k", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<space>rn", rename_func, bufopts_expr)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set({"n","v"}, "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<space>ge", vim.diagnostic.goto_next, bufopts)
vim.keymap.set("n", "<space>gE", vim.diagnostic.goto_prev, bufopts)
vim.keymap.set("n", "<space>fo", function() conform.format({ lsp_fallback = true }) end, bufopts)

View file

@ -18,8 +18,64 @@ return {
},
{
"stevearc/oil.nvim",
opts = {},
config = function()
require("oil").setup({
float = {
preview_split = "right"
},
})
-- Function to open oil.nvim in a vertical split
local function open_oil_split()
-- Calculate the width for the split (20% of the total width)
local width = math.floor(vim.o.columns * 0.2) -- 20% of total width
-- Create a vertical split and set width
vim.cmd("vsplit") -- Create a vertical split
vim.cmd(string.format("vertical resize %d", width)) -- Resize to 20%
-- Open oil in the new split
require("oil").open() -- Use open() to open oil.nvim
end
-- Key mapping to open oil in a vertical split
vim.api.nvim_set_keymap('n', '<leader>o', ':lua require("oil").open_float()<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<leader>O', open_oil_split, { noremap = true, silent = true })
end
},
-- {
-- 'echasnovski/mini.files',
-- version = false,
-- opts = {
-- mappings = {
-- close = 'q',
-- go_in = '',
-- go_in_plus = 'l',
-- go_out = '<CR>',
-- go_out_plus = 'h',
-- reset = '<BS>',
-- show_help = 'g?',
-- synchronize = 's',
-- },
-- options = {
-- permanent_delete = false
-- }
-- },
-- keys = {
-- {
-- "<leader>o",
-- function()
-- require("mini.files").open(vim.api.nvim_buf_get_name(0), true)
-- end,
-- desc = "Open mini.files (Directory of the current file)"
-- },
-- {
-- "<leader>O",
-- function()
-- require("mini.files").open(vim.uv.cwd(), true)
-- end,
-- desc = "Open mini.files (cwd)"
-- }
-- }
-- },
{
'mrjones2014/smart-splits.nvim',
config = function()

View file

@ -24,24 +24,23 @@ return {
event = "VeryLazy",
ft = 'qf'
},
{
"OXY2DEV/markview.nvim",
ft = "markdown",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
opts = {
modes = { "n", "no", "i", "c" },
hybrid_modes = { "i" },
callbacks = {
on_enable = function(_, win)
vim.wo[win].conceallevel = 2;
vim.wo[win].concealcursor = "c";
end
}
}
},
-- {
-- "OXY2DEV/markview.nvim",
-- ft = "markdown",
-- dependencies = {
-- "nvim-treesitter/nvim-treesitter",
-- "nvim-tree/nvim-web-devicons",
-- },
-- opts = {
-- modes = { "n", "no", "c" },
-- callbacks = {
-- on_enable = function(_, win)
-- vim.wo[win].conceallevel = 2;
-- vim.wo[win].concealcursor = "c";
-- end
-- }
-- }
-- },
{
"folke/zen-mode.nvim",
event = "VeryLazy",