mirror of
https://github.com/macocianradu/setup.git
synced 2026-07-16 10:38:46 +00:00
Compare commits
7 Commits
odoo
..
483b04ed68
| Author | SHA1 | Date | |
|---|---|---|---|
| 483b04ed68 | |||
| 12db5d84f4 | |||
| 802cc1dcfc | |||
| dc35a0b460 | |||
| ec08eedea9 | |||
| 9abd126c37 | |||
| 39bcb18f3e |
@@ -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" })
|
||||
|
||||
|
||||
@@ -4,18 +4,37 @@ capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
vim.lsp.config("*", {
|
||||
capabilities = capabilities
|
||||
})
|
||||
-- vim.lsp.config("ts_ls", {})
|
||||
|
||||
local project_library_path = vim.fn.getcwd() .. '/node_modules'
|
||||
local angular_cmd = {
|
||||
'ngserver',
|
||||
'--stdio',
|
||||
'--tsProbeLocations',
|
||||
project_library_path,
|
||||
'--ngProbeLocations',
|
||||
project_library_path .. '@angular/language-server'
|
||||
}
|
||||
|
||||
vim.lsp.config("ts_ls", {})
|
||||
vim.lsp.config("angularls", {
|
||||
cmd = angular_cmd,
|
||||
on_new_config = function(new_config, new_root_dir)
|
||||
new_config.cmd = angular_cmd
|
||||
end
|
||||
})
|
||||
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 = {
|
||||
vim.fn.expand('$HOME/.local/share/nvim/odoo/odoo_ls_server'),
|
||||
'--config-path', vim.fn.expand('$HOME/projects/odoo/odools.toml'),
|
||||
}
|
||||
})
|
||||
vim.lsp.config("qmlls", {
|
||||
cmd = { "qmlls6", "-E" }
|
||||
})
|
||||
vim.lsp.config("lemminx", {})
|
||||
vim.lsp.config("eslint", {
|
||||
cmd = { "vscode-eslint-language-server", "--stdio" },
|
||||
@@ -30,14 +49,14 @@ vim.lsp.config("eslint", {
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable({"odoo_ls", "hls", "ruff", "eslint", "cssls", "lua_ls", "lemminx"})
|
||||
vim.lsp.enable({ "angularls", "odoo_ls", "hls", "ruff", "eslint", "cssls", "lua_ls", "lemminx", "qmlls" })
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('user_lsp_attach', { clear = true }),
|
||||
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,6 +1,8 @@
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
|
||||
ensure_installed = {
|
||||
local ts = require('nvim-treesitter')
|
||||
|
||||
ts.setup{}
|
||||
|
||||
ts.install({
|
||||
"vimdoc",
|
||||
"javascript",
|
||||
"typescript",
|
||||
@@ -12,40 +14,29 @@ require 'nvim-treesitter.configs'.setup {
|
||||
"query",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"yaml"
|
||||
},
|
||||
"yaml",
|
||||
"haskell"
|
||||
})
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
callback = function(ev)
|
||||
local lang = vim.treesitter.language.get_lang(ev.match)
|
||||
local available_langs = ts.get_available()
|
||||
local is_available = vim.tbl_contains(available_langs, lang)
|
||||
if is_available then
|
||||
local installed_langs = ts.get_installed()
|
||||
local installed = vim.tbl_contains(installed_langs, lang)
|
||||
if not installed then
|
||||
ts.install(lang):await()
|
||||
end
|
||||
vim.treesitter.start()
|
||||
ts.indentexpr()
|
||||
end
|
||||
vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
vim.wo[0][0].foldmethod = 'expr'
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end,
|
||||
})
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
disable = { "xml", "python" },
|
||||
},
|
||||
|
||||
fold = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.foldlevelstart = 99
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldlevelstart = 99
|
||||
|
||||
@@ -5,7 +5,7 @@ local M = {}
|
||||
-- Adapter (netcoredbg)
|
||||
dap.adapters.coreclr = {
|
||||
type = "executable",
|
||||
command = "/Users/radumaco/Projects/netcoredbg/build/src/netcoredbg",
|
||||
command = "/home/radu/.local/share/nvim/mason/bin/netcoredbg",
|
||||
args = { "--interpreter=vscode" },
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ local function debug_dotnet_from_sln()
|
||||
env = {
|
||||
ASPNETCORE_ENVIRONMENT = "Development",
|
||||
DOTNET_ENVIRONMENT = "Development",
|
||||
ASPNETCORE_URLS = "https://localhost:7045;http://localhost:5000",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
@@ -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()
|
||||
@@ -61,7 +57,11 @@ require("lazy").setup({
|
||||
},
|
||||
},
|
||||
'odoo/odoo-neovim',
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
lazy = false,
|
||||
build = ':TSUpdate'
|
||||
},
|
||||
{
|
||||
'theprimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
@@ -76,7 +76,11 @@ require("lazy").setup({
|
||||
{
|
||||
"olimorris/codecompanion.nvim",
|
||||
version = "^18.0.0",
|
||||
opts = {},
|
||||
opts = {
|
||||
opts = {
|
||||
log_level = "TRACE",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
@@ -84,7 +88,6 @@ require("lazy").setup({
|
||||
},
|
||||
},
|
||||
'tpope/vim-surround',
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
'sphamba/smear-cursor.nvim',
|
||||
{
|
||||
"folke/persistence.nvim",
|
||||
@@ -115,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',
|
||||
@@ -149,12 +141,12 @@ 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',
|
||||
'hrsh7th/nvim-cmp',
|
||||
'seblyng/roslyn.nvim',
|
||||
'L3MON4D3/LuaSnip',
|
||||
{
|
||||
'mfussenegger/nvim-dap-python',
|
||||
|
||||
@@ -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