mirror of
https://github.com/macocianradu/setup.git
synced 2026-03-18 21:00:04 +00:00
added haskell dap and hoogle
This commit is contained in:
@@ -9,6 +9,7 @@ dap.listeners.after.event_exited["dapui_config"] = function() dapui.close() end
|
||||
|
||||
local dotnet = require("dap.dap-dotnet")
|
||||
local odoo = require("dap.dap-odoo")
|
||||
local haskell = require("dap.dap-haskell")
|
||||
|
||||
|
||||
vim.keymap.set("n", "<leader>5", function()
|
||||
|
||||
91
.config/nvim/after/plugin/hoogle.lua
Normal file
91
.config/nvim/after/plugin/hoogle.lua
Normal file
@@ -0,0 +1,91 @@
|
||||
local pickers = require("telescope.pickers")
|
||||
local finders = require("telescope.finders")
|
||||
local conf = require("telescope.config").values
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
|
||||
local function parse_query_mode(raw_query)
|
||||
local query = vim.trim(raw_query or "")
|
||||
if query:match("^text:%s*") then
|
||||
return "text", vim.trim((query:gsub("^text:%s*", "", 1)))
|
||||
end
|
||||
if query:match("^type:%s*") then
|
||||
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("=>")
|
||||
or query:match("[%[%]()%{%}]")
|
||||
or query:match("^%S+$")
|
||||
|
||||
return looks_like_type and "type" or "text", query
|
||||
end
|
||||
|
||||
local function hoogle_picker(query)
|
||||
if vim.fn.executable("hoogle") ~= 1 then
|
||||
vim.notify("hoogle not found in PATH", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
local mode, normalized_query = parse_query_mode(query)
|
||||
if normalized_query == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local cmd = { "hoogle", "--count=200" }
|
||||
if mode == "text" then
|
||||
table.insert(cmd, "--text")
|
||||
end
|
||||
table.insert(cmd, normalized_query)
|
||||
|
||||
local lines = vim.fn.systemlist(cmd)
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.notify("hoogle failed:\n" .. table.concat(lines, "\n"), vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
||||
local results = {}
|
||||
for _, line in ipairs(lines) do
|
||||
if line ~= "" and not line:match("^%d+ results found") then
|
||||
table.insert(results, line)
|
||||
end
|
||||
end
|
||||
|
||||
pickers.new({}, {
|
||||
prompt_title = ("Hoogle (%s): %s"):format(mode, normalized_query),
|
||||
finder = finders.new_table({ results = results, }),
|
||||
sorter = conf.generic_sorter({}),
|
||||
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)
|
||||
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)
|
||||
local query = opts.args ~= "" and opts.args or vim.fn.input("Hoogle > ")
|
||||
if query == "" then return end
|
||||
hoogle_picker(query)
|
||||
end, { nargs = "*" })
|
||||
|
||||
vim.keymap.set("n", "<leader>hh", function()
|
||||
vim.cmd("Hoogle " .. vim.fn.expand("<cword>"))
|
||||
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" })
|
||||
|
||||
@@ -8,6 +8,7 @@ vim.lsp.config("*", {
|
||||
vim.lsp.config("ruff", {})
|
||||
vim.lsp.config("cssls", {})
|
||||
vim.lsp.config("lua_ls", {})
|
||||
vim.lsp.config("hls", {})
|
||||
vim.lsp.config("roslyn", {})
|
||||
vim.lsp.config("odoo_ls", {
|
||||
cmd = {
|
||||
@@ -29,7 +30,7 @@ vim.lsp.config("eslint", {
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable({"odoo_ls", "ruff", "eslint", "cssls", "lua_ls", "lemminx"})
|
||||
vim.lsp.enable({"odoo_ls", "hls", "ruff", "eslint", "cssls", "lua_ls", "lemminx"})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('user_lsp_attach', { clear = true }),
|
||||
@@ -43,14 +44,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||
vim.keymap.set('n', '<leader>gi', function() vim.lsp.buf.implementation() end, opts)
|
||||
vim.keymap.set('n', '[d', function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts)
|
||||
vim.keymap.set('n', '<leader>vca', function()
|
||||
vim.lsp.buf.code_action({
|
||||
context = {
|
||||
diagnostics = vim.diagnostic.get(0),
|
||||
only = { 'quickfix', 'refactor', 'source' }
|
||||
}
|
||||
})
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<leader>vca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', '<leader>vrr', function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set('n', '<leader>vrn', function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set('i', '<C-h>', function() vim.lsp.buf.signature_help() end, opts)
|
||||
|
||||
1
.config/nvim/after/plugin/nvim-http.lua
Normal file
1
.config/nvim/after/plugin/nvim-http.lua
Normal file
@@ -0,0 +1 @@
|
||||
require("nvim_http").setup()
|
||||
@@ -1,6 +1,19 @@
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
|
||||
ensure_installed = { "vimdoc", "javascript", "typescript", "c_sharp", "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
|
||||
ensure_installed = {
|
||||
"vimdoc",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"c_sharp",
|
||||
"c",
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"yaml"
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
Reference in New Issue
Block a user