mirror of
https://github.com/macocianradu/setup.git
synced 2026-07-16 10:38:46 +00:00
Compare commits
4 Commits
ec08eedea9
...
483b04ed68
| Author | SHA1 | Date | |
|---|---|---|---|
| 483b04ed68 | |||
| 12db5d84f4 | |||
| 802cc1dcfc | |||
| dc35a0b460 |
@@ -48,4 +48,5 @@ require('gitsigns').setup {
|
||||
},
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>gb', ':Gitsigns blame_line<CR>', { desc = '[G]it [B]lame' })
|
||||
vim.keymap.set('n', '<leader>gb', ':Gitsigns blame_line<CR>', { desc = '[G]it [B]lame line' })
|
||||
vim.keymap.set('n', '<leader>gB', ':Gitsigns blame<CR>', { desc = '[G]it [B]lame' })
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local conf = require("telescope.config").values
|
||||
local previewers = require("telescope.previewers")
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
|
||||
local STOP_WORDS = {
|
||||
["a"] = true,
|
||||
["an"] = true,
|
||||
@@ -35,9 +28,6 @@ local function parse_query_mode(raw_query)
|
||||
return "type", vim.trim((query:gsub("^type:%s*", "", 1)))
|
||||
end
|
||||
|
||||
-- Heuristic:
|
||||
-- - Queries that look like signatures/operators stay in type mode.
|
||||
-- - Everything else defaults to text mode so plain-language search works.
|
||||
local looks_like_type = query:match("::")
|
||||
or query:match("->")
|
||||
or query:match("=>")
|
||||
@@ -169,8 +159,8 @@ local function hoogle_picker(query)
|
||||
return
|
||||
end
|
||||
|
||||
local results = {}
|
||||
for _, entry in ipairs(decoded) do
|
||||
local items = {}
|
||||
for idx, entry in ipairs(decoded) do
|
||||
local signature = entry.item or ""
|
||||
local docs = entry.docs or ""
|
||||
local url = entry.url
|
||||
@@ -185,7 +175,9 @@ local function hoogle_picker(query)
|
||||
display = display .. " - " .. docs_one_line
|
||||
end
|
||||
|
||||
table.insert(results, {
|
||||
table.insert(items, {
|
||||
idx = idx,
|
||||
text = signature .. " " .. (docs or ""),
|
||||
signature = signature,
|
||||
docs = docs,
|
||||
url = url,
|
||||
@@ -193,54 +185,36 @@ local function hoogle_picker(query)
|
||||
})
|
||||
end
|
||||
|
||||
pickers.new({}, {
|
||||
prompt_title = ("Hoogle (%s): %s"):format(mode, normalized_query),
|
||||
finder = finders.new_table({
|
||||
results = results,
|
||||
entry_maker = function(entry)
|
||||
return {
|
||||
value = entry,
|
||||
display = entry.display,
|
||||
ordinal = entry.signature .. " " .. (entry.docs or ""),
|
||||
}
|
||||
Snacks.picker.pick({
|
||||
source = "hoogle",
|
||||
title = ("Hoogle (%s): %s"):format(mode, normalized_query),
|
||||
items = items,
|
||||
format = function(item)
|
||||
return { { item.display, "SnacksPickerLabel" } }
|
||||
end,
|
||||
}),
|
||||
sorter = conf.generic_sorter({}),
|
||||
previewer = previewers.new_buffer_previewer({
|
||||
define_preview = function(self, entry)
|
||||
local value = entry.value or {}
|
||||
local preview_lines = { value.signature or "" }
|
||||
|
||||
if value.docs and value.docs ~= "" then
|
||||
table.insert(preview_lines, "")
|
||||
vim.list_extend(preview_lines, vim.split(value.docs, "\n", { plain = true }))
|
||||
preview = function(ctx)
|
||||
local item = ctx.item
|
||||
local lines = { item.signature or "" }
|
||||
if item.docs and item.docs ~= "" then
|
||||
table.insert(lines, "")
|
||||
vim.list_extend(lines, vim.split(item.docs, "\n", { plain = true }))
|
||||
else
|
||||
table.insert(preview_lines, "")
|
||||
table.insert(preview_lines, "No documentation available.")
|
||||
table.insert(lines, "")
|
||||
table.insert(lines, "No documentation available.")
|
||||
end
|
||||
|
||||
if value.url and value.url ~= "" then
|
||||
table.insert(preview_lines, "")
|
||||
table.insert(preview_lines, value.url)
|
||||
if item.url and item.url ~= "" then
|
||||
table.insert(lines, "")
|
||||
table.insert(lines, item.url)
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, preview_lines)
|
||||
vim.api.nvim_buf_set_lines(ctx.buf, 0, -1, false, lines)
|
||||
end,
|
||||
}),
|
||||
attach_mappings = function(prompt_bufnr, map)
|
||||
local function open_result()
|
||||
local selection = action_state.get_selected_entry()
|
||||
actions.close(prompt_bufnr)
|
||||
if selection and selection.value and selection.value.url then
|
||||
vim.ui.open(selection.value.url)
|
||||
confirm = function(picker, item)
|
||||
picker:close()
|
||||
if item and item.url then
|
||||
vim.ui.open(item.url)
|
||||
end
|
||||
end
|
||||
|
||||
map("i", "<CR>", open_result)
|
||||
map("n", "<CR>", open_result)
|
||||
return true
|
||||
end,
|
||||
}):find()
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("Hoogle", function(opts)
|
||||
@@ -256,4 +230,3 @@ end, { desc = "Hoogle current word" })
|
||||
vim.keymap.set("n", "<leader>ht", function()
|
||||
vim.cmd("Hoogle " .. vim.fn.input("Hoogle type/text > "))
|
||||
end, { desc = "Hoogle query" })
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
callback = function(event)
|
||||
local opts = { buffer = event.buf }
|
||||
|
||||
vim.keymap.set('n', 'gd', function() require('telescope.builtin').lsp_definitions() end, opts)
|
||||
vim.keymap.set('n', 'gd', function() Snacks.picker.lsp_definitions() end, opts)
|
||||
vim.keymap.set('n', 'K', function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set('n', '<leader>vws', function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set('n', '<leader>vd', function() vim.diagnostic.open_float() end, opts)
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
require('mason').setup {}
|
||||
require("mason-lspconfig").setup {
|
||||
ensure_installed = { "lua_ls",
|
||||
"cssls",
|
||||
"eslint" },
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
local neogit = require('neogit')
|
||||
|
||||
vim.keymap.set("n", "<leader>gs", function()
|
||||
neogit.open()
|
||||
neogit.open({ kind= "floating" })
|
||||
end
|
||||
)
|
||||
|
||||
@@ -18,5 +18,73 @@ require("snacks").setup {
|
||||
enabled = true,
|
||||
char = "│"
|
||||
}
|
||||
},
|
||||
picker = {
|
||||
enabled = true,
|
||||
ui_select = true,
|
||||
formatters = {
|
||||
file = {
|
||||
truncate = "left",
|
||||
min_width = 160,
|
||||
},
|
||||
},
|
||||
},
|
||||
dashboard = {
|
||||
enabled = true,
|
||||
},
|
||||
terminal = {
|
||||
enabled = true,
|
||||
},
|
||||
}
|
||||
|
||||
local picker = Snacks.picker
|
||||
vim.keymap.set('n', '<leader>pf', function() picker.files() end)
|
||||
vim.keymap.set('n', '<C-p>p', function() picker.git_files() end)
|
||||
vim.keymap.set('n', '<leader>sw', function() picker.lsp_workspace_symbols() end)
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
picker.grep({ search = vim.fn.input("Grep > "), live = false })
|
||||
end)
|
||||
|
||||
local term_buf
|
||||
|
||||
local function find_term_win()
|
||||
if not (term_buf and vim.api.nvim_buf_is_valid(term_buf)) then return end
|
||||
for _, w in ipairs(vim.api.nvim_list_wins()) do
|
||||
if vim.api.nvim_win_get_buf(w) == term_buf then return w end
|
||||
end
|
||||
end
|
||||
|
||||
local function toggle_term(fullscreen)
|
||||
local win_opts = fullscreen and {
|
||||
position = "float",
|
||||
width = 0.98,
|
||||
height = 0.98,
|
||||
border = "rounded",
|
||||
} or {
|
||||
position = "bottom",
|
||||
height = 0.2,
|
||||
border = "none",
|
||||
}
|
||||
|
||||
local existing = find_term_win()
|
||||
if existing then
|
||||
local is_float = vim.api.nvim_win_get_config(existing).relative ~= ""
|
||||
vim.api.nvim_win_close(existing, true)
|
||||
if is_float == fullscreen then return end
|
||||
end
|
||||
|
||||
if term_buf and vim.api.nvim_buf_is_valid(term_buf) then
|
||||
Snacks.win(vim.tbl_extend("force", win_opts, {
|
||||
buf = term_buf,
|
||||
enter = true,
|
||||
bo = { filetype = "snacks_terminal" },
|
||||
}))
|
||||
vim.cmd.startinsert()
|
||||
else
|
||||
local term = Snacks.terminal.toggle(nil, { win = win_opts })
|
||||
if term then term_buf = term.buf end
|
||||
end
|
||||
end
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<leader>tt", function() toggle_term(false) end, { desc = "Terminal (split)" })
|
||||
vim.keymap.set({ "n", "t" }, "<leader>tT", function() toggle_term(true) end, { desc = "Terminal (fullscreen)" })
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
require('telescope').setup {
|
||||
extensions = {
|
||||
["ui_select"] = {
|
||||
require('telescope.themes').get_dropdown {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
require('telescope').load_extension('ui-select')
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>p', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>sw', '<cmd>Telescope lsp_workspace_symbols<cr>', {})
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") });
|
||||
end)
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"codecompanion-history.nvim": { "branch": "main", "commit": "bc1b4fe06eaaf0aa2399be742e843c22f7f1652a" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "558518f8d78a44198cd428f6bf8bf48bfa38d76d" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "62a10d9d55132b338dd742afc3c8a2683f3dd426" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"everforest-nvim": { "branch": "main", "commit": "cf08aa67fc96946a01177ae483b7631733b4b5e6" },
|
||||
"gitlinker.nvim": { "branch": "master", "commit": "d7adb5e4ba5bab4fd443a3f4c46af3f4c864685d" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "8d82c240f190fc33723d48c308ccc1ed8baad69d" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "8811f3f3f4dc09d740c67e9ce399e7a541e2e5b2" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "63a3c6a80538de1003373a619e29aeda27809ad3" },
|
||||
"mason.nvim": { "branch": "main", "commit": "b03fb0f20bc1d43daf558cda981a2be22e73ac42" },
|
||||
"mini.icons": { "branch": "main", "commit": "7fdae2443a0e2910015ca39ad74b50524ee682d3" },
|
||||
"neogit": { "branch": "master", "commit": "e06745228600a585b88726fc9fba44a373c15a47" },
|
||||
"nord.nvim": { "branch": "master", "commit": "80c1e5321505aeb22b7a9f23eb82f1e193c12470" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
|
||||
"nvim-dap": { "branch": "master", "commit": "45a69eba683a2c448dd9ecfc4de89511f0646b5f" },
|
||||
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-scrollbar": { "branch": "main", "commit": "f8e87b96cd6362ef8579be456afee3b38fd7e2a8" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "95b7a002d5dba1a42eb58f5fac5c565a485eefd0" },
|
||||
"odoo-neovim": { "branch": "main", "commit": "6ea306ebcdfa1ee13524c05757f5e739cb2e8001" },
|
||||
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "54d4b5431e9634ee3d8d30784e017239b5b89d41" },
|
||||
"smear-cursor.nvim": { "branch": "main", "commit": "c85bdbb25db096fbcf616bc4e1357bd61fe2c199" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" },
|
||||
"strudel.nvim": { "branch": "main", "commit": "a6b9752b0084a20c37786b54eef2095bb31daff7" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "7ef4d6dccb78ee71e552bbd866176762ad328afa" },
|
||||
"tidal.nvim": { "branch": "develop", "commit": "bcc9679a1932cfa2f75a38ddf3af18ed344da1fe" },
|
||||
"undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" },
|
||||
"vim-projectionist": { "branch": "master", "commit": "5ff7bf79a6ef741036d2038a226bcb5f8b1cd296" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }
|
||||
}
|
||||
@@ -18,10 +18,6 @@ vim.opt.rtp:prepend(lazypath)
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||
},
|
||||
{
|
||||
'neanias/everforest-nvim',
|
||||
config = function()
|
||||
@@ -92,7 +88,6 @@ require("lazy").setup({
|
||||
},
|
||||
},
|
||||
'tpope/vim-surround',
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
'sphamba/smear-cursor.nvim',
|
||||
{
|
||||
"folke/persistence.nvim",
|
||||
@@ -123,24 +118,13 @@ require("lazy").setup({
|
||||
"folke/snacks.nvim",
|
||||
'lewis6991/gitsigns.nvim',
|
||||
'tpope/vim-projectionist',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
{
|
||||
"NeogitOrg/neogit",
|
||||
dependencies = {
|
||||
"sindrets/diffview.nvim", -- optional - Diff integration
|
||||
"sindrets/diffview.nvim",
|
||||
},
|
||||
config = true
|
||||
},
|
||||
{
|
||||
'nvimdev/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
require('dashboard').setup {
|
||||
-- config
|
||||
}
|
||||
end,
|
||||
dependencies = { { 'nvim-tree/nvim-web-devicons' } }
|
||||
},
|
||||
'neovim/nvim-lspconfig',
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
@@ -157,8 +141,7 @@ require("lazy").setup({
|
||||
opts = {},
|
||||
keys = {
|
||||
{ "<leader>gy", "<cmd>GitLink<cr>", mode = { "n", "v" }, desc = "Yank git link" },
|
||||
{ "<leader>gY", "<cmd>GitLink!<cr>", mode = { "n", "v" }, desc = "Open git link" },
|
||||
{ "<leader>gB", "<cmd>GitLink! blame<cr>", mode = { "n", "v" }, desc = "Open git blame link" },
|
||||
{ "<leader>gY", "<cmd>GitLink! blame<cr>", mode = { "n", "v" }, desc = "Open git blame link" },
|
||||
},
|
||||
},
|
||||
'hrsh7th/cmp-buffer',
|
||||
|
||||
@@ -3,8 +3,6 @@ vim.keymap.set("n", "<leader>pv", function ()
|
||||
require("oil").toggle_float()
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<leader>u", ":UndotreeShow<CR>")
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user