Skip to content

Commit

Permalink
feat(*): Cambiaron los archivos de vim a lua
Browse files Browse the repository at this point in the history
Se hicieron cambios en los archivos de configuración, temas y atajos de
teclado de lua a vim
Ref: #34
  • Loading branch information
fabianmolinab committed Apr 23, 2023
1 parent 1beb52a commit 7f74e0d
Show file tree
Hide file tree
Showing 16 changed files with 305 additions and 447 deletions.
13 changes: 13 additions & 0 deletions general/colors.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Habilitar syntax highlighting
vim.cmd('syntax on')

-- Configurar termguicolors y background
vim.opt.termguicolors = true
vim.opt.background = 'dark'

-- Configurar cursorline y cursorlineopt
vim.opt.cursorline = true
vim.opt.cursorlineopt = 'number'

-- Configurar menú de autocompletado
vim.cmd('highlight Pmenu guifg=#dee1e4 guibg=none')
52 changes: 0 additions & 52 deletions general/colors.vim

This file was deleted.

101 changes: 101 additions & 0 deletions general/keys.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
-- Deshabilita la navegación con las flechas
vim.api.nvim_set_keymap('n', '<up>', '<nop>', { noremap = true })
vim.api.nvim_set_keymap('n', '<down>', '<nop>', { noremap = true })
vim.api.nvim_set_keymap('n', '<left>', '<nop>', { noremap = true })
vim.api.nvim_set_keymap('n', '<right>', '<nop>', { noremap = true })

-- Las flechas reasignan el ancho y alto de la ventana
vim.api.nvim_set_keymap('n', '<right>', ':vertical resize +5<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<left>', ':vertical resize -5<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<up>', ':resize +5<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<down>', ':resize -5<CR>', { noremap = true, silent = true })

-- Configuración archivos
vim.api.nvim_set_keymap('n', '<Leader>w', ':w<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<Leader>q', ':q<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<Leader>Q', ':q!<CR>', { noremap = true })

-- Salir del modo Insert
vim.api.nvim_set_keymap('i', 'jj', '<Esc>', { noremap = true })

-- Salir del modo terminal
vim.api.nvim_set_keymap('t', '<esc>', '<C-\\><C-n>', { noremap = true })

-- NERDTree
vim.api.nvim_set_keymap('n', '<c-t>', '<Plug>(NERDTermToggle)', { noremap = true })
vim.api.nvim_set_keymap('t', '<c-t>', '<Plug>(NERDTermToggle)', { noremap = true })

-- Easy Motion
vim.api.nvim_set_keymap('n', 'f', '<Plug>(easymotion-s2)', {})

-- Navegación con Tmux
vim.api.nvim_set_keymap('n', '<C-h>', ':TmuxNavigateLeft<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-j>', ':TmuxNavigateDown<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-k>', ':TmuxNavigateUp<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<C-l>', ':TmuxNavigateRight<CR>', { noremap = true, silent = true })

-- Navegación entre buffers
vim.api.nvim_set_keymap('n', '<Tab>', ':bnext<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<S-Tab>', ':bprevious<CR>', {noremap = true})

-- Cerrar buffer y cerrar buffer sin guardar
vim.api.nvim_set_keymap('n', '<leader>qq', ':bdelete<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<leader>qb', ':bdelete!<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<leader>t', ':tabe<CR>', {noremap = true})

-- Vertical split
vim.api.nvim_set_keymap('n', '<leader>vs', ':vsp<CR>', {noremap = true})
-- Horizontal split
vim.api.nvim_set_keymap('n', '<leader>sp', ':sp<CR>', {noremap = true})

-- Limpiar los resultados de búsqueda
vim.api.nvim_set_keymap('n', '//', ':noh<CR>', {silent = true})

-- Telescope
-- Buscar archivos
vim.api.nvim_set_keymap('n', '<Leader>f', '<cmd>lua require(\'telescope.builtin\').find_files()<cr>', {noremap = true})
-- Buscar dentro del proyecto cualquier palabra
vim.api.nvim_set_keymap('n', '<Leader>a', '<cmd>lua require(\'telescope.builtin\').live_grep()<cr>', {noremap = true})
vim.api.nvim_set_keymap('n', '<Leader>mf', '<cmd>lua require(\'telescope.builtin\').marks()<cr>', {noremap = true})
-- Lista de commits
vim.api.nvim_set_keymap('n', '<Leader>ls', '<cmd>lua require(\'telescope.builtin\').git_commits()<cr>', {noremap = true})
-- Buscar archivos de git
vim.api.nvim_set_keymap('n', '<Leader>ag', '<cmd>lua require(\'telescope.builtin\').git_files()<cr>', {noremap = true})
-- Lista los archivos o ventanas cerradas
vim.api.nvim_set_keymap('n', '<Leader>of', '<cmd>lua require(\'telescope.builtin\').oldfiles()<cr>', {noremap = true})
-- Lista buffers o pestañas abiertos
vim.api.nvim_set_keymap('n', '<Leader>b', '<cmd>lua require(\'telescope.builtin\').buffers()<cr>', {noremap = true})

-- Todo Busqueda telescope
vim.api.nvim_set_keymap('n', '<leader>td', ':TodoTelescope<CR>', {})

-- Modo Visual indent
vim.api.nvim_set_keymap('v', '<', '<gv', {silent = true})
vim.api.nvim_set_keymap('v', '>', '>gv', {silent = true})

-- Git Diff View
vim.api.nvim_set_keymap('n', '<leader>df', ':DiffviewOpen<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<leader>dx', ':DiffviewClose<CR>', {noremap = true})

-- Git Stage hunk: Para agregar a stage lineas de cambios individuales o al contrario
vim.api.nvim_set_keymap('n', '<leader>hs', ':Gitsigns stage_hunk<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>hu', ':Gitsigns undo_stage_hunk<CR>', { noremap = true })

-- Git Stage lines
vim.api.nvim_set_keymap('v', '<leader>hs', ':Gitsigns stage_hunk<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>hu', ':Gitsigns undo_stage_hunk<CR>', { noremap = true })

-- GitSigns Preview: "Muestra una previsualización de los cambios entre lineas
vim.api.nvim_set_keymap('n', '<leader>hj', ':Gitsigns preview_hunk<CR>', { noremap = true })

-- Debuger
vim.api.nvim_set_keymap('n', '<leader>db', ':DapToggleBreakpoint<CR>', { noremap = true }) -- Punto de espera
vim.api.nvim_set_keymap('n', '<leader>dc', ':DapContinue<CR>', { noremap = true }) -- Lanzar debugger
vim.api.nvim_set_keymap('n', '<leader>ds', ':DapTerminate<CR>', { noremap = true }) -- Detener debuger

-- Lanzar y cierra interfaz debugger
vim.api.nvim_set_keymap('n', '<leader>du', ':lua require("dapui").toggle()<CR>', { noremap = true })

-- Neotree
vim.api.nvim_set_keymap('n', '<leader>p', ':NeoTreeFocusToggle<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>g', ':NeoTreeFocusToggle git_status<CR>', { noremap = true })
103 changes: 0 additions & 103 deletions general/keys.vim

This file was deleted.

39 changes: 39 additions & 0 deletions general/settings.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-- Establece el map leader
vim.g.mapleader = " "

-- Configuraciones generales
vim.o.encoding = "utf-8"
vim.o.mouse = ""
vim.o.clipboard = "unnamedplus"
vim.o.errorbells = false
vim.o.list = false
vim.o.cmdheight = 1
vim.o.sw = 2
vim.o.expandtab = true
vim.o.smartindent = true
vim.o.breakindent = true
vim.o.number = true
vim.o.rnu = true
vim.o.numberwidth = 2
vim.o.swapfile = false
vim.o.backup = false
vim.o.undodir = "~/.config/nvim/.undodir/"
vim.o.undofile = true
vim.o.incsearch = true
vim.o.ignorecase = true
vim.o.cursorline = true
vim.o.splitbelow = true
vim.o.splitright = true
vim.o.showmode = false

-- Configuración para archivos JSX grandes
vim.api.nvim_command('autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart')
vim.api.nvim_command('autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear')

-- Configuración para formatear con Eslint
vim.api.nvim_command('autocmd BufRead,BufNewFile *.astro set filetype=astro')
vim.api.nvim_command('autocmd BufWritePre *.js,*.jsx,*.ts,*.tsx,*.astro EslintFixAll')

-- Configuración de altura de ventanas flotantes
vim.o.pumheight = 6
vim.o.cmdwinheight = 6
61 changes: 0 additions & 61 deletions general/settings.vim

This file was deleted.

Loading

0 comments on commit 7f74e0d

Please sign in to comment.