add custom config
This commit is contained in:
parent
3338d39206
commit
91bee7646b
330
init.lua
330
init.lua
|
|
@ -91,7 +91,7 @@ vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||||
vim.g.have_nerd_font = false
|
vim.g.have_nerd_font = true
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.o`
|
-- See `:help vim.o`
|
||||||
|
|
@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
|
||||||
vim.o.number = true
|
vim.o.number = true
|
||||||
-- You can also add relative line numbers, to help with jumping.
|
-- You can also add relative line numbers, to help with jumping.
|
||||||
-- Experiment for yourself to see if you like it!
|
-- Experiment for yourself to see if you like it!
|
||||||
-- vim.o.relativenumber = true
|
vim.o.relativenumber = true
|
||||||
|
|
||||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = 'a'
|
||||||
|
|
@ -350,7 +350,212 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
-- NOTE: Yes, you can install new plugins here!
|
||||||
|
'mfussenegger/nvim-dap',
|
||||||
|
-- NOTE: And you can specify dependencies as well
|
||||||
|
dependencies = {
|
||||||
|
-- Creates a beautiful debugger UI
|
||||||
|
'rcarriga/nvim-dap-ui',
|
||||||
|
|
||||||
|
-- Required dependency for nvim-dap-ui
|
||||||
|
'nvim-neotest/nvim-nio',
|
||||||
|
|
||||||
|
-- Installs the debug adapters for you
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
'jay-babu/mason-nvim-dap.nvim',
|
||||||
|
|
||||||
|
-- Add your own debuggers here
|
||||||
|
'leoluz/nvim-dap-go',
|
||||||
|
'mfussenegger/nvim-dap-python',
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
-- Basic debugging keymaps, feel free to change to your liking!
|
||||||
|
{
|
||||||
|
'<F5>',
|
||||||
|
function()
|
||||||
|
require('dap').continue()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Start/Continue',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F1>',
|
||||||
|
function()
|
||||||
|
require('dap').step_into()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Step Into',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<F2>',
|
||||||
|
function()
|
||||||
|
require('dap').step_over()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Step Over',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>cb',
|
||||||
|
function()
|
||||||
|
require('dap').clear_breakpoints()
|
||||||
|
vim.notify('✅ Cleared all breakpoints', vim.log.levels.INFO)
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Clear all Breakpoints',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'<F3>',
|
||||||
|
function()
|
||||||
|
require('dap').step_out()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Step Out',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>b',
|
||||||
|
function()
|
||||||
|
require('dap').toggle_breakpoint()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Toggle Breakpoint',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>B',
|
||||||
|
function()
|
||||||
|
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Set Breakpoint',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>du',
|
||||||
|
function()
|
||||||
|
require('dapui').toggle()
|
||||||
|
vim.notify('DAP UI toggle', vim.log.levels.INFO)
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Toggle DAP UI',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'<leader>dl',
|
||||||
|
function()
|
||||||
|
require('dap').run_last()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Re-run last session',
|
||||||
|
}, -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
||||||
|
{
|
||||||
|
'<F7>',
|
||||||
|
function()
|
||||||
|
require('dapui').toggle()
|
||||||
|
end,
|
||||||
|
desc = 'Debug: See last session result.',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local dap = require 'dap'
|
||||||
|
local dapui = require 'dapui'
|
||||||
|
|
||||||
|
require('mason-nvim-dap').setup {
|
||||||
|
-- Makes a best effort to setup the various debuggers with
|
||||||
|
-- reasonable debug configurations
|
||||||
|
automatic_installation = true,
|
||||||
|
|
||||||
|
-- You can provide additional configuration to the handlers,
|
||||||
|
-- see mason-nvim-dap README for more information
|
||||||
|
handlers = {},
|
||||||
|
|
||||||
|
-- You'll need to check that you have the required things installed
|
||||||
|
-- online, please don't ask me how to install them :)
|
||||||
|
ensure_installed = {
|
||||||
|
-- Update this to ensure that you have the debuggers for the langs you want
|
||||||
|
'delve',
|
||||||
|
'python',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Dap UI setup
|
||||||
|
-- For more information, see |:help nvim-dap-ui|
|
||||||
|
dapui.setup {
|
||||||
|
-- Set icons to characters that are more likely to work in every terminal.
|
||||||
|
-- Feel free to remove or use ones that you like more! :)
|
||||||
|
-- Don't feel like these are good choices.
|
||||||
|
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
||||||
|
controls = {
|
||||||
|
icons = {
|
||||||
|
pause = '⏸',
|
||||||
|
play = '▶',
|
||||||
|
step_into = '⏎',
|
||||||
|
step_over = '⏭',
|
||||||
|
step_out = '⏮',
|
||||||
|
step_back = 'b',
|
||||||
|
run_last = '▶▶',
|
||||||
|
terminate = '⏹',
|
||||||
|
disconnect = '⏏',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Change breakpoint icons
|
||||||
|
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
|
||||||
|
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
|
||||||
|
-- local breakpoint_icons = vim.g.have_nerd_font
|
||||||
|
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
|
||||||
|
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
|
||||||
|
-- for type, icon in pairs(breakpoint_icons) do
|
||||||
|
-- local tp = 'Dap' .. type
|
||||||
|
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
|
||||||
|
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
-- end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-- Install golang specific config
|
||||||
|
require('dap-go').setup {
|
||||||
|
delve = {
|
||||||
|
-- On Windows delve must be run attached or it crashes.
|
||||||
|
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
|
||||||
|
detached = vim.fn.has 'win32' == 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('dap-python').setup '/usr/local/bin/python3.12'
|
||||||
|
|
||||||
|
table.insert(require('dap').configurations.python, {
|
||||||
|
type = 'python',
|
||||||
|
request = 'launch',
|
||||||
|
name = 'E-invoice',
|
||||||
|
program = '/Users/quandoan/Desktop/odoo-18.0/odoo-bin',
|
||||||
|
pythonPath = '/usr/local/bin/python3.12',
|
||||||
|
args = {
|
||||||
|
'-c',
|
||||||
|
'debian/odoo-e-invoice.conf',
|
||||||
|
'-u',
|
||||||
|
'a1_einvoice_to_gov',
|
||||||
|
|
||||||
|
'--xmlrpc-port',
|
||||||
|
'8099',
|
||||||
|
},
|
||||||
|
justMyCode = false,
|
||||||
|
env = {
|
||||||
|
PYTHONPATH = '/Users/quandoan/Desktop/odoo-18.0',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'kdheepak/lazygit.nvim',
|
||||||
|
cmd = 'LazyGit',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>lg',
|
||||||
|
'<cmd>LazyGit<CR>',
|
||||||
|
desc = 'Open LazyGit',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'mluders/comfy-line-numbers.nvim',
|
||||||
|
},
|
||||||
-- NOTE: Plugins can specify dependencies.
|
-- NOTE: Plugins can specify dependencies.
|
||||||
--
|
--
|
||||||
-- The dependencies are proper plugin specifications as well - anything
|
-- The dependencies are proper plugin specifications as well - anything
|
||||||
|
|
@ -673,7 +878,7 @@ require('lazy').setup({
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
-- pyright = {},
|
pyright = {},
|
||||||
-- rust_analyzer = {},
|
-- rust_analyzer = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
--
|
--
|
||||||
|
|
@ -716,6 +921,8 @@ require('lazy').setup({
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
local ensure_installed = vim.tbl_keys(servers or {})
|
||||||
vim.list_extend(ensure_installed, {
|
vim.list_extend(ensure_installed, {
|
||||||
'stylua', -- Used to format Lua code
|
'stylua', -- Used to format Lua code
|
||||||
|
'isort', -- Used to format Lua code
|
||||||
|
'lemminx', -- Used to format Lua code
|
||||||
})
|
})
|
||||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||||
|
|
||||||
|
|
@ -735,7 +942,74 @@ require('lazy').setup({
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'folke/flash.nvim',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
opts = {},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
's',
|
||||||
|
mode = { 'n', 'x', 'o' },
|
||||||
|
function()
|
||||||
|
require('flash').jump()
|
||||||
|
end,
|
||||||
|
desc = 'Flash Jump',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'Pocco81/auto-save.nvim',
|
||||||
|
event = { 'InsertLeave', 'TextChanged' },
|
||||||
|
config = function()
|
||||||
|
require('auto-save').setup {
|
||||||
|
enabled = true,
|
||||||
|
execution_message = {
|
||||||
|
message = function()
|
||||||
|
return '💾 AutoSaved at ' .. vim.fn.strftime '%H:%M:%S'
|
||||||
|
end,
|
||||||
|
dim = 0.18,
|
||||||
|
cleaning_interval = 1000,
|
||||||
|
},
|
||||||
|
trigger_events = { 'InsertLeave', 'TextChanged' },
|
||||||
|
condition = function(buf)
|
||||||
|
local fn = vim.fn
|
||||||
|
local utils = require 'auto-save.utils.data'
|
||||||
|
if fn.getbufvar(buf, '&modifiable') == 1 and utils.not_in(fn.getbufvar(buf, '&filetype'), {}) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'folke/persistence.nvim',
|
||||||
|
event = 'BufReadPre', -- load before buffers
|
||||||
|
opts = {},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>qs',
|
||||||
|
function()
|
||||||
|
require('persistence').load()
|
||||||
|
end,
|
||||||
|
desc = 'Restore Session',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>ql',
|
||||||
|
function()
|
||||||
|
require('persistence').load { last = true }
|
||||||
|
end,
|
||||||
|
desc = 'Restore Last Session',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>qd',
|
||||||
|
function()
|
||||||
|
require('persistence').stop()
|
||||||
|
end,
|
||||||
|
desc = "Don't Save Current Session",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{ -- Autoformat
|
{ -- Autoformat
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
event = { 'BufWritePre' },
|
event = { 'BufWritePre' },
|
||||||
|
|
@ -769,7 +1043,8 @@ require('lazy').setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
python = { 'isort', 'black' },
|
||||||
|
xml = { 'lemmix' },
|
||||||
--
|
--
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
|
@ -835,7 +1110,7 @@ require('lazy').setup({
|
||||||
-- <c-k>: Toggle signature help
|
-- <c-k>: Toggle signature help
|
||||||
--
|
--
|
||||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
preset = 'default',
|
preset = 'super-tab',
|
||||||
|
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||||
|
|
@ -901,41 +1176,26 @@ require('lazy').setup({
|
||||||
-- Highlight todo, notes, etc in comments
|
-- Highlight todo, notes, etc in comments
|
||||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||||
|
|
||||||
{ -- Collection of various small independent plugins/modules
|
{
|
||||||
'echasnovski/mini.nvim',
|
'echasnovski/mini.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
-- Better Around/Inside textobjects
|
require('mini.ai').setup {
|
||||||
--
|
n_lines = 500,
|
||||||
-- Examples:
|
custom_textobjects = {
|
||||||
-- - va) - [V]isually select [A]round [)]paren
|
f = require('mini.ai').gen_spec.treesitter({
|
||||||
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
a = '@function.outer',
|
||||||
-- - ci' - [C]hange [I]nside [']quote
|
i = '@function.inner',
|
||||||
require('mini.ai').setup { n_lines = 500 }
|
}, {}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
|
||||||
--
|
|
||||||
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
|
||||||
-- - sd' - [S]urround [D]elete [']quotes
|
|
||||||
-- - sr)' - [S]urround [R]eplace [)] [']
|
|
||||||
require('mini.surround').setup()
|
require('mini.surround').setup()
|
||||||
|
|
||||||
-- Simple and easy statusline.
|
|
||||||
-- You could remove this setup call if you don't like it,
|
|
||||||
-- and try some other statusline plugin
|
|
||||||
local statusline = require 'mini.statusline'
|
local statusline = require 'mini.statusline'
|
||||||
-- set use_icons to true if you have a Nerd Font
|
|
||||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||||
|
|
||||||
-- You can configure sections in the statusline by overriding their
|
|
||||||
-- default behavior. For example, here we set the section for
|
|
||||||
-- cursor location to LINE:COLUMN
|
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
|
||||||
statusline.section_location = function()
|
statusline.section_location = function()
|
||||||
return '%2l:%-2v'
|
return '%2l:%-2v'
|
||||||
end
|
end
|
||||||
|
|
||||||
-- ... and there is more!
|
|
||||||
-- Check out: https://github.com/echasnovski/mini.nvim
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ -- Highlight, edit, and navigate code
|
{ -- Highlight, edit, and navigate code
|
||||||
|
|
@ -944,7 +1204,7 @@ require('lazy').setup({
|
||||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'xml' },
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
|
|
@ -1014,3 +1274,9 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
vim.keymap.set('n', 'K', ':m .-2<CR>==', { desc = 'Move line up', silent = true })
|
||||||
|
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move selection up', silent = true })
|
||||||
|
|
||||||
|
-- Move current line or selected lines down with `L`
|
||||||
|
vim.keymap.set('n', 'L', ':m .+1<CR>==', { desc = 'Move line down', silent = true })
|
||||||
|
vim.keymap.set('v', 'L', ":m '>+1<CR>gv=gv", { desc = 'Move selection down', silent = true })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue