From 19b91ec1c5bab7828ac8538b6f7642934908dbc0 Mon Sep 17 00:00:00 2001 From: GuillermoOM Date: Fri, 21 Mar 2025 16:30:30 -0700 Subject: [PATCH] added custom configuration --- init.lua | 60 +++++++++--------------- lua/.exrc | 77 +++++++++++++++++++++++++++++++ lua/custom/plugins/catppuccin.lua | 13 ++++++ lua/custom/plugins/lazygit.lua | 21 +++++++++ lua/custom/plugins/markview.lua | 11 +++++ lua/custom/plugins/neogen.lua | 12 +++++ lua/custom/plugins/neotest.lua | 19 ++++++++ lua/custom/plugins/nvimtree.lua | 44 ++++++++++++++++++ lua/custom/plugins/sniprun.lua | 14 ++++++ 9 files changed, 232 insertions(+), 39 deletions(-) create mode 100644 lua/.exrc create mode 100644 lua/custom/plugins/catppuccin.lua create mode 100644 lua/custom/plugins/lazygit.lua create mode 100644 lua/custom/plugins/markview.lua create mode 100644 lua/custom/plugins/neogen.lua create mode 100644 lua/custom/plugins/neotest.lua create mode 100644 lua/custom/plugins/nvimtree.lua create mode 100644 lua/custom/plugins/sniprun.lua diff --git a/init.lua b/init.lua index 1427b6c7..61d9ff61 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -403,7 +403,11 @@ require('lazy').setup({ -- i = { [''] = 'to_fuzzy_refine' }, -- }, -- }, - -- pickers = {} + pickers = { + find_files = { + hidden = true, + }, + }, extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), @@ -665,7 +669,7 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -763,7 +767,7 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, + python = { 'isort', 'black' }, -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, @@ -791,12 +795,12 @@ require('lazy').setup({ -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, }, 'saadparwaiz1/cmp_luasnip', @@ -839,13 +843,13 @@ require('lazy').setup({ -- Accept ([y]es) the completion. -- This will auto-import if your LSP supports it. -- This will expand snippets if the LSP sent a snippet. - [''] = cmp.mapping.confirm { select = true }, + -- [''] = cmp.mapping.confirm { select = true }, -- If you prefer more traditional completion keymaps, -- you can uncomment the following lines - --[''] = cmp.mapping.confirm { select = true }, - --[''] = cmp.mapping.select_next_item(), - --[''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.confirm { select = true }, + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), -- Manually trigger a completion from nvim-cmp. -- Generally you don't need this, because nvim-cmp will display @@ -889,28 +893,6 @@ require('lazy').setup({ end, }, - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - config = function() - ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { - styles = { - comments = { italic = false }, -- Disable italics in comments - }, - } - - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - end, - }, - -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, @@ -986,8 +968,8 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', @@ -997,7 +979,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/.exrc b/lua/.exrc new file mode 100644 index 00000000..a50120ee --- /dev/null +++ b/lua/.exrc @@ -0,0 +1,77 @@ +let s:cpo_save=&cpo +set cpo&vim +cnoremap (TelescopeFuzzyCommandSearch) e "lua require('telescope.builtin').command_history { default_text = [=[" . escape(getcmdline(), '"') . "]=] }"  +inoremap u +inoremap u +nnoremap   +nnoremap  +nnoremap   +nnoremap   +nmap  d +tnoremap   +nnoremap  nohlsearch +omap % (MatchitOperationForward) +xmap % (MatchitVisualForward) +nmap % (MatchitNormalForward) +nnoremap & :&& +xnoremap @ mode() ==# 'V' ? ':normal! @'.getcharstr().' ' : '@' +xnoremap Q mode() ==# 'V' ? ':normal! @=reg_recorded()  ' : 'Q' +nnoremap Y y$ +omap [% (MatchitOperationMultiBackward) +xmap [% (MatchitVisualMultiBackward) +nmap [% (MatchitNormalMultiBackward) +omap ]% (MatchitOperationMultiForward) +xmap ]% (MatchitVisualMultiForward) +nmap ]% (MatchitNormalMultiForward) +xmap a% (MatchitVisualTextObject) +omap g% (MatchitOperationBackward) +xmap g% (MatchitVisualBackward) +nmap g% (MatchitNormalBackward) +xnoremap sa :lua MiniSurround.add('visual') +nnoremap PlenaryTestFile :lua require('plenary.test_harness').test_file(vim.fn.expand("%:p")) +xmap (MatchitVisualTextObject) (MatchitVisualMultiBackward)o(MatchitVisualMultiForward) +onoremap (MatchitOperationMultiForward) :call matchit#MultiMatch("W", "o") +onoremap (MatchitOperationMultiBackward) :call matchit#MultiMatch("bW", "o") +xnoremap (MatchitVisualMultiForward) :call matchit#MultiMatch("W", "n") m'gv`` +xnoremap (MatchitVisualMultiBackward) :call matchit#MultiMatch("bW", "n") m'gv`` +nnoremap (MatchitNormalMultiForward) :call matchit#MultiMatch("W", "n") +nnoremap (MatchitNormalMultiBackward) :call matchit#MultiMatch("bW", "n") +onoremap (MatchitOperationBackward) :call matchit#Match_wrapper('',0,'o') +onoremap (MatchitOperationForward) :call matchit#Match_wrapper('',1,'o') +xnoremap (MatchitVisualBackward) :call matchit#Match_wrapper('',0,'v') m'gv`` +xnoremap (MatchitVisualForward) :call matchit#Match_wrapper('',1,'v') :if col("''") != col("$") | exe ":normal! m'" | endif gv`` +nnoremap (MatchitNormalBackward) :call matchit#Match_wrapper('',0,'n') +nnoremap (MatchitNormalForward) :call matchit#Match_wrapper('',1,'n') +nnoremap  +nnoremap  +nnoremap  +nmap d +nnoremap  +inoremap  u +inoremap  u +let &cpo=s:cpo_save +unlet s:cpo_save +set clipboard=unnamedplus +set confirm +set grepformat=%f:%l:%c:%m +set grepprg=rg\ --vimgrep\ -uu\ +set helplang=en +set ignorecase +set inccommand=split +set listchars=nbsp:␣,tab:»\ ,trail:· +set noloadplugins +set mouse=a +set packpath=/opt/nvim-linux-x86_64/share/nvim/runtime +set runtimepath=~/.config/nvim,~/.local/share/nvim/lazy/lazy.nvim,~/.local/share/nvim/lazy/cmp-nvim-lsp-signature-help,~/.local/share/nvim/lazy/cmp-path,~/.local/share/nvim/lazy/cmp_luasnip,~/.local/share/nvim/lazy/friendly-snippets,~/.local/share/nvim/lazy/LuaSnip,~/.local/share/nvim/lazy/nvim-cmp,~/.local/share/nvim/lazy/todo-comments.nvim,~/.local/share/nvim/lazy/nvim-web-devicons,~/.local/share/nvim/lazy/telescope-ui-select.nvim,~/.local/share/nvim/lazy/telescope-fzf-native.nvim,~/.local/share/nvim/lazy/plenary.nvim,~/.local/share/nvim/lazy/telescope.nvim,~/.local/share/nvim/lazy/which-key.nvim,~/.local/share/nvim/lazy/mason-nvim-dap.nvim,~/.local/share/nvim/lazy/cmp-nvim-lsp,~/.local/share/nvim/lazy/fidget.nvim,~/.local/share/nvim/lazy/mason-tool-installer.nvim,~/.local/share/nvim/lazy/mason-lspconfig.nvim,~/.local/share/nvim/lazy/mason.nvim,~/.local/share/nvim/lazy/nvim-lspconfig,~/.local/share/nvim/lazy/gitsigns.nvim,~/.local/share/nvim/lazy/vim-sleuth,~/.local/share/nvim/lazy/indent-blankline.nvim,~/.local/share/nvim/lazy/nvim-treesitter,~/.local/share/nvim/lazy/mini.nvim,~/.local/share/nvim/lazy/tokyonight.nvim,/opt/nvim-linux-x86_64/share/nvim/runtime,/opt/nvim-linux-x86_64/share/nvim/runtime/pack/dist/opt/matchit,/opt/nvim-linux-x86_64/lib/nvim,~/.local/state/nvim/lazy/readme,~/.local/share/nvim/lazy/cmp-nvim-lsp-signature-help/after,~/.local/share/nvim/lazy/cmp-path/after,~/.local/share/nvim/lazy/cmp_luasnip/after,~/.local/share/nvim/lazy/cmp-nvim-lsp/after,~/.local/share/nvim/lazy/indent-blankline.nvim/after +set scrolloff=10 +set noshowmode +set smartcase +set splitbelow +set splitright +set statusline=%{%(nvim_get_current_win()==#g:actual_curwin\ ||\ &laststatus==3)\ ?\ v:lua.MiniStatusline.active()\ :\ v:lua.MiniStatusline.inactive()%} +set termguicolors +set timeoutlen=300 +set undofile +set updatetime=250 +set window=83 +" vim: set ft=vim : diff --git a/lua/custom/plugins/catppuccin.lua b/lua/custom/plugins/catppuccin.lua new file mode 100644 index 00000000..6783eb90 --- /dev/null +++ b/lua/custom/plugins/catppuccin.lua @@ -0,0 +1,13 @@ +return { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + opts = {}, + config = function() + require('catppuccin').setup {} + vim.cmd.colorscheme 'catppuccin-macchiato' + vim.o.cursorline = true + vim.wo.signcolumn = 'auto' + vim.opt.termguicolors = true + end, +} diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua new file mode 100644 index 00000000..fe42cd23 --- /dev/null +++ b/lua/custom/plugins/lazygit.lua @@ -0,0 +1,21 @@ +-- nvim v0.8.0 +return { + 'kdheepak/lazygit.nvim', + lazy = true, + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + -- optional for floating window border decoration + dependencies = { + 'nvim-lua/plenary.nvim', + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { 'lg', 'LazyGit', desc = 'LazyGit' }, + }, +} diff --git a/lua/custom/plugins/markview.lua b/lua/custom/plugins/markview.lua new file mode 100644 index 00000000..b06adec9 --- /dev/null +++ b/lua/custom/plugins/markview.lua @@ -0,0 +1,11 @@ +-- For `plugins/markview.lua` users. +return { + 'OXY2DEV/markview.nvim', + lazy = false, + + -- For blink.cmp's completion + -- source + -- dependencies = { + -- "saghen/blink.cmp" + -- }, +} diff --git a/lua/custom/plugins/neogen.lua b/lua/custom/plugins/neogen.lua new file mode 100644 index 00000000..5bf0f28a --- /dev/null +++ b/lua/custom/plugins/neogen.lua @@ -0,0 +1,12 @@ +return { + 'danymat/neogen', + dependencies = 'nvim-treesitter/nvim-treesitter', + config = true, + -- config = function () + -- require('neogen').setup { + -- enabled = true, + -- } + -- vim.g.loaded_netrw = 1 + -- vim.g.loaded_netrwPlugin = 1 + -- end +} diff --git a/lua/custom/plugins/neotest.lua b/lua/custom/plugins/neotest.lua new file mode 100644 index 00000000..5fa08d76 --- /dev/null +++ b/lua/custom/plugins/neotest.lua @@ -0,0 +1,19 @@ +return { + 'nvim-neotest/neotest', + dependencies = { + 'nvim-neotest/nvim-nio', + 'nvim-lua/plenary.nvim', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + config = function() + require('neotest').setup { + adapters = { + require 'neotest-python' { + dap = { justMyCode = false }, + }, + }, + } + end, + keys = { { 'n', 'Neotest summary', desc = '[N]eotest Summary' } }, +} diff --git a/lua/custom/plugins/nvimtree.lua b/lua/custom/plugins/nvimtree.lua new file mode 100644 index 00000000..8e41542a --- /dev/null +++ b/lua/custom/plugins/nvimtree.lua @@ -0,0 +1,44 @@ +return { + 'nvim-tree/nvim-tree.lua', + version = '*', + lazy = false, + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local HEIGHT_RATIO = 0.8 + local WIDTH_RATIO = 0.5 + require('nvim-tree').setup { + view = { + float = { + enable = true, + open_win_config = function() + local screen_w = vim.opt.columns:get() + local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() + local window_w = screen_w * WIDTH_RATIO + local window_h = screen_h * HEIGHT_RATIO + local window_w_int = math.floor(window_w) + local window_h_int = math.floor(window_h) + local center_x = (screen_w - window_w) / 2 + local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() + return { + border = 'rounded', + relative = 'editor', + row = center_y, + col = center_x, + width = window_w_int, + height = window_h_int, + } + end, + }, + width = function() + return math.floor(vim.opt.columns:get() * WIDTH_RATIO) + end, + }, + } + end, + opts = function() + local mappings = { { 'e', 'NvimTreeOpen', desc = 'File [E]xplorer' } } + require('which-key').add(mappings) + end, +} diff --git a/lua/custom/plugins/sniprun.lua b/lua/custom/plugins/sniprun.lua new file mode 100644 index 00000000..300c6c24 --- /dev/null +++ b/lua/custom/plugins/sniprun.lua @@ -0,0 +1,14 @@ +return { + 'michaelb/sniprun', + branch = 'master', + + build = 'sh install.sh', + -- do 'sh install.sh 1' if you want to force compile locally + -- (instead of fetching a binary from the github release). Requires Rust >= 1.65 + + config = function() + require('sniprun').setup { + -- your options + } + end, +}