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 dotnet = require("dap.dap-dotnet")
|
||||||
local odoo = require("dap.dap-odoo")
|
local odoo = require("dap.dap-odoo")
|
||||||
|
local haskell = require("dap.dap-haskell")
|
||||||
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>5", function()
|
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("ruff", {})
|
||||||
vim.lsp.config("cssls", {})
|
vim.lsp.config("cssls", {})
|
||||||
vim.lsp.config("lua_ls", {})
|
vim.lsp.config("lua_ls", {})
|
||||||
|
vim.lsp.config("hls", {})
|
||||||
vim.lsp.config("roslyn", {})
|
vim.lsp.config("roslyn", {})
|
||||||
vim.lsp.config("odoo_ls", {
|
vim.lsp.config("odoo_ls", {
|
||||||
cmd = {
|
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', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('user_lsp_attach', { clear = true }),
|
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', '<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_next() end, opts)
|
||||||
vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts)
|
vim.keymap.set('n', ']d', function() vim.diagnostic.goto_prev() end, opts)
|
||||||
vim.keymap.set('n', '<leader>vca', function()
|
vim.keymap.set('n', '<leader>vca', vim.lsp.buf.code_action, opts)
|
||||||
vim.lsp.buf.code_action({
|
|
||||||
context = {
|
|
||||||
diagnostics = vim.diagnostic.get(0),
|
|
||||||
only = { 'quickfix', 'refactor', 'source' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set('n', '<leader>vrr', function() vim.lsp.buf.references() end, 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('n', '<leader>vrn', function() vim.lsp.buf.rename() end, opts)
|
||||||
vim.keymap.set('i', '<C-h>', function() vim.lsp.buf.signature_help() 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 {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
|
-- 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`)
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
|||||||
@@ -9,28 +9,28 @@
|
|||||||
"gitlinker.nvim": { "branch": "master", "commit": "bbe2a1254fc8fce21f3bbf9a020266a1c49799f7" },
|
"gitlinker.nvim": { "branch": "master", "commit": "bbe2a1254fc8fce21f3bbf9a020266a1c49799f7" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" },
|
"gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" },
|
||||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||||
|
"hererocks": { "branch": "master", "commit": "3db37265c3839cbd4d27fc73f92fa7b58bc3a76f" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||||
"markview.nvim": { "branch": "main", "commit": "9e852c299351fc2110e763edc7fc899358ee112e" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "a324581a3c83fdacdb9804b79de1cbe00ce18550" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "21c2a84ce368e99b18f52ab348c4c02c32c02fcf" },
|
|
||||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||||
"mini.icons": { "branch": "main", "commit": "68c178e0958d95b3977a771f3445429b1bded985" },
|
"mini.icons": { "branch": "main", "commit": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" },
|
||||||
"neogit": { "branch": "master", "commit": "22433eae87236c217e0810c836fa5e529c043d4c" },
|
"neogit": { "branch": "master", "commit": "515e8cb9c3430a064ec3d9affd499b94f71b3120" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "db321947bb289a2d4d76a32e76e4d2bd6103d7df" },
|
"nvim-dap": { "branch": "master", "commit": "b516f20b487b0ac6a281e376dfac1d16b5040041" },
|
||||||
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
|
"nvim-dap-python": { "branch": "master", "commit": "1808458eba2b18f178f990e01376941a42c7f93b" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" },
|
"nvim-lspconfig": { "branch": "master", "commit": "ead0f5f342d8d323441e7d4b88f0fc436a81ad5f" },
|
||||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||||
"nvim-scrollbar": { "branch": "main", "commit": "f8e87b96cd6362ef8579be456afee3b38fd7e2a8" },
|
"nvim-scrollbar": { "branch": "main", "commit": "f8e87b96cd6362ef8579be456afee3b38fd7e2a8" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
|
"nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" },
|
||||||
"odoo-neovim": { "branch": "main", "commit": "882aeb9bc0d6302cb99aa1235abe4820532fd416" },
|
"odoo-neovim": { "branch": "main", "commit": "882aeb9bc0d6302cb99aa1235abe4820532fd416" },
|
||||||
"oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" },
|
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
|
||||||
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
"render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" },
|
"render-markdown.nvim": { "branch": "main", "commit": "1c958131c083c8557ea499fdb08c88b8afb05c4e" },
|
||||||
"roslyn.nvim": { "branch": "main", "commit": "56c421a02451cc61c8d63cfe9dc2079453e1ea6d" },
|
"roslyn.nvim": { "branch": "main", "commit": "7deb9bb5b6afcb3c03c70741c6d364ffd8b59bda" },
|
||||||
"smear-cursor.nvim": { "branch": "main", "commit": "c85bdbb25db096fbcf616bc4e1357bd61fe2c199" },
|
"smear-cursor.nvim": { "branch": "main", "commit": "c85bdbb25db096fbcf616bc4e1357bd61fe2c199" },
|
||||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ local M = {}
|
|||||||
-- Adapter (netcoredbg)
|
-- Adapter (netcoredbg)
|
||||||
dap.adapters.coreclr = {
|
dap.adapters.coreclr = {
|
||||||
type = "executable",
|
type = "executable",
|
||||||
command = vim.fn.stdpath("data") .. "/mason/packages/netcoredbg/netcoredbg",
|
command = "/Users/radumaco/Projects/netcoredbg/build/src/netcoredbg",
|
||||||
args = { "--interpreter=vscode" },
|
args = { "--interpreter=vscode" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
25
.config/nvim/lua/dap/dap-haskell.lua
Normal file
25
.config/nvim/lua/dap/dap-haskell.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
local dap = require("dap")
|
||||||
|
|
||||||
|
dap.adapters["haskell-debugger"] = {
|
||||||
|
type = "server",
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
command = "hdb",
|
||||||
|
args = {
|
||||||
|
"server", "--port", "${port}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dap.configurations.haskell = {
|
||||||
|
{
|
||||||
|
type = "haskell-debugger",
|
||||||
|
request = "launch",
|
||||||
|
name = "hdb:file:main",
|
||||||
|
entryFile = "${file}",
|
||||||
|
entryPoint = "main",
|
||||||
|
projectRoot = "${workspaceFolder}",
|
||||||
|
entryArgs = {},
|
||||||
|
extraGhcArgs = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -41,16 +41,6 @@ require("lazy").setup({
|
|||||||
"MeanderingProgrammer/render-markdown.nvim",
|
"MeanderingProgrammer/render-markdown.nvim",
|
||||||
ft = { "markdown", "codecompanion" }
|
ft = { "markdown", "codecompanion" }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"OXY2DEV/markview.nvim",
|
|
||||||
lazy = false,
|
|
||||||
opts = {
|
|
||||||
preview = {
|
|
||||||
filetypes = { "markdown", "codecompanion" },
|
|
||||||
ignore_buftypes = {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"olimorris/codecompanion.nvim",
|
"olimorris/codecompanion.nvim",
|
||||||
version = "^18.0.0",
|
version = "^18.0.0",
|
||||||
@@ -60,6 +50,15 @@ require("lazy").setup({
|
|||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name = "nvim-http",
|
||||||
|
dir = "~/Projects/nvim-http",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
},
|
||||||
|
build = "rockspec",
|
||||||
|
},
|
||||||
'tpope/vim-surround',
|
'tpope/vim-surround',
|
||||||
'seblyng/roslyn.nvim',
|
'seblyng/roslyn.nvim',
|
||||||
'nvim-telescope/telescope-ui-select.nvim',
|
'nvim-telescope/telescope-ui-select.nvim',
|
||||||
@@ -129,6 +128,9 @@ require("lazy").setup({
|
|||||||
-- colorscheme that will be used when installing plugins.
|
-- colorscheme that will be used when installing plugins.
|
||||||
install = { colorscheme = { "everforest" } },
|
install = { colorscheme = { "everforest" } },
|
||||||
-- automatically check for plugin updates
|
-- automatically check for plugin updates
|
||||||
|
rocks = {
|
||||||
|
hererocks = true
|
||||||
|
},
|
||||||
checker = {
|
checker = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
frequency = 86400
|
frequency = 86400
|
||||||
|
|||||||
Reference in New Issue
Block a user