chore: Update config after a long time
This commit is contained in:
parent
a9336facf0
commit
4e0b35e4c7
37 changed files with 1145 additions and 98 deletions
|
@ -3,11 +3,11 @@ local map = vim.api.nvim_set_keymap
|
|||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Move to previous/next
|
||||
map('n', '<A-,>', '<Cmd>BufferLineCyclePrev<CR>', opts)
|
||||
map('n', '<A-.>', '<Cmd>BufferLineCycleNext<CR>', opts)
|
||||
map('n', '<A-h>', '<Cmd>BufferLineCyclePrev<CR>', opts)
|
||||
map('n', '<A-l>', '<Cmd>BufferLineCycleNext<CR>', opts)
|
||||
-- Re-order to previous/next
|
||||
map('n', '<A-<>', '<Cmd>BufferLineMovePrevious<CR>', opts)
|
||||
map('n', '<A->>', '<Cmd>BufferLineMoveNext<CR>', opts)
|
||||
map('n', '<A-H>', '<Cmd>BufferLineMovePrev<CR>', opts)
|
||||
map('n', '<A-L>', '<Cmd>BufferLineMoveNext<CR>', opts)
|
||||
-- Goto buffer in position...
|
||||
map('n', '<A-1>', '<Cmd>BufferLineGoToBuffer 1<CR>', opts)
|
||||
map('n', '<A-2>', '<Cmd>BufferLineGoToBuffer 2<CR>', opts)
|
||||
|
|
|
@ -111,14 +111,19 @@ cmp.setup {
|
|||
format = function(entry, vim_item)
|
||||
-- Kind icons
|
||||
--vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
vim_item.kind = string.format('[%s %s]', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
["vim-dadbod-completion"] = "[]",
|
||||
nvim_lua = "[LSP]",
|
||||
path = "[Path]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
if vim.tbl_contains({ "nvim_lsp" }, entry.source.name) then
|
||||
tailwind = require("tailwindcss-colorizer-cmp")
|
||||
return tailwind.formatter(entry, vim_item)
|
||||
else
|
||||
vim_item.kind = string.format('[%s %s]', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
["vim-dadbod-completion"] = "[]",
|
||||
nvim_lua = "[LSP]",
|
||||
path = "[Path]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end
|
||||
end,
|
||||
},
|
||||
sorting = {
|
||||
|
|
28
.config/nvim/lua/plugins/copilot.lua
Normal file
28
.config/nvim/lua/plugins/copilot.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
require('copilot').setup({
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<C-h>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
next = "<M-]>",
|
||||
prev = "<M-[>",
|
||||
dismiss = "<C-]>",
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
yaml = false,
|
||||
markdown = false,
|
||||
help = false,
|
||||
gitcommit = false,
|
||||
gitrebase = false,
|
||||
hgcommit = false,
|
||||
svn = false,
|
||||
cvs = false,
|
||||
["."] = false,
|
||||
},
|
||||
copilot_node_command = 'node', -- Node.js version must be > 16.x
|
||||
server_opts_overrides = {},
|
||||
})
|
|
@ -5,7 +5,6 @@ lazy.setup({
|
|||
'lewis6991/impatient.nvim',
|
||||
|
||||
-------------------------------------------THEMES------------------------------------------
|
||||
'joshdick/onedark.vim',
|
||||
{
|
||||
'catppuccin/nvim',
|
||||
lazy = false,
|
||||
|
@ -15,6 +14,14 @@ lazy.setup({
|
|||
end
|
||||
},
|
||||
-------------------------------------------------------QOL---------------------------------
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require 'plugins.copilot'
|
||||
end,
|
||||
},
|
||||
--better navigation with 's-letter'
|
||||
{
|
||||
'ggandor/leap.nvim',
|
||||
|
@ -23,6 +30,14 @@ lazy.setup({
|
|||
end
|
||||
},
|
||||
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("todo-comments").setup {}
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
'folke/zen-mode.nvim',
|
||||
config = function()
|
||||
|
@ -37,14 +52,37 @@ lazy.setup({
|
|||
'tpope/vim-obsession',
|
||||
'tpope/vim-fugitive',
|
||||
|
||||
--Database integration
|
||||
'tpope/vim-dadbod',
|
||||
{'kristijanhusak/vim-dadbod-ui',
|
||||
|
||||
{
|
||||
'NvChad/nvim-colorizer.lua',
|
||||
config = function()
|
||||
vim.g.db_ui_auto_execute_table_helpers = 1
|
||||
end
|
||||
require 'colorizer'.setup()
|
||||
end
|
||||
},
|
||||
'kristijanhusak/vim-dadbod-completion',
|
||||
|
||||
{
|
||||
"roobert/tailwindcss-colorizer-cmp.nvim",
|
||||
config = function()
|
||||
require("tailwindcss-colorizer-cmp").setup({
|
||||
color_square_width = 2,
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'laytan/tailwind-sorter.nvim',
|
||||
dependencies = {'nvim-treesitter/nvim-treesitter', 'nvim-lua/plenary.nvim'},
|
||||
build = 'cd formatter && bun i && bun run build',
|
||||
config = true,
|
||||
},
|
||||
--Database integration
|
||||
-- 'tpope/vim-dadbod',
|
||||
-- {
|
||||
-- 'kristijanhusak/vim-dadbod-ui',
|
||||
-- config = function()
|
||||
-- vim.g.db_ui_auto_execute_table_helpers = 1
|
||||
-- end
|
||||
-- },
|
||||
-- 'kristijanhusak/vim-dadbod-completion',
|
||||
|
||||
'mbbill/undotree',
|
||||
|
||||
|
@ -64,12 +102,12 @@ lazy.setup({
|
|||
end
|
||||
},
|
||||
-- Rename variable pop up
|
||||
'stevearc/dressing.nvim',
|
||||
-- 'stevearc/dressing.nvim',
|
||||
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
config = function()
|
||||
require('nvim-autopairs').setup ({
|
||||
require('nvim-autopairs').setup({
|
||||
map_cr = true,
|
||||
map_bs = true,
|
||||
})
|
||||
|
@ -115,6 +153,7 @@ lazy.setup({
|
|||
--LSP Status
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
tag = 'legacy',
|
||||
config = function()
|
||||
require('fidget').setup {
|
||||
window = {
|
||||
|
@ -140,6 +179,8 @@ lazy.setup({
|
|||
end
|
||||
},
|
||||
|
||||
'simrat39/rust-tools.nvim',
|
||||
|
||||
{
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
config = function()
|
||||
|
@ -147,12 +188,12 @@ lazy.setup({
|
|||
end
|
||||
},
|
||||
|
||||
{
|
||||
'lervag/vimtex',
|
||||
config = function()
|
||||
require 'plugins.vimtex'
|
||||
end
|
||||
},
|
||||
-- {
|
||||
-- 'lervag/vimtex',
|
||||
-- config = function()
|
||||
-- require 'plugins.vimtex'
|
||||
-- end
|
||||
-- },
|
||||
|
||||
-------------------------------------------------------------------------------------------
|
||||
-- Syntax Highlighting
|
||||
|
@ -192,13 +233,13 @@ lazy.setup({
|
|||
|
||||
|
||||
--Main menu
|
||||
{
|
||||
'startup-nvim/startup.nvim',
|
||||
dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
require('startup').setup { theme = 'dashboard' }
|
||||
end,
|
||||
},
|
||||
-- {
|
||||
-- 'startup-nvim/startup.nvim',
|
||||
-- dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' },
|
||||
-- config = function()
|
||||
-- require('startup').setup { theme = 'dashboard' }
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-------------------------------------------OTHERS----------------------------------------------
|
||||
|
||||
|
@ -214,8 +255,8 @@ lazy.setup({
|
|||
dependencies = { { "nvim-lua/plenary.nvim" } },
|
||||
},
|
||||
|
||||
'kmonad/kmonad-vim',
|
||||
'elkowar/yuck.vim',
|
||||
-- 'kmonad/kmonad-vim',
|
||||
-- 'elkowar/yuck.vim',
|
||||
--Discord Rich Presence
|
||||
'andweeb/presence.nvim'
|
||||
|
||||
|
|
|
@ -1,72 +1,82 @@
|
|||
local mason_lspconfig = require "mason-lspconfig"
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = { "lua_ls", "rust_analyzer", "texlab", "hls", "yamlls" },
|
||||
automatic_installation = true
|
||||
ensure_installed = { "lua_ls", "texlab", "hls", "yamlls" },
|
||||
automatic_installation = true
|
||||
})
|
||||
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>ge', function() vim.diagnostic.goto_next() end, bufopts)
|
||||
vim.keymap.set('n', '<space>gE', function() vim.diagnostic.goto_prev() end, bufopts)
|
||||
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
-- vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
-- pattern = '<buffer>',
|
||||
-- callback = function() vim.lsp.buf.format({ async = true }) end
|
||||
-- })
|
||||
if client.name == "yamlls" then
|
||||
client.server_capabilities.document_formatting = true
|
||||
end
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>ge', function() vim.diagnostic.goto_next() end, bufopts)
|
||||
vim.keymap.set('n', '<space>gE', function() vim.diagnostic.goto_prev() end, bufopts)
|
||||
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
end
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
-- ADD NVIM CMP AS A CAPABILITY
|
||||
local lsp_defaults = lspconfig.util.default_config
|
||||
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
'force',
|
||||
lsp_defaults.capabilities,
|
||||
require('cmp_nvim_lsp').default_capabilities()
|
||||
'force',
|
||||
lsp_defaults.capabilities,
|
||||
require('cmp_nvim_lsp').default_capabilities()
|
||||
)
|
||||
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
|
||||
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end,
|
||||
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
require("rust-tools").setup({
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
tools = {
|
||||
hover_actions = {
|
||||
auto_focus = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -6,11 +6,12 @@ null_ls.setup({
|
|||
null_ls.builtins.formatting.stylish_haskell,
|
||||
null_ls.builtins.formatting.fourmolu,
|
||||
null_ls.builtins.formatting.blue,
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
null_ls.builtins.formatting.sql_formatter.with({
|
||||
extra_args = { "--config", "/home/afonso/.config/nvim/lua/plugins/sql_formatter.json"}
|
||||
}),
|
||||
null_ls.builtins.formatting.prettierd.with({
|
||||
filetypes = { "html", "json", "yaml", "markdown" },
|
||||
filetypes = { "html", "json", "css", "js", "yaml", "markdown" },
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue