From baa946412365cf97a302e4c7cd0135c913823129 Mon Sep 17 00:00:00 2001 From: werty534 Date: Thu, 5 Sep 2024 00:38:15 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1ado=20mis=20cositas=20actuales=20para=20?= =?UTF-8?q?empezar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 116 +++++++++++++++++++----------------- lua/custom/plugins/init.lua | 7 ++- 2 files changed, 66 insertions(+), 57 deletions(-) diff --git a/init.lua b/init.lua index 13c8143d..df997b59 100644 --- a/init.lua +++ b/init.lua @@ -104,6 +104,9 @@ vim.opt.number = true -- Experiment for yourself to see if you like it! -- vim.opt.relativenumber = true +-- Ver colores en hexadecimal +vim.opt.termguicolors = true + -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -121,6 +124,10 @@ end) -- Enable break indent vim.opt.breakindent = true +-- Tabulación +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 0 + -- Save undo history vim.opt.undofile = true @@ -274,55 +281,57 @@ require('lazy').setup({ { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' - opts = { - icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', + config = function() -- This is the function that runs, AFTER loading + require('which-key').setup { + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, }, - }, + } -- Document existing key chains - spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + require('which-key').add { + { 'c', group = '[C]ode' }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, { 'w', group = '[W]orkspace' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - }, - }, + } + end, }, -- NOTE: Plugins can specify dependencies. @@ -505,9 +514,8 @@ require('lazy').setup({ -- -- In this case, we create a function that lets us more easily define mappings specific -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + local map = function(keys, func, desc) + vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end -- Jump to the definition of the word under your cursor. @@ -541,7 +549,7 @@ require('lazy').setup({ -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. - map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. @@ -607,8 +615,9 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + pyright = {}, + asm_lsp = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: @@ -673,7 +682,7 @@ require('lazy').setup({ { 'f', function() - require('conform').format { async = true, lsp_format = 'fallback' } + require('conform').format { async = true, lsp_fallback = true } end, mode = '', desc = '[F]ormat buffer', @@ -686,21 +695,16 @@ require('lazy').setup({ -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. local disable_filetypes = { c = true, cpp = true } - local lsp_format_opt - if disable_filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'never' - else - lsp_format_opt = 'fallback' - end return { timeout_ms = 500, - lsp_format = lsp_format_opt, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], } end, formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, + python = { 'isort', 'black' }, + -- assembly = { 'asmfmt' }, -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, @@ -929,7 +933,7 @@ require('lazy').setup({ -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..e7fdd706 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,9 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + { + 'norcalli/nvim-colorizer.lua', + opts = {}, + }, +}