Update .gitmodules

Update .config/nvim/init.lua
Add .config/nvim/pack/plugins/start/chadtree
This commit is contained in:
Anthony Rodriguez 2024-07-22 18:02:02 +02:00
parent 7d9fccfd60
commit 8a5e461840
2 changed files with 25 additions and 2 deletions

3
.gitmodules vendored
View file

@ -17,3 +17,6 @@
[submodule "dot_config/nvim/pack/plugins/start/auto-pairs"] [submodule "dot_config/nvim/pack/plugins/start/auto-pairs"]
path = dot_config/nvim/pack/plugins/start/auto-pairs path = dot_config/nvim/pack/plugins/start/auto-pairs
url = https://github.com/jiangmiao/auto-pairs url = https://github.com/jiangmiao/auto-pairs
[submodule "dot_config/nvim/pack/plugins/start/chadtree"]
path = dot_config/nvim/pack/plugins/start/chadtree
url = https://github.com/ms-jpq/chadtree

View file

@ -3,6 +3,9 @@ vim.cmd.colorscheme "catppuccin-frappe"
vim.g.mapleader = " " vim.g.mapleader = " "
vim.wo.relativenumber = true vim.wo.relativenumber = true
-- CHADTree
vim.api.nvim_set_keymap('n', '<leader>v', '<cmd>CHADopen<CR>', { noremap = true, silent = true })
-- Telescope -- Telescope
local builtin = require('telescope.builtin') local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
@ -70,5 +73,22 @@ vim.api.nvim_create_autocmd("LspAttach", {
end, end,
}) })
-- Formatting -- Function to format the current buffer on save
vim.api.nvim_set_keymap('n', '<leader>qf', '<cmd>lua vim.lsp.buf.format()<CR>', { noremap = true, silent = true }) local function lsp_format_on_save(bufnr)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end
-- Create an autocmd for LspAttach event
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local bufnr = args.buf
-- Set up the buffer-local autocmd for formatting on save
lsp_format_on_save(bufnr)
end,
})