chore: save config
This commit is contained in:
parent
1b26f91faa
commit
dc228a038b
99
init.lua
99
init.lua
|
@ -42,6 +42,7 @@ P.S. You can delete this when you're done too. It's your config now :)
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
vim.opt.textwidth = 80
|
||||||
-- Install package manager
|
-- Install package manager
|
||||||
-- https://github.com/folke/lazy.nvim
|
-- https://github.com/folke/lazy.nvim
|
||||||
-- `:help lazy.nvim.txt` for more info
|
-- `:help lazy.nvim.txt` for more info
|
||||||
|
@ -218,6 +219,10 @@ vim.o.smartcase = true
|
||||||
-- Keep signcolumn on by default
|
-- Keep signcolumn on by default
|
||||||
vim.wo.signcolumn = 'yes'
|
vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Cursor UI
|
||||||
|
vim.opt.cursorline = true
|
||||||
|
-- vim.opt.guicursor = "i:block-blinkwait1000-blinkon500-blinkoff500";
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.o.updatetime = 100
|
vim.o.updatetime = 100
|
||||||
vim.o.timeoutlen = 100
|
vim.o.timeoutlen = 100
|
||||||
|
@ -229,7 +234,6 @@ vim.o.completeopt = 'menuone,noselect'
|
||||||
-- NOTE: You should make sure your terminal supports this
|
-- NOTE: You should make sure your terminal supports this
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
|
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
|
|
||||||
-- Keymaps for better default experience
|
-- Keymaps for better default experience
|
||||||
|
@ -240,6 +244,7 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
|
||||||
|
|
||||||
-- [[ Highlight on yank ]]
|
-- [[ Highlight on yank ]]
|
||||||
-- See `:help vim.highlight.on_yank()`
|
-- See `:help vim.highlight.on_yank()`
|
||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||||
|
@ -269,8 +274,8 @@ vim.filetype.add({
|
||||||
-- See `:help nvim-treesitter`
|
-- See `:help nvim-treesitter`
|
||||||
require('nvim-treesitter.configs').setup {
|
require('nvim-treesitter.configs').setup {
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
|
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'ruby',
|
||||||
'dart', 'prisma', 'graphql', 'json', 'markdown' },
|
'dart', 'prisma', 'graphql', 'json', 'markdown', 'kotlin', 'terraform' },
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
auto_install = false,
|
auto_install = false,
|
||||||
|
@ -335,6 +340,10 @@ require('nvim-treesitter.configs').setup {
|
||||||
|
|
||||||
vim.api.nvim_set_keymap('i', 'kj', '<ESC>', { noremap = true })
|
vim.api.nvim_set_keymap('i', 'kj', '<ESC>', { noremap = true })
|
||||||
|
|
||||||
|
-- Git
|
||||||
|
vim.keymap.set('n', '<leader>Go', '<Cmd>GitConflictChooseOurs<CR>', { desc = '[G]it Conflict Choose [o]urs' })
|
||||||
|
vim.keymap.set('n', '<leader>Gt', '<Cmd>GitConflictChooseTheirs<CR>', { desc = '[G]it Conflict Choose [t]heirs' })
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||||
|
@ -353,7 +362,7 @@ vim.keymap.set("n", "<leader>vs", "<Cmd>vs<CR>", { desc = "[V]ertical [S]plit" }
|
||||||
vim.keymap.set("n", "<leader>s", '<Cmd>w<CR>', { desc = "[S]ave file" })
|
vim.keymap.set("n", "<leader>s", '<Cmd>w<CR>', { desc = "[S]ave file" })
|
||||||
|
|
||||||
-- Quit from terminal
|
-- Quit from terminal
|
||||||
vim.api.nvim_set_keymap('t', '<Leader><ESC>', '<C-\\><C-n>', { noremap = true })
|
-- vim.api.nvim_set_keymap('t', '<Leader><ESC>', '<C-\\><C-n>', { noremap = true })
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
local on_attach = function(_, bufnr)
|
local on_attach = function(_, bufnr)
|
||||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||||
|
@ -371,7 +380,7 @@ local on_attach = function(_, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
nmap('<leader>c', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||||
|
|
||||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
@ -411,10 +420,12 @@ local servers = {
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
-- pyright = {},
|
||||||
-- rust_analyzer = {}
|
-- rust_analyzer = {}
|
||||||
tsserver = {},
|
ts_ls = {},
|
||||||
prismals = {},
|
prismals = {},
|
||||||
graphql = {},
|
graphql = {},
|
||||||
clangd = {},
|
clangd = {},
|
||||||
|
terraformls = {},
|
||||||
|
kotlin_language_server = {},
|
||||||
-- prettierd = {},
|
-- prettierd = {},
|
||||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} }
|
-- html = { filetypes = { 'html', 'twig', 'hbs'} }
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
|
@ -471,23 +482,77 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Ensure the servers above are installed
|
-- Ensure the servers above are installed
|
||||||
local mason_lspconfig = require 'mason-lspconfig'
|
local mason_lspconfig = require('mason-lspconfig')
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
mason_lspconfig.setup {
|
mason_lspconfig.setup {
|
||||||
ensure_installed = vim.tbl_keys(servers),
|
ensure_installed = vim.tbl_keys(servers),
|
||||||
|
automatic_enable = false
|
||||||
}
|
}
|
||||||
|
|
||||||
mason_lspconfig.setup_handlers {
|
-- mason_lspconfig.setup_handlers {
|
||||||
function(server_name)
|
-- function(server_name)
|
||||||
lspconfig[server_name].setup {
|
-- lspconfig[server_name].setup {
|
||||||
capabilities = capabilities,
|
-- capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
-- on_attach = on_attach,
|
||||||
settings = servers[server_name],
|
-- settings = servers[server_name],
|
||||||
filetypes = (servers[server_name] or {}).filetypes,
|
-- filetypes = (servers[server_name] or {}).filetypes,
|
||||||
}
|
-- automatic_enable = false
|
||||||
end
|
-- }
|
||||||
}
|
-- end
|
||||||
|
-- }
|
||||||
|
|
||||||
|
lspconfig.gopls.setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
["ui.inlayhint.hints"] = {
|
||||||
|
compositeLiteralFields = true,
|
||||||
|
constantValues = true,
|
||||||
|
parameterNames = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
lspconfig.lua_ls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_init = function(client)
|
||||||
|
if client.workspace_folders then
|
||||||
|
local path = client.workspace_folders[1].name
|
||||||
|
if
|
||||||
|
path ~= vim.fn.stdpath("config")
|
||||||
|
and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc"))
|
||||||
|
then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||||
|
runtime = {
|
||||||
|
version = "LuaJIT",
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = {
|
||||||
|
vim.env.VIMRUNTIME,
|
||||||
|
"${3rd}/luv/library",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
-- lspconfig.dartls.setup({
|
-- lspconfig.dartls.setup({
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
return {
|
||||||
|
"yetone/avante.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
lazy = false,
|
||||||
|
version = false, -- set this if you want to always pull the latest change
|
||||||
|
opts = {
|
||||||
|
-- add any opts here
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('avante').setup({
|
||||||
|
-- provider = "ollama",
|
||||||
|
-- vendors = {
|
||||||
|
-- ollama = {
|
||||||
|
-- __inherited_from = "openai",
|
||||||
|
-- api_key_name = "",
|
||||||
|
-- endpoint = "http://127.0.0.1:11434/v1",
|
||||||
|
-- model = "mistral",
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
provider = "claude", -- Recommend using Claude
|
||||||
|
auto_suggestions_provider = "claude", -- Since auto-suggestions are a high-frequency operation and therefore expensive, it is recommended to specify an inexpensive provider or even a free provider: copilot
|
||||||
|
claude = {
|
||||||
|
endpoint = "https://api.anthropic.com",
|
||||||
|
model = "claude-3-5-sonnet-20241022",
|
||||||
|
temperature = 0,
|
||||||
|
max_tokens = 4096,
|
||||||
|
},
|
||||||
|
-- claude = {
|
||||||
|
-- endpoint = "https://api.anthropic.com",
|
||||||
|
-- model = "claude-3-5-sonnet-20241022",
|
||||||
|
-- temperature = 0,
|
||||||
|
-- max_tokens = 4096,
|
||||||
|
-- },
|
||||||
|
---Specify the special dual_boost mode
|
||||||
|
---1. enabled: Whether to enable dual_boost mode. Default to false.
|
||||||
|
---2. first_provider: The first provider to generate response. Default to "openai".
|
||||||
|
---3. second_provider: The second provider to generate response. Default to "claude".
|
||||||
|
---4. prompt: The prompt to generate response based on the two reference outputs.
|
||||||
|
---5. timeout: Timeout in milliseconds. Default to 60000.
|
||||||
|
---How it works:
|
||||||
|
--- When dual_boost is enabled, avante will generate two responses from the first_provider and second_provider respectively. Then use the response from the first_provider as provider1_output and the response from the second_provider as provider2_output. Finally, avante will generate a response based on the prompt and the two reference outputs, with the default Provider as normal.
|
||||||
|
---Note: This is an experimental feature and may not work as expected.
|
||||||
|
dual_boost = {
|
||||||
|
enabled = false,
|
||||||
|
first_provider = "openai",
|
||||||
|
second_provider = "claude",
|
||||||
|
prompt =
|
||||||
|
"Based on the two reference outputs below, generate a response that incorporates elements from both but reflects your own judgment and unique perspective. Do not provide any explanation, just give the response directly. Reference Output 1: [{{provider1_output}}], Reference Output 2: [{{provider2_output}}]",
|
||||||
|
timeout = 60000, -- Timeout in milliseconds
|
||||||
|
},
|
||||||
|
behaviour = {
|
||||||
|
auto_suggestions = true, -- Experimental stage
|
||||||
|
auto_set_highlight_group = true,
|
||||||
|
auto_set_keymaps = true,
|
||||||
|
auto_apply_diff_after_generation = false,
|
||||||
|
support_paste_from_clipboard = false,
|
||||||
|
minimize_diff = true, -- Whether to remove unchanged lines when applying a code block
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
diff = {
|
||||||
|
ours = "co",
|
||||||
|
theirs = "ct",
|
||||||
|
all_theirs = "ca",
|
||||||
|
both = "cb",
|
||||||
|
cursor = "cc",
|
||||||
|
next = "]x",
|
||||||
|
prev = "[x",
|
||||||
|
},
|
||||||
|
suggestion = {
|
||||||
|
accept = "<M-l>",
|
||||||
|
next = "<M-]>",
|
||||||
|
prev = "<M-[>",
|
||||||
|
dismiss = "<C-]>",
|
||||||
|
},
|
||||||
|
jump = {
|
||||||
|
next = "]]",
|
||||||
|
prev = "[[",
|
||||||
|
},
|
||||||
|
submit = {
|
||||||
|
normal = "<CR>",
|
||||||
|
insert = "<C-s>",
|
||||||
|
},
|
||||||
|
sidebar = {
|
||||||
|
apply_all = "A",
|
||||||
|
apply_cursor = "a",
|
||||||
|
switch_windows = "<Tab>",
|
||||||
|
reverse_switch_windows = "<S-Tab>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hints = { enabled = true },
|
||||||
|
windows = {
|
||||||
|
---@type "right" | "left" | "top" | "bottom"
|
||||||
|
position = "right", -- the position of the sidebar
|
||||||
|
wrap = true, -- similar to vim.o.wrap
|
||||||
|
width = 30, -- default % based on available width
|
||||||
|
sidebar_header = {
|
||||||
|
enabled = true, -- true, false to enable/disable the header
|
||||||
|
align = "center", -- left, center, right for title
|
||||||
|
rounded = true,
|
||||||
|
},
|
||||||
|
input = {
|
||||||
|
prefix = "> ",
|
||||||
|
height = 8, -- Height of the input window in vertical layout
|
||||||
|
},
|
||||||
|
edit = {
|
||||||
|
border = "rounded",
|
||||||
|
start_insert = true, -- Start insert mode when opening the edit window
|
||||||
|
},
|
||||||
|
ask = {
|
||||||
|
floating = false, -- Open the 'AvanteAsk' prompt in a floating window
|
||||||
|
start_insert = true, -- Start insert mode when opening the ask window
|
||||||
|
border = "rounded",
|
||||||
|
focus_on_apply = "ours", -- which diff to focus after applying
|
||||||
|
},
|
||||||
|
},
|
||||||
|
highlights = {
|
||||||
|
diff = {
|
||||||
|
current = "DiffText",
|
||||||
|
incoming = "DiffAdd",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
diff = {
|
||||||
|
autojump = true,
|
||||||
|
list_opener = "copen",
|
||||||
|
--- Override the 'timeoutlen' setting while hovering over a diff (see :help timeoutlen).
|
||||||
|
--- Helps to avoid entering operator-pending mode with diff mappings starting with `c`.
|
||||||
|
--- Disable by setting to -1.
|
||||||
|
override_timeoutlen = 500,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
|
||||||
|
build = "make",
|
||||||
|
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
|
||||||
|
dependencies = {
|
||||||
|
"stevearc/dressing.nvim",
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
--- The below dependencies are optional,
|
||||||
|
"hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions
|
||||||
|
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
|
||||||
|
"zbirenbaum/copilot.lua", -- for providers='copilot'
|
||||||
|
{
|
||||||
|
-- support for image pasting
|
||||||
|
"HakonHarnes/img-clip.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
-- recommended settings
|
||||||
|
default = {
|
||||||
|
embed_image_as_base64 = false,
|
||||||
|
prompt_for_file_name = false,
|
||||||
|
drag_and_drop = {
|
||||||
|
insert_mode = true,
|
||||||
|
},
|
||||||
|
-- required for Windows users
|
||||||
|
use_absolute_path = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- Make sure to set this up properly if you have lazy=true
|
||||||
|
'MeanderingProgrammer/render-markdown.nvim',
|
||||||
|
opts = {
|
||||||
|
file_types = { "markdown", "Avante" },
|
||||||
|
},
|
||||||
|
ft = { "markdown", "Avante" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
return {
|
||||||
|
"mistricky/codesnap.nvim",
|
||||||
|
build = "make",
|
||||||
|
config = function()
|
||||||
|
require("codesnap").setup({
|
||||||
|
save_path = "~/Pictures",
|
||||||
|
watermark = "",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
|
||||||
|
}
|
|
@ -1,19 +1,62 @@
|
||||||
|
-- return {
|
||||||
|
-- "folke/trouble.nvim",
|
||||||
|
-- dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
-- opts = {
|
||||||
|
-- -- your configuration comes here
|
||||||
|
-- -- or leave it empty to use the default settings
|
||||||
|
-- -- refer to the configuration section below
|
||||||
|
-- },
|
||||||
|
-- config = function()
|
||||||
|
-- vim.keymap.set("n", "<leader>xx", function() require("trouble").toggle() end)
|
||||||
|
-- vim.keymap.set("n", "<leader>xw", function() require("trouble").toggle("workspace_diagnostics") end)
|
||||||
|
-- vim.keymap.set("n", "<leader>xd", function() require("trouble").toggle("document_diagnostics") end)
|
||||||
|
-- vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end)
|
||||||
|
-- vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end)
|
||||||
|
-- vim.keymap.set("n", "<leader>xn", function() require("trouble").next({ skip_groups = true, jump = true }) end)
|
||||||
|
-- vim.keymap.set("n", "<leader>xb", function() require("trouble").previous({ skip_groups = true, jump = true }) end)
|
||||||
|
-- vim.keymap.set("n", "gR", function() require("trouble").toggle("lsp_references") end)
|
||||||
|
-- end
|
||||||
|
-- }
|
||||||
return {
|
return {
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
opts = {
|
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
||||||
-- your configuration comes here
|
cmd = "Trouble",
|
||||||
-- or leave it empty to use the default settings
|
keys = {
|
||||||
-- refer to the configuration section below
|
{
|
||||||
|
"<leader>xx",
|
||||||
|
"<cmd>Trouble diagnostics toggle<cr>",
|
||||||
|
desc = "Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xn",
|
||||||
|
"<cmd>lua require(\"trouble\").next({ skip_groups = true, jump = true })<cr>",
|
||||||
|
desc = "Diagnostics Next"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xX",
|
||||||
|
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||||
|
desc = "Buffer Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cs",
|
||||||
|
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||||
|
desc = "Symbols (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cl",
|
||||||
|
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||||
|
desc = "LSP Definitions / references / ... (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xL",
|
||||||
|
"<cmd>Trouble loclist toggle<cr>",
|
||||||
|
desc = "Location List (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xQ",
|
||||||
|
"<cmd>Trouble qflist toggle<cr>",
|
||||||
|
desc = "Quickfix List (Trouble)",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
config = function()
|
|
||||||
vim.keymap.set("n", "<leader>xx", function() require("trouble").toggle() end)
|
|
||||||
vim.keymap.set("n", "<leader>xw", function() require("trouble").toggle("workspace_diagnostics") end)
|
|
||||||
vim.keymap.set("n", "<leader>xd", function() require("trouble").toggle("document_diagnostics") end)
|
|
||||||
vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end)
|
|
||||||
vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end)
|
|
||||||
vim.keymap.set("n", "<leader>xn", function() require("trouble").next({ skip_groups = true, jump = true }) end)
|
|
||||||
vim.keymap.set("n", "<leader>xb", function() require("trouble").previous({ skip_groups = true, jump = true }) end)
|
|
||||||
vim.keymap.set("n", "gR", function() require("trouble").toggle("lsp_references") end)
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
return {
|
return {
|
||||||
'akinsho/flutter-tools.nvim',
|
'akinsho/flutter-tools.nvim',
|
||||||
lazy = false,
|
lazy = false,
|
||||||
|
branch = 'main',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
'stevearc/dressing.nvim', -- optional for vim.ui.select
|
'stevearc/dressing.nvim', -- optional for vim.ui.select
|
||||||
|
@ -27,15 +28,19 @@ return {
|
||||||
project_config = true,
|
project_config = true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
debugger = { -- integrate with nvim dap + install dart code debugger
|
debugger = { -- integrate with nvim dap + install dart code debugger
|
||||||
enabled = true,
|
enabled = true,
|
||||||
run_via_dap = false, -- use dap instead of a plenary job to run flutter apps
|
register_configurations = function(_)
|
||||||
|
require("dap").configurations.dart = {}
|
||||||
|
require("dap.ext.vscode").load_launchjs()
|
||||||
|
end,
|
||||||
|
run_via_dap = true, -- use dap instead of a plenary job to run flutter apps
|
||||||
-- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
|
-- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
|
||||||
-- see |:help dap.set_exception_breakpoints()| for more info
|
-- see |:help dap.set_exception_breakpoints()| for more info
|
||||||
exception_breakpoints = {}
|
|
||||||
},
|
},
|
||||||
root_patterns = { ".git", "pubspec.yaml" }, -- patterns to find the root of your flutter project
|
root_patterns = { ".git", "pubspec.yaml" }, -- patterns to find the root of your flutter project
|
||||||
fvm = true, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
|
-- root_patterns = { ".git", "youfeel_flutter/pubspec.yaml" }, -- patterns to find the root of your flutter project
|
||||||
|
fvm = false, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
|
||||||
widget_guides = {
|
widget_guides = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
},
|
},
|
||||||
|
@ -45,7 +50,7 @@ return {
|
||||||
enabled = true -- set to false to disable
|
enabled = true -- set to false to disable
|
||||||
},
|
},
|
||||||
dev_log = {
|
dev_log = {
|
||||||
enabled = true,
|
enabled = false,
|
||||||
notify_errors = false, -- if there is an error whilst running then notify the user
|
notify_errors = false, -- if there is an error whilst running then notify the user
|
||||||
open_cmd = "tabedit", -- command to us
|
open_cmd = "tabedit", -- command to us
|
||||||
},
|
},
|
||||||
|
@ -81,19 +86,23 @@ return {
|
||||||
-- enableSnippets = true,
|
-- enableSnippets = true,
|
||||||
previewLsp = true,
|
previewLsp = true,
|
||||||
updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command.
|
updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command.
|
||||||
|
lineLength = vim.o.textwidth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- [[ Configure Flutter tools]]
|
-- [[ Configure Flutter tools]]
|
||||||
vim.keymap.set('n', '<leader>r', require('telescope').extensions.flutter.commands, { desc = 'Open command Flutter' })
|
vim.keymap.set('n', '<leader>r', function()
|
||||||
|
require('telescope').extensions.flutter.commands()
|
||||||
|
end, { desc = 'Open command Flutter' })
|
||||||
vim.keymap.set('n', '<leader>br', function()
|
vim.keymap.set('n', '<leader>br', function()
|
||||||
vim.cmd('20new')
|
vim.cmd('20new')
|
||||||
vim.cmd('te fvm flutter packages pub run build_runner build --delete-conflicting-outputs')
|
vim.cmd('te dart run build_runner build --delete-conflicting-outputs && exit')
|
||||||
vim.cmd('2sleep | normal G')
|
vim.cmd('2sleep | normal G')
|
||||||
end)
|
end)
|
||||||
vim.keymap.set('n', '<leader>bt', function()
|
vim.keymap.set('n', '<leader>bt', function()
|
||||||
vim.cmd('20new')
|
vim.cmd('20new')
|
||||||
vim.cmd('te sh scripts/create_clean_lcov_and_generate_html.sh')
|
vim.cmd('te flutter test')
|
||||||
vim.cmd('2sleep | normal G')
|
vim.cmd('2sleep | normal G')
|
||||||
end)
|
end)
|
||||||
-- '<Cmd>20new | te fvm flutter pub get && fvm flutter packages pub run build_runner build --delete-conflicting-outputs<CR> | $')
|
-- '<Cmd>20new | te fvm flutter pub get && fvm flutter packages pub run build_runner build --delete-conflicting-outputs<CR> | $')
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
return {
|
||||||
|
"ThePrimeagen/harpoon",
|
||||||
|
branch = "harpoon2",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
local harpoon = require("harpoon")
|
||||||
|
|
||||||
|
-- REQUIRED
|
||||||
|
harpoon:setup()
|
||||||
|
-- REQUIRED
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>k", function() harpoon:list():add() end, { desc = 'Harpoon add to list' })
|
||||||
|
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
|
||||||
|
vim.keymap.set("n", "<C-t>", function() harpoon:list():select(2) end)
|
||||||
|
vim.keymap.set("n", "<C-n>", function() harpoon:list():select(3) end)
|
||||||
|
vim.keymap.set("n", "<C-s>", function() harpoon:list():select(4) end)
|
||||||
|
|
||||||
|
-- Toggle previous & next buffers stored within Harpoon list
|
||||||
|
vim.keymap.set("n", "<C-p>", function() harpoon:list():prev() end)
|
||||||
|
vim.keymap.set("n", "<C-n>", function() harpoon:list():next() end)
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
return {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local mason = require("mason")
|
||||||
|
|
||||||
|
local mason_tool_installer = require("mason-tool-installer")
|
||||||
|
|
||||||
|
-- enable mason and configure icons
|
||||||
|
mason.setup({
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_installed = "✓",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✗",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
mason_tool_installer.setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"standardrb",
|
||||||
|
"prettier",
|
||||||
|
"prettierd",
|
||||||
|
"ktlint",
|
||||||
|
"eslint_d",
|
||||||
|
"google-java-format",
|
||||||
|
"htmlbeautifier",
|
||||||
|
"beautysh",
|
||||||
|
"buf",
|
||||||
|
"rustfmt",
|
||||||
|
"yamlfix",
|
||||||
|
"taplo",
|
||||||
|
"shellcheck",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,208 @@
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-jdtls",
|
||||||
|
dependencies = { "folke/which-key.nvim" },
|
||||||
|
ft = java_filetypes,
|
||||||
|
opts = function()
|
||||||
|
local mason_registry = require("mason-registry")
|
||||||
|
local lombok_jar = mason_registry.get_package("jdtls"):get_install_path() .. "/lombok.jar"
|
||||||
|
return {
|
||||||
|
-- How to find the root dir for a given filename. The default comes from
|
||||||
|
-- lspconfig which provides a function specifically for java projects.
|
||||||
|
root_dir = LazyVim.lsp.get_raw_config("jdtls").default_config.root_dir,
|
||||||
|
|
||||||
|
-- How to find the project name for a given root dir.
|
||||||
|
project_name = function(root_dir)
|
||||||
|
return root_dir and vim.fs.basename(root_dir)
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- Where are the config and workspace dirs for a project?
|
||||||
|
jdtls_config_dir = function(project_name)
|
||||||
|
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/config"
|
||||||
|
end,
|
||||||
|
jdtls_workspace_dir = function(project_name)
|
||||||
|
return vim.fn.stdpath("cache") .. "/jdtls/" .. project_name .. "/workspace"
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- How to run jdtls. This can be overridden to a full java command-line
|
||||||
|
-- if the Python wrapper script doesn't suffice.
|
||||||
|
cmd = {
|
||||||
|
vim.fn.exepath("jdtls"),
|
||||||
|
string.format("--jvm-arg=-javaagent:%s", lombok_jar),
|
||||||
|
},
|
||||||
|
full_cmd = function(opts)
|
||||||
|
local fname = vim.api.nvim_buf_get_name(0)
|
||||||
|
local root_dir = opts.root_dir(fname)
|
||||||
|
local project_name = opts.project_name(root_dir)
|
||||||
|
local cmd = vim.deepcopy(opts.cmd)
|
||||||
|
if project_name then
|
||||||
|
vim.list_extend(cmd, {
|
||||||
|
"-configuration",
|
||||||
|
opts.jdtls_config_dir(project_name),
|
||||||
|
"-data",
|
||||||
|
opts.jdtls_workspace_dir(project_name),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return cmd
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- These depend on nvim-dap, but can additionally be disabled by setting false here.
|
||||||
|
dap = { hotcodereplace = "auto", config_overrides = {} },
|
||||||
|
dap_main = {},
|
||||||
|
test = true,
|
||||||
|
settings = {
|
||||||
|
java = {
|
||||||
|
inlayHints = {
|
||||||
|
parameterNames = {
|
||||||
|
enabled = "all",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
config = function(_, opts)
|
||||||
|
-- Find the extra bundles that should be passed on the jdtls command-line
|
||||||
|
-- if nvim-dap is enabled with java debug/test.
|
||||||
|
local mason_registry = require("mason-registry")
|
||||||
|
local bundles = {} ---@type string[]
|
||||||
|
if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||||
|
local java_dbg_pkg = mason_registry.get_package("java-debug-adapter")
|
||||||
|
local java_dbg_path = java_dbg_pkg:get_install_path()
|
||||||
|
local jar_patterns = {
|
||||||
|
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
|
||||||
|
}
|
||||||
|
-- java-test also depends on java-debug-adapter.
|
||||||
|
if opts.test and mason_registry.is_installed("java-test") then
|
||||||
|
local java_test_pkg = mason_registry.get_package("java-test")
|
||||||
|
local java_test_path = java_test_pkg:get_install_path()
|
||||||
|
vim.list_extend(jar_patterns, {
|
||||||
|
java_test_path .. "/extension/server/*.jar",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
for _, jar_pattern in ipairs(jar_patterns) do
|
||||||
|
for _, bundle in ipairs(vim.split(vim.fn.glob(jar_pattern), "\n")) do
|
||||||
|
table.insert(bundles, bundle)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function attach_jdtls()
|
||||||
|
local fname = vim.api.nvim_buf_get_name(0)
|
||||||
|
|
||||||
|
-- Configuration can be augmented and overridden by opts.jdtls
|
||||||
|
local config = extend_or_override({
|
||||||
|
cmd = opts.full_cmd(opts),
|
||||||
|
root_dir = opts.root_dir(fname),
|
||||||
|
init_options = {
|
||||||
|
bundles = bundles,
|
||||||
|
},
|
||||||
|
settings = opts.settings,
|
||||||
|
-- enable CMP capabilities
|
||||||
|
capabilities = LazyVim.has("cmp-nvim-lsp") and require("cmp_nvim_lsp").default_capabilities() or nil,
|
||||||
|
}, opts.jdtls)
|
||||||
|
|
||||||
|
-- Existing server will be reused if the root_dir matches.
|
||||||
|
require("jdtls").start_or_attach(config)
|
||||||
|
-- not need to require("jdtls.setup").add_commands(), start automatically adds commands
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Attach the jdtls for each java buffer. HOWEVER, this plugin loads
|
||||||
|
-- depending on filetype, so this autocmd doesn't run for the first file.
|
||||||
|
-- For that, we call directly below.
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = java_filetypes,
|
||||||
|
callback = attach_jdtls,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Setup keymap and dap after the lsp is fully attached.
|
||||||
|
-- https://github.com/mfussenegger/nvim-jdtls#nvim-dap-configuration
|
||||||
|
-- https://neovim.io/doc/user/lsp.html#LspAttach
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client and client.name == "jdtls" then
|
||||||
|
local wk = require("which-key")
|
||||||
|
wk.add({
|
||||||
|
{
|
||||||
|
mode = "n",
|
||||||
|
buffer = args.buf,
|
||||||
|
{ "<leader>cx", group = "extract" },
|
||||||
|
{ "<leader>cxv", require("jdtls").extract_variable_all, desc = "Extract Variable" },
|
||||||
|
{ "<leader>cxc", require("jdtls").extract_constant, desc = "Extract Constant" },
|
||||||
|
{ "gs", require("jdtls").super_implementation, desc = "Goto Super" },
|
||||||
|
{ "gS", require("jdtls.tests").goto_subjects, desc = "Goto Subjects" },
|
||||||
|
{ "<leader>co", require("jdtls").organize_imports, desc = "Organize Imports" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
wk.add({
|
||||||
|
{
|
||||||
|
mode = "v",
|
||||||
|
buffer = args.buf,
|
||||||
|
{ "<leader>cx", group = "extract" },
|
||||||
|
{
|
||||||
|
"<leader>cxm",
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_method(true)<CR>]],
|
||||||
|
desc = "Extract Method",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cxv",
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_variable_all(true)<CR>]],
|
||||||
|
desc = "Extract Variable",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cxc",
|
||||||
|
[[<ESC><CMD>lua require('jdtls').extract_constant(true)<CR>]],
|
||||||
|
desc = "Extract Constant",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if opts.dap and LazyVim.has("nvim-dap") and mason_registry.is_installed("java-debug-adapter") then
|
||||||
|
-- custom init for Java debugger
|
||||||
|
require("jdtls").setup_dap(opts.dap)
|
||||||
|
require("jdtls.dap").setup_dap_main_class_configs(opts.dap_main)
|
||||||
|
|
||||||
|
-- Java Test require Java debugger to work
|
||||||
|
if opts.test and mason_registry.is_installed("java-test") then
|
||||||
|
-- custom keymaps for Java test runner (not yet compatible with neotest)
|
||||||
|
wk.add({
|
||||||
|
{
|
||||||
|
mode = "n",
|
||||||
|
buffer = args.buf,
|
||||||
|
{ "<leader>t", group = "test" },
|
||||||
|
{
|
||||||
|
"<leader>tt",
|
||||||
|
function()
|
||||||
|
require("jdtls.dap").test_class({
|
||||||
|
config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Run All Test",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>tr",
|
||||||
|
function()
|
||||||
|
require("jdtls.dap").test_nearest_method({
|
||||||
|
config_overrides = type(opts.test) ~= "boolean" and opts.test.config_overrides or nil,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
desc = "Run Nearest Test",
|
||||||
|
},
|
||||||
|
{ "<leader>tT", require("jdtls.dap").pick_test, desc = "Run Test" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- User can set additional keymaps in opts.on_attach
|
||||||
|
if opts.on_attach then
|
||||||
|
opts.on_attach(args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Avoid race condition by calling attach the first time, since the autocmd won't fire.
|
||||||
|
attach_jdtls()
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
return {
|
||||||
|
"elmcgill/springboot-nvim",
|
||||||
|
depedencies = {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
"mfussenegger/nvim-jdtls"
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local springboot_nvim = require("springboot-nvim")
|
||||||
|
vim.keymap.set('n', '<leader>Jr', springboot_nvim.boot_run, { desc = "Spring Boot Run Project" })
|
||||||
|
vim.keymap.set('n', '<leader>Jc', springboot_nvim.generate_class, { desc = "Java Create Class" })
|
||||||
|
vim.keymap.set('n', '<leader>Ji', springboot_nvim.generate_interface, { desc = "Java Create Interface" })
|
||||||
|
vim.keymap.set('n', '<leader>Je', springboot_nvim.generate_enum, { desc = "Java Create Enum" })
|
||||||
|
springboot_nvim.setup({})
|
||||||
|
end
|
||||||
|
}
|
|
@ -19,6 +19,16 @@ return {
|
||||||
config = function()
|
config = function()
|
||||||
require('telescope').setup {
|
require('telescope').setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
|
file_ignore_patterns = {
|
||||||
|
"node_modules/.*",
|
||||||
|
"%.env",
|
||||||
|
"yarn.lock",
|
||||||
|
"package-lock.json",
|
||||||
|
"lazy-lock.json",
|
||||||
|
"init.sql",
|
||||||
|
"target/.*",
|
||||||
|
".git/.*",
|
||||||
|
},
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
['<C-u>'] = false,
|
['<C-u>'] = false,
|
||||||
|
@ -32,30 +42,84 @@ return {
|
||||||
pcall(require('telescope').load_extension, 'fzf')
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
pcall(require('telescope').load_extension, 'flutter')
|
pcall(require('telescope').load_extension, 'flutter')
|
||||||
|
|
||||||
|
builtin = require('telescope.builtin');
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
-- See `:help telescope.builtin`
|
||||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
vim.keymap.set('n', '<leader>?', builtin.oldfiles, { desc = '[?] Find recently opened files' })
|
||||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
vim.keymap.set('n', '<leader><space>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
vim.keymap.set('n', '<leader>/', function()
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||||
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
winblend = 10,
|
winblend = 10,
|
||||||
previewer = false,
|
previewer = false,
|
||||||
})
|
})
|
||||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>gs', require('telescope.builtin').git_status, { desc = 'Search [G]it [S]tatus' })
|
vim.keymap.set('n', '<leader>gs', builtin.git_status, { desc = 'Search [G]it [S]tatus' })
|
||||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
vim.keymap.set('n', '<leader>gi', require('telescope.builtin').lsp_implementations,
|
vim.keymap.set('n', '<leader>gi', builtin.lsp_implementations,
|
||||||
{ desc = '[G]o to [I]mplementations' })
|
{ desc = '[G]o to [I]mplementations' })
|
||||||
vim.keymap.set('n', '<leader>gr', require('telescope.builtin').lsp_references,
|
vim.keymap.set('n', '<leader>gr', builtin.lsp_references,
|
||||||
{ desc = '[G]o to [R]eferences' })
|
{ desc = '[G]o to [R]eferences' })
|
||||||
vim.keymap.set('n', '<leader>gd', require('telescope.builtin').lsp_definitions,
|
vim.keymap.set('n', '<leader>gd', builtin.lsp_definitions,
|
||||||
{ desc = '[G]o to [D]efinitions' })
|
{ desc = '[G]o to [D]efinitions' })
|
||||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||||
|
|
||||||
|
|
||||||
|
-- Harpoon config:
|
||||||
|
--
|
||||||
|
|
||||||
|
-- local harpoon = require('harpoon')
|
||||||
|
-- harpoon:setup({})
|
||||||
|
--
|
||||||
|
-- -- basic telescope configuration
|
||||||
|
-- local conf = require("telescope.config").values
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- local function toggle_telescope(harpoon_files)
|
||||||
|
-- local make_finder = function()
|
||||||
|
-- local paths = {}
|
||||||
|
-- for _, item in ipairs(harpoon_files.items) do
|
||||||
|
-- table.insert(paths, item.value)
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- return require("telescope.finders").new_table({
|
||||||
|
-- results = paths,
|
||||||
|
-- })
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local file_paths = {}
|
||||||
|
-- for _, item in ipairs(harpoon_files.items) do
|
||||||
|
-- table.insert(file_paths, item.value)
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- require("telescope.pickers").new({}, {
|
||||||
|
-- prompt_title = "Harpoon",
|
||||||
|
-- finder = make_finder(),
|
||||||
|
-- previewer = conf.file_previewer({}),
|
||||||
|
-- sorter = conf.generic_sorter({}),
|
||||||
|
-- attach_mappings = function(prompt_buffer_number, map)
|
||||||
|
-- map("n", "dd", function()
|
||||||
|
-- local state = require("telescope.actions.state")
|
||||||
|
-- local selected_entry = state.get_selected_entry()
|
||||||
|
-- local current_picker = state.get_current_picker(prompt_buffer_number)
|
||||||
|
--
|
||||||
|
-- harpoon:list():removeAt(selected_entry.index)
|
||||||
|
-- current_picker:refresh(make_finder())
|
||||||
|
-- end)
|
||||||
|
--
|
||||||
|
-- return true
|
||||||
|
-- end,
|
||||||
|
--
|
||||||
|
-- }):find()
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<C-e>", function() toggle_telescope(harpoon:list()) end,
|
||||||
|
-- { desc = "Open harpoon window" })
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,13 @@ return {
|
||||||
"nvim-neotest/neotest",
|
"nvim-neotest/neotest",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"antoinemadec/FixCursorHold.nvim",
|
|
||||||
"sidlatau/neotest-dart"
|
"sidlatau/neotest-dart"
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require('neotest').setup({
|
require('neotest').setup({
|
||||||
adapters = {
|
adapters = {
|
||||||
require('neotest-dart') {
|
require('neotest-dart') {
|
||||||
command = 'fvm flutter', -- Command being used to run tests. Defaults to `flutter`
|
command = 'flutter', -- Command being used to run tests. Defaults to `flutter`
|
||||||
-- Change it to `fvm flutter` if using FVM
|
-- Change it to `fvm flutter` if using FVM
|
||||||
-- change it to `dart` for Dart only tests
|
-- change it to `dart` for Dart only tests
|
||||||
use_lsp = true, -- When set Flutter outline information is used when constructing test name.
|
use_lsp = true, -- When set Flutter outline information is used when constructing test name.
|
||||||
|
@ -29,6 +28,11 @@ return {
|
||||||
end, { desc = 'Test: [T]oggle [O]utput' })
|
end, { desc = 'Test: [T]oggle [O]utput' })
|
||||||
|
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>rtD', function()
|
||||||
|
-- neotest.run.run()
|
||||||
|
neotest.run.run({ strategy = 'dap' })
|
||||||
|
end, { desc = 'Test: [R]un [T]ests' })
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>rt', function()
|
vim.keymap.set('n', '<leader>rt', function()
|
||||||
neotest.run.run()
|
neotest.run.run()
|
||||||
end, { desc = 'Test: [R]un [T]ests' })
|
end, { desc = 'Test: [R]un [T]ests' })
|
||||||
|
|
|
@ -124,6 +124,7 @@ return {
|
||||||
window = {
|
window = {
|
||||||
position = "left",
|
position = "left",
|
||||||
width = 60,
|
width = 60,
|
||||||
|
auto_expand_width = false,
|
||||||
mapping_options = {
|
mapping_options = {
|
||||||
noremap = true,
|
noremap = true,
|
||||||
nowait = true,
|
nowait = true,
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
return {
|
||||||
|
"wojciech-kulik/xcodebuild.nvim",
|
||||||
|
dependencies = {
|
||||||
|
-- "nvim-telescope/telescope.nvim",
|
||||||
|
-- "MunifTanjim/nui.nvim",
|
||||||
|
"folke/snacks.nvim", -- (optional) to show previews
|
||||||
|
-- "nvim-tree/nvim-tree.lua", -- (optional) to manage project files
|
||||||
|
"stevearc/oil.nvim", -- (optional) to manage project files
|
||||||
|
-- "nvim-treesitter/nvim-treesitter", -- (optional) for Quick tests support (required Swift parser)
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("xcodebuild").setup({
|
||||||
|
-- put some options here or leave it empty to use default settings
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
|
@ -46,7 +46,7 @@ return {
|
||||||
|
|
||||||
-- Tsserver usually works poorly. Sorry you work with bad languages
|
-- Tsserver usually works poorly. Sorry you work with bad languages
|
||||||
-- You can remove this line if you know what you're doing :)
|
-- You can remove this line if you know what you're doing :)
|
||||||
if client.name == 'tsserver' then
|
if client.name == 'ts_ls' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,18 +12,16 @@ return {
|
||||||
-- NOTE: And you can specify dependencies as well
|
-- NOTE: And you can specify dependencies as well
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Creates a beautiful debugger UI
|
-- Creates a beautiful debugger UI
|
||||||
'rcarriga/nvim-dap-ui',
|
-- 'rcarriga/nvim-dap-ui',
|
||||||
|
'igorlfs/nvim-dap-view',
|
||||||
|
|
||||||
-- Installs the debug adapters for you
|
-- Installs the debug adapters for you
|
||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
|
|
||||||
-- Add your own debuggers here
|
|
||||||
'leoluz/nvim-dap-go',
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
local dapui = require 'dapui'
|
-- local dapui = require 'dapui'
|
||||||
|
|
||||||
require('mason-nvim-dap').setup {
|
require('mason-nvim-dap').setup {
|
||||||
-- Makes a best effort to setup the various debuggers with
|
-- Makes a best effort to setup the various debuggers with
|
||||||
|
@ -44,10 +42,12 @@ return {
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Basic debugging keymaps, feel free to change to your liking!
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'Debug: Start/Continue' })
|
vim.keymap.set('n', '<leader>dt', dap.repl.open, { desc = 'Debug: Open repl' })
|
||||||
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'Debug: Step Into' })
|
vim.keymap.set('n', '<leader>dtc', dap.repl.close, { desc = 'Debug: Close repl' })
|
||||||
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'Debug: Step Over' })
|
vim.keymap.set('n', '<leader>dc', dap.continue, { desc = 'Debug: Start/Continue' })
|
||||||
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'Debug: Step Out' })
|
vim.keymap.set('n', '<leader>dn', dap.step_into, { desc = 'Debug: Step Into' })
|
||||||
|
vim.keymap.set('n', '<leader>do', dap.step_over, { desc = 'Debug: Step Over' })
|
||||||
|
vim.keymap.set('n', '<leader>dO', dap.step_out, { desc = 'Debug: Step Out' })
|
||||||
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' })
|
||||||
vim.keymap.set('n', '<leader>B', function()
|
vim.keymap.set('n', '<leader>B', function()
|
||||||
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
|
@ -56,34 +56,38 @@ return {
|
||||||
|
|
||||||
-- Dap UI setup
|
-- Dap UI setup
|
||||||
-- For more information, see |:help nvim-dap-ui|
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
dapui.setup {
|
--
|
||||||
-- Set icons to characters that are more likely to work in every terminal.
|
-- local dapui = require("dapui")
|
||||||
-- Feel free to remove or use ones that you like more! :)
|
-- dapui.setup {
|
||||||
-- Don't feel like these are good choices.
|
-- -- Set icons to characters that are more likely to work in every terminal.
|
||||||
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
-- -- Feel free to remove or use ones that you like more! :)
|
||||||
controls = {
|
-- -- Don't feel like these are good choices.
|
||||||
icons = {
|
-- icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||||
pause = '⏸',
|
-- controls = {
|
||||||
play = '▶',
|
-- icons = {
|
||||||
step_into = '⏎',
|
-- pause = '⏸',
|
||||||
step_over = '⏭',
|
-- play = '▶',
|
||||||
step_out = '⏮',
|
-- step_into = '⏎',
|
||||||
step_back = 'b',
|
-- step_over = '⏭',
|
||||||
run_last = '▶▶',
|
-- step_out = '⏮',
|
||||||
terminate = '⏹',
|
-- step_back = 'b',
|
||||||
disconnect = '⏏',
|
-- run_last = '▶▶',
|
||||||
},
|
-- terminate = '⏹',
|
||||||
},
|
-- disconnect = '⏏',
|
||||||
}
|
-- },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
|
||||||
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
|
-- vim.keymap.set('n', '<leader>dTo', dapui.open, { desc = 'Open: dap UI' })
|
||||||
|
-- vim.keymap.set('n', '<leader>dTc', dapui.close, { desc = 'Close: dap UI' })
|
||||||
|
--
|
||||||
|
-- dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
||||||
|
-- dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
|
-- dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
--
|
||||||
|
local dapview = require('dap-view')
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
vim.keymap.set('n', '<leader>dTo', dapview.toggle, { desc = 'Open: dap UI' })
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
|
||||||
|
|
||||||
-- Install golang specific config
|
|
||||||
require('dap-go').setup()
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,3 +12,18 @@ snippet phr "AppLocalizations"
|
||||||
AppLocalizations.of(context)!.$1
|
AppLocalizations.of(context)!.$1
|
||||||
snippet imploc "Import AppLocalizations"
|
snippet imploc "Import AppLocalizations"
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
snippet gap "Create a gap with const"
|
||||||
|
const Gap($1),
|
||||||
|
snippet useEffect "Create an empty useEffect"
|
||||||
|
useEffect(() {
|
||||||
|
$1
|
||||||
|
return;
|
||||||
|
}, []);
|
||||||
|
snippet clm "Create column with empty children"
|
||||||
|
Column(children: [
|
||||||
|
$1
|
||||||
|
],)
|
||||||
|
snippet row "Create row with empty children"
|
||||||
|
Row(children: [
|
||||||
|
$1
|
||||||
|
],)
|
||||||
|
|
Loading…
Reference in New Issue