Añado mis cositas actuales para empezar

This commit is contained in:
werty534 2024-09-05 00:38:15 +02:00
parent 379a9ebc6a
commit baa9464123
2 changed files with 66 additions and 57 deletions

116
init.lua
View File

@ -104,6 +104,9 @@ vim.opt.number = true
-- Experiment for yourself to see if you like it! -- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true -- vim.opt.relativenumber = true
-- Ver colores en hexadecimal
vim.opt.termguicolors = true
-- Enable mouse mode, can be useful for resizing splits for example! -- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
@ -121,6 +124,10 @@ end)
-- Enable break indent -- Enable break indent
vim.opt.breakindent = true vim.opt.breakindent = true
-- Tabulación
vim.opt.tabstop = 4
vim.opt.shiftwidth = 0
-- Save undo history -- Save undo history
vim.opt.undofile = true vim.opt.undofile = true
@ -274,55 +281,57 @@ require('lazy').setup({
{ -- Useful plugin to show you pending keybinds. { -- Useful plugin to show you pending keybinds.
'folke/which-key.nvim', 'folke/which-key.nvim',
event = 'VimEnter', -- Sets the loading event to 'VimEnter' event = 'VimEnter', -- Sets the loading event to 'VimEnter'
opts = { config = function() -- This is the function that runs, AFTER loading
icons = { require('which-key').setup {
-- set icon mappings to true if you have a Nerd Font icons = {
mappings = vim.g.have_nerd_font, -- set icon mappings to true if you have a Nerd Font
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the mappings = vim.g.have_nerd_font,
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table -- If you are using a Nerd Font: set icons.keys to an empty table which will use the
keys = vim.g.have_nerd_font and {} or { -- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
Up = '<Up> ', keys = vim.g.have_nerd_font and {} or {
Down = '<Down> ', Up = '<Up> ',
Left = '<Left> ', Down = '<Down> ',
Right = '<Right> ', Left = '<Left> ',
C = '<C-…> ', Right = '<Right> ',
M = '<M-…> ', C = '<C-…> ',
D = '<D-…> ', M = '<M-…> ',
S = '<S-…> ', D = '<D-…> ',
CR = '<CR> ', S = '<S-…> ',
Esc = '<Esc> ', CR = '<CR> ',
ScrollWheelDown = '<ScrollWheelDown> ', Esc = '<Esc> ',
ScrollWheelUp = '<ScrollWheelUp> ', ScrollWheelDown = '<ScrollWheelDown> ',
NL = '<NL> ', ScrollWheelUp = '<ScrollWheelUp> ',
BS = '<BS> ', NL = '<NL> ',
Space = '<Space> ', BS = '<BS> ',
Tab = '<Tab> ', Space = '<Space> ',
F1 = '<F1>', Tab = '<Tab> ',
F2 = '<F2>', F1 = '<F1>',
F3 = '<F3>', F2 = '<F2>',
F4 = '<F4>', F3 = '<F3>',
F5 = '<F5>', F4 = '<F4>',
F6 = '<F6>', F5 = '<F5>',
F7 = '<F7>', F6 = '<F6>',
F8 = '<F8>', F7 = '<F7>',
F9 = '<F9>', F8 = '<F8>',
F10 = '<F10>', F9 = '<F9>',
F11 = '<F11>', F10 = '<F10>',
F12 = '<F12>', F11 = '<F11>',
F12 = '<F12>',
},
}, },
}, }
-- Document existing key chains -- Document existing key chains
spec = { require('which-key').add {
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } }, { '<leader>c', group = '[C]ode' },
{ '<leader>d', group = '[D]ocument' }, { '<leader>d', group = '[D]ocument' },
{ '<leader>r', group = '[R]ename' }, { '<leader>r', group = '[R]ename' },
{ '<leader>s', group = '[S]earch' }, { '<leader>s', group = '[S]earch' },
{ '<leader>w', group = '[W]orkspace' }, { '<leader>w', group = '[W]orkspace' },
{ '<leader>t', group = '[T]oggle' }, { '<leader>t', group = '[T]oggle' },
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
}, }
}, end,
}, },
-- NOTE: Plugins can specify dependencies. -- 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 -- 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. -- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode) local map = function(keys, func, desc)
mode = mode or 'n' vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end end
-- Jump to the definition of the word under your cursor. -- 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 -- 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. -- or a suggestion from your LSP for this to activate.
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' }) map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
-- WARN: This is not Goto Definition, this is Goto Declaration. -- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header. -- For example, in C this would take you to the header.
@ -607,8 +615,9 @@ require('lazy').setup({
local servers = { local servers = {
-- clangd = {}, -- clangd = {},
-- gopls = {}, -- gopls = {},
-- pyright = {}, pyright = {},
-- rust_analyzer = {}, asm_lsp = {},
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
-- --
-- Some languages (like typescript) have entire language plugins that can be useful: -- Some languages (like typescript) have entire language plugins that can be useful:
@ -673,7 +682,7 @@ require('lazy').setup({
{ {
'<leader>f', '<leader>f',
function() function()
require('conform').format { async = true, lsp_format = 'fallback' } require('conform').format { async = true, lsp_fallback = true }
end, end,
mode = '', mode = '',
desc = '[F]ormat buffer', desc = '[F]ormat buffer',
@ -686,21 +695,16 @@ require('lazy').setup({
-- have a well standardized coding style. You can add additional -- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones. -- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true } 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 { return {
timeout_ms = 500, timeout_ms = 500,
lsp_format = lsp_format_opt, lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
} }
end, end,
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' },
-- assembly = { 'asmfmt' },
-- --
-- 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 },
@ -929,7 +933,7 @@ require('lazy').setup({
-- --
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- 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` -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' }, { import = 'custom.plugins' },
}, { }, {
ui = { ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the -- If you are using a Nerd Font: set icons to an empty table which will use the

View File

@ -2,4 +2,9 @@
-- I promise not to create any merge conflicts in this directory :) -- I promise not to create any merge conflicts in this directory :)
-- --
-- See the kickstart.nvim README for more information -- See the kickstart.nvim README for more information
return {} return {
{
'norcalli/nvim-colorizer.lua',
opts = {},
},
}