Add new keymaps and plugins

This commit is contained in:
Gustavo Silva (es00679121_prosegur) 2023-07-12 22:53:47 +02:00
parent da87fc4247
commit ab0d9c600b
13 changed files with 203 additions and 38 deletions

View File

@ -439,7 +439,7 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc =
vim.defer_fn(function()
require('nvim-treesitter.configs').setup {
-- 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', 'bash' },
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash', 'http', 'json' },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,

View File

@ -50,3 +50,15 @@ map("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
-- Reset highlight
map("n", "<CR>", "<CMD>noh<CR><CR>")
-- Hover documentation
map("n", "K", "<CMD>lua vim.lsp.buf.hover()<CR>")
vim.keymap.set("n", '<C-k>', vim.lsp.buf.signature_help, { desc = '[S]ignature [D]ocumentation' })
-- Go to referenece
vim.keymap.set("n", "gr", require('telescope.builtin').lsp_references, { desc = '[G]oto [R]reference' })
vim.keymap.set("n", "gpd", "<CMD>lua require('goto-preview').goto_preview_definition()<CR>", { noremap = true })
vim.keymap.set("n", "gpt", "<CMD>lua require('goto-preview').goto_preview_type_definition()<CR>", { noremap = true })
vim.keymap.set("n", "gpi", "<CMD>lua require('goto-preview').goto_preview_implementation()<CR>", { noremap = true })
vim.keymap.set("n", "gP", "<CMD>lua require('goto-preview').close_all_win()<CR>", { noremap = true })
vim.keymap.set("n", "gpr", "<CMD>lua require('goto-preview').goto_preview_references()<CR>", { noremap = true })

View File

@ -42,8 +42,12 @@ o.timeoutlen = 500
-- Spell check
opt.spelllang = 'en_us'
opt.spell = true
-- opt.spell = true
-- Markdown
global.mkdp_browser = '/usr/bin/firefox'
-- Fold
--o.foldmethod = 'syntax'
o.foldmethod = 'expr'
o.foldexpr = 'nvim_treesitter#foldexpr()'

View File

@ -30,33 +30,10 @@ return {
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
local dap_go = require 'dap-go'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_setup = 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',
},
}
-- Basic debugging keymaps, feel free to change to your liking!
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'dap run/continue debug' })
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'dap step into' })
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'dap step over' })
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'dap step out' })
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'dap toggle breakpoint' })
vim.keymap.set('n', '<leader>B', function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end, { desc = 'dap breakpoint condition' })
-- Install golang specific config
dap_go.setup()
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
@ -79,14 +56,44 @@ return {
},
},
}
require('nvim-dap-virtual-text').setup()
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_setup = 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',
},
}
-- Basic debugging keymaps, feel free to change to your liking!
vim.keymap.set('n', '<F5>', dap.continue, { desc = 'dap run/continue debug' })
vim.keymap.set('n', '<F4>', dap.terminate, { desc = 'dap stop debug' })
vim.keymap.set('n', '<F1>', dap.step_into, { desc = 'dap step into' })
vim.keymap.set('n', '<F2>', dap.step_over, { desc = 'dap step over' })
vim.keymap.set('n', '<F3>', dap.step_out, { desc = 'dap step out' })
-- vim.keymap.set('n', '<leader>dr', dap.repl.open, { desc = 'dap open repl' })
vim.keymap.set('n', '<leader>td', dap_go.debug_test, { desc = 'dap debug test' })
vim.keymap.set('n', '<leader>tl', dap_go.debug_last_test, { desc = 'dap debug last test' })
vim.keymap.set('n', '<leader>b', dap.toggle_breakpoint, { desc = 'dap toggle breakpoint' })
vim.keymap.set('n', '<leader>B', function()
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end, { desc = 'dap breakpoint condition' })
-- 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)
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()
require('nvim-dap-virtual-text').setup()
end,
}

View File

@ -1,3 +1,17 @@
-- return {
-- 'fatih/vim-go',
-- }
return {
'fatih/vim-go',
"ray-x/go.nvim",
dependencies = { -- optional packages
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("go").setup()
end,
event = { "CmdlineEnter" },
ft = { "go", 'gomod' },
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
}

View File

@ -0,0 +1,6 @@
return {
'rmagatti/goto-preview',
config = function()
require('goto-preview').setup {}
end
}

View File

@ -0,0 +1,16 @@
-- lazy.nvim
return {
"folke/noice.nvim",
event = "VeryLazy",
opts = {
-- add any options here
},
dependencies = {
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
-- "rcarriga/nvim-notify",
}
}

View File

@ -8,8 +8,8 @@ return {
null_ls.setup {
sources = {
null_ls.builtins.formatting.goimports_reviser,
null_ls.builtins.formatting.gofumpt,
null_ls.builtins.formatting.golines,
-- null_ls.builtins.formatting.gofumpt,
-- null_ls.builtins.formatting.golines,
},
on_attach = function(client, bufnr)
if client.supports_method('textDocument/formatting') then

View File

@ -0,0 +1,48 @@
return {
"rest-nvim/rest.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local rest_client = require("rest-nvim")
rest_client.setup {
-- Open request results in a horizontal split
result_split_horizontal = false,
-- Keep the http file buffer above|left when split horizontal|vertical
result_split_in_place = false,
-- Skip SSL verification, useful for unknown certificates
skip_ssl_verification = false,
-- Encode URL before making request
encode_url = true,
-- Highlight request on run
highlight = {
enabled = true,
timeout = 150,
},
result = {
-- toggle showing URL, HTTP info, headers at top the of result window
show_url = true,
-- show the generated curl command in case you want to launch
-- the same request via the terminal (can be verbose)
show_curl_command = false,
show_http_info = true,
show_headers = true,
-- executables or functions for formatting response body [optional]
-- set them to false if you want to disable them
formatters = {
json = "jq",
html = function(body)
return vim.fn.system({ "tidy", "-i", "-q", "-" }, body)
end
},
},
-- Jump to request line on run
jump_to_request = false,
env_file = '.env',
custom_dynamic_variables = {},
yank_dry_run = true,
}
vim.keymap.set('n', '<leader>rc', rest_client.run, { desc = '[R]un rest [Client]' })
vim.keymap.set('n', '<leader>rl', rest_client.last, { desc = '[R]un rest [Last] request' })
end
}

View File

@ -2,9 +2,9 @@ return {
'christoomey/vim-tmux-navigator',
lazy = false,
config = function()
vim.keymap.set("n", "<c-h>", "<CMD>TmuxNavigateLeft<CR>", { desc = "tmux window left"})
vim.keymap.set("n", "<c-l>", "<CMD>TmuxNavigateRight<CR>", { desc = "tmux window right"})
vim.keymap.set("n", "<c-j>", "<CMD>TmuxNavigateDown<CR>", { desc = "tmux window down"})
vim.keymap.set("n", "<c-k>", "<CMD>TmuxNavigateUp<CR>", { desc = "tmux window up"})
vim.keymap.set("n", "<c-LEFT>", "<CMD>TmuxNavigateLeft<CR>", { desc = "tmux window left"})
vim.keymap.set("n", "<c-RIGHT>", "<CMD>TmuxNavigateRight<CR>", { desc = "tmux window right"})
vim.keymap.set("n", "<c-DOWN>", "<CMD>TmuxNavigateDown<CR>", { desc = "tmux window down"})
vim.keymap.set("n", "<c-UP>", "<CMD>TmuxNavigateUp<CR>", { desc = "tmux window up"})
end,
}

View File

@ -0,0 +1,32 @@
return {
"folke/trouble.nvim",
config = function(_, opts)
require('trouble').setup(opts)
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>",
{ silent = true, noremap = true }
)
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>",
{ silent = true, noremap = true }
)
vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>",
{ silent = true, noremap = true }
)
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>",
{ silent = true, noremap = true }
)
vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>",
{ silent = true, noremap = true }
)
vim.keymap.set("n", "gR", "<cmd>TroubleToggle lsp_references<cr>",
{ silent = true, noremap = true }
)
end,
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
},
}

View File

@ -124,3 +124,29 @@ AccountNumber
UCode
ParentUUID
ContentData
api
v2
serviceOrders
CRM
PT2300000321
ucode
ucodes
uCode
systemCode
apiVersion
serviceOrder
serviceOrderData
ServiceOrder
UUID
PT0200008165
f2d7bf7
b191
a2a
a05f
de09d4ea0e
ca5ded76a9d
d34
a893
b1177a
dataItem
CountryCode

Binary file not shown.