diff --git a/init.lua b/init.lua index 4ce35f4b..cc67ad5c 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` @@ -102,14 +102,13 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' -- Don't show the mode, since it's already in the status line vim.opt.showmode = false - -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. @@ -129,7 +128,7 @@ vim.opt.ignorecase = true vim.opt.smartcase = true -- Keep signcolumn on by default -vim.opt.signcolumn = 'yes' +vim.opt.signcolumn = 'auto' -- Decrease update time vim.opt.updatetime = 250 @@ -155,7 +154,7 @@ vim.opt.inccommand = 'split' vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 +vim.opt.scrolloff = 15 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -176,10 +175,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -255,7 +254,6 @@ require('lazy').setup({ }, }, }, - -- NOTE: Plugins can also be configured to run Lua code when they are loaded. -- -- This is often very useful to both group configuration, as well as handle @@ -270,7 +268,6 @@ require('lazy').setup({ -- Then, because we use the `config` key, the configuration only runs -- after the plugin has been loaded: -- config = function() ... end - { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' @@ -870,14 +867,12 @@ require('lazy').setup({ -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - - -- Simple and easy statusline. + require('mini.surround').setup() -- Simple and easy statusline. -- You could remove this setup call if you don't like it, -- and try some other statusline plugin local statusline = require 'mini.statusline' -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } + statusline.setup { use_icons = true } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for @@ -891,6 +886,54 @@ require('lazy').setup({ -- Check out: https://github.com/echasnovski/mini.nvim end, }, + { + 'saghen/blink.cmp', + lazy = false, -- lazy loading handled internally + -- optional: provides snippets for the snippet source + dependencies = 'rafamadriz/friendly-snippets', + + -- use a release tag to download pre-built binaries + version = 'v0.*', + -- OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' for mappings similar to built-in completion + -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) + -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept + -- see the "default configuration" section below for full documentation on how to define + -- your own keymap. when defining your own, no keybinds will be assigned automatically. + keymap = 'enter', + + highlight = { + -- sets the fallback highlight groups to nvim-cmp's highlight groups + -- useful for when your theme doesn't support blink.cmp + -- will be removed in a future release, assuming themes add support + use_nvim_cmp_as_default = true, + }, + -- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- adjusts spacing to ensure icons are aligned + nerd_font_variant = 'normal', + + -- experimental auto-brackets support + -- accept = { auto_brackets = { enabled = true } } + + -- experimental signature help support + -- trigger = { signature_help = { enabled = true } } + }, + }, + + -- LSP servers and clients communicate what features they support through "capabilities". + -- By default, Neovim support a subset of the LSP specification. + -- With blink.cmp, Neovim has *more* capabilities which are communicated to the LSP servers. + -- Explanation from TJ: https://youtu.be/m8C0Cq9Uv9o?t=1275 + -- + -- This can vary by config, but in-general for nvim-lspconfig: + { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', @@ -926,18 +969,18 @@ 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.debug', -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- 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! @@ -967,3 +1010,124 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +-- +-- NOTE: THIS IS ROSEPINE CONFIG +-- +require('rose-pine').setup { + variant = 'main', -- auto, main, moon, or dawn + dark_variant = 'main', -- main, moon, or dawn + dim_inactive_windows = false, + extend_background_behind_borders = true, + + enable = { + terminal = true, + legacy_highlights = true, -- Improve compatibility for previous versions of Neovim + migrations = true, -- Handle deprecated options automatically + }, + + styles = { + bold = true, + italic = true, + transparency = true, + }, + + groups = { + border = 'muted', + link = 'iris', + panel = 'surface', + + error = 'love', + hint = 'iris', + info = 'foam', + note = 'pine', + todo = 'rose', + warn = 'gold', + + git_add = 'foam', + git_change = 'rose', + git_delete = 'love', + git_dirty = 'rose', + git_ignore = 'muted', + git_merge = 'iris', + git_rename = 'pine', + git_stage = 'iris', + git_text = 'rose', + git_untracked = 'subtle', + + h1 = 'iris', + h2 = 'foam', + h3 = 'rose', + h4 = 'gold', + h5 = 'pine', + h6 = 'foam', + }, + + palette = { + -- Override the builtin palette per variant + moon = { + base = '#18191a', + overlay = '#363738', + }, + }, + + highlight_groups = { + Comment = { fg = 'foam' }, + VertSplit = { fg = 'muted', bg = 'muted' }, + }, + + before_highlight = function(group, highlight, palette) + -- Disable all undercurls + -- if highlight.undercurl then + -- highlight.undercurl = false + -- end + -- + -- Change palette colour + -- if highlight.fg == palette.pine then + -- highlight.fg = palette.foam + -- end + end, +} + +vim.cmd 'colorscheme rose-pine' +-- vim.cmd("colorscheme rose-pine-main") +-- vim.cmd("colorscheme rose-pine-moon") +-- vim.cmd("colorscheme rose-pine-dawn") +-- +-- +-- +-- +-- +-- NOTE: This are my personal keybinds +-- +vim.g.vimtex_view_method = '' +vim.g.vimtex_compiler_method = 'latexmk' +vim.opt.guicursor = 'a:block' + +vim.keymap.set('v', 'J', ":m '>+1gv=gv", { desc = 'Move down' }) +vim.keymap.set('v', 'K', ":m '<-2gv=gv", { desc = 'Move up' }) + +vim.keymap.set('n', 'n', 'NerdIcons', { desc = 'Open NerdIcons' }) +vim.keymap.set({ 'n', 'v' }, '', '"*p', { desc = 'Paste from selection clipboard' }) +vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { desc = 'Paste from system clipboard' }) +vim.keymap.set({ 'v', 'n' }, 't', 'TSBufToggle highlight', { desc = 'Toggle Tree-sitter highlighting' }) +vim.keymap.set('n', 'z', ":!zathura =expand('%:r').pdf &", { desc = 'Open PDF' }) + +vim.keymap.set({ 'n' }, 'p', function() + local file_name = vim.fn.expand '%:t' + if file_name ~= '' then + -- Open Explorer in the current directory and select the file + vim.fn.system { 'explorer.exe', '/select,', file_name } + else + print 'No file name found. Save the buffer first.' + end +end, { desc = 'Open file location in Explorer' }) + +vim.keymap.set({ 'n' }, 'o', function() + local file_name = vim.fn.expand '%:t' + if file_name ~= '' then + -- Open Explorer in the current directory and select the file + vim.fn.system { 'explorer.exe', file_name } + else + print 'No file found. Make sure the buffer is saved.' + end +end, { desc = 'Open file ' }) diff --git a/lazyvim.json b/lazyvim.json new file mode 100644 index 00000000..7fd2a720 --- /dev/null +++ b/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "7429" + }, + "version": 7 +} \ No newline at end of file diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 00000000..1335e431 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,15 @@ +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, + { out, 'WarningMsg' }, + { '\nPress any key to exit...' }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) diff --git a/lua/custom/plugins/dashboard.lua b/lua/custom/plugins/dashboard.lua new file mode 100644 index 00000000..3061293b --- /dev/null +++ b/lua/custom/plugins/dashboard.lua @@ -0,0 +1,18 @@ +return { + 'nvimdev/dashboard-nvim', + event = 'VimEnter', + theme = 'hyper', + config = function() + require('dashboard').setup { + -- config + -- + } + end, + hide = { + statusline, -- hide statusline default is true + tabline, -- hide the tabline + winbar, -- hide winbar + }, + + dependencies = { { 'nvim-tree/nvim-web-devicons' } }, +} diff --git a/lua/custom/plugins/emoji.lua b/lua/custom/plugins/emoji.lua new file mode 100755 index 00000000..b96a0a55 --- /dev/null +++ b/lua/custom/plugins/emoji.lua @@ -0,0 +1 @@ +return { "xiyaowong/telescope-emoji" } diff --git a/lua/custom/plugins/gitflog.lua b/lua/custom/plugins/gitflog.lua new file mode 100644 index 00000000..0e815c23 --- /dev/null +++ b/lua/custom/plugins/gitflog.lua @@ -0,0 +1,8 @@ +return { + "rbong/vim-flog", + lazy = true, + cmd = { "Flog", "Flogsplit", "Floggit" }, + dependencies = { + "tpope/vim-fugitive", + }, +} diff --git a/lua/custom/plugins/gitgraph.lua b/lua/custom/plugins/gitgraph.lua new file mode 100644 index 00000000..5fb4d6bc --- /dev/null +++ b/lua/custom/plugins/gitgraph.lua @@ -0,0 +1,32 @@ +return { + 'isakbm/gitgraph.nvim', + ---@type I.GGConfig + opts = { + symbols = { + merge_commit = 'M', + commit = '*', + + }, + format = { + timestamp = '%H:%M:%S %d-%m-%Y', + fields = { 'hash', 'timestamp', 'author', 'branch_name', 'tag' }, + }, + hooks = { + on_select_commit = function(commit) + print('selected commit:', commit.hash) + end, + on_select_range_commit = function(from, to) + print('selected range:', from.hash, to.hash) + end, + }, + }, + keys = { + { + "gl", + function() + require('gitgraph').draw({}, { all = true, max_count = 5000 }) + end, + desc = "GitGraph - Draw", + }, + }, +} diff --git a/lua/custom/plugins/inc-rename.lua b/lua/custom/plugins/inc-rename.lua new file mode 100644 index 00000000..77bf4f9c --- /dev/null +++ b/lua/custom/plugins/inc-rename.lua @@ -0,0 +1,5 @@ +return { + 'smjonas/inc-rename.nvim', + cmd = 'IncRename', + opts = {}, +} diff --git a/lua/custom/plugins/nerdicons.lua b/lua/custom/plugins/nerdicons.lua new file mode 100644 index 00000000..6e9b7a2b --- /dev/null +++ b/lua/custom/plugins/nerdicons.lua @@ -0,0 +1,7 @@ +return { + "glepnir/nerdicons.nvim", + cmd = "NerdIcons", + config = function() + require("nerdicons").setup({}) + end, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 00000000..c4245ef7 --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -0,0 +1,7 @@ +return { + 'folke/noice.nvim', + optional = true, + opts = { + presets = { inc_rename = true }, + }, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000..ace20dcc --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,60 @@ +return { + "stevearc/oil.nvim", + config = function() + local oil = require("oil") + oil.setup({ + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + + skip_confirm_for_simple_edits = true, + + view_options = { + -- Show files and directories that start with "." + show_hidden = true, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + return vim.startswith(name, ".") + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + -- Sort file names in a more intuitive order for humans. Is less performant, + -- so you may want to set to false if you work with large directories. + natural_order = true, + -- Sort file and directory names case insensitive + case_insensitive = false, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { "type", "asc" }, + { "name", "asc" }, + }, + }, + float = { + -- Padding around the floating window + padding = 4, + max_width = 100, + max_height = 15, + border = "rounded", + win_options = { + winblend = 0, + }, + -- optionally override the oil buffers window title with custom function: fun(winid: integer): string + get_win_title = nil, + -- preview_split: Split direction: "auto", "left", "right", "above", "below". + preview_split = "auto", + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + override = function(conf) + return conf + end, + }, + }) + + vim.keymap.set("n", "-", "Oil", { desc = "Open oil" }) + vim.keymap.set("n", "-", oil.toggle_float, {}) + end, +} diff --git a/lua/custom/plugins/plugins.lua b/lua/custom/plugins/plugins.lua new file mode 100755 index 00000000..0f84ddf7 --- /dev/null +++ b/lua/custom/plugins/plugins.lua @@ -0,0 +1,9 @@ +return { + "stevearc/aerial.nvim", + opts = {}, + -- Optional dependencies + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons", + }, +} diff --git a/lua/custom/plugins/rose-pine.lua b/lua/custom/plugins/rose-pine.lua new file mode 100644 index 00000000..28b2599d --- /dev/null +++ b/lua/custom/plugins/rose-pine.lua @@ -0,0 +1 @@ +return { "rose-pine/neovim", name = "rose-pine" } diff --git a/lua/custom/plugins/snacks.lua b/lua/custom/plugins/snacks.lua new file mode 100644 index 00000000..e84da36d --- /dev/null +++ b/lua/custom/plugins/snacks.lua @@ -0,0 +1,154 @@ +return { + 'folke/snacks.nvim', + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = { enabled = true }, + dashboard = { enabled = true }, + notifier = { + enabled = true, + timeout = 3000, + }, + quickfile = { enabled = true }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + styles = { + notification = { + wo = { wrap = true }, -- Wrap notifications + }, + }, + }, + keys = { + { + 'un', + function() + Snacks.notifier.hide() + end, + desc = 'Dismiss All Notifications', + }, + { + 'bd', + function() + Snacks.bufdelete() + end, + desc = 'Delete Buffer', + }, + { + 'gg', + function() + Snacks.lazygit() + end, + desc = 'Lazygit', + }, + { + 'gb', + function() + Snacks.git.blame_line() + end, + desc = 'Git Blame Line', + }, + { + 'gB', + function() + Snacks.gitbrowse() + end, + desc = 'Git Browse', + }, + { + 'gf', + function() + Snacks.lazygit.log_file() + end, + desc = 'Lazygit Current File History', + }, + { + 'gl', + function() + Snacks.lazygit.log() + end, + desc = 'Lazygit Log (cwd)', + }, + { + 'cR', + function() + Snacks.rename.rename_file() + end, + desc = 'Rename File', + }, + { + '', + function() + Snacks.terminal() + end, + desc = 'Toggle Terminal', + }, + { + '', + function() + Snacks.terminal() + end, + desc = 'which_key_ignore', + }, + { + ']]', + function() + Snacks.words.jump(vim.v.count1) + end, + desc = 'Next Reference', + mode = { 'n', 't' }, + }, + { + '[[', + function() + Snacks.words.jump(-vim.v.count1) + end, + desc = 'Prev Reference', + mode = { 'n', 't' }, + }, + { + 'N', + desc = 'Neovim News', + function() + Snacks.win { + file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1], + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = 'yes', + statuscolumn = ' ', + conceallevel = 3, + }, + } + end, + }, + }, + init = function() + vim.api.nvim_create_autocmd('User', { + pattern = 'VeryLazy', + callback = function() + -- Setup some globals for debugging (lazy-loaded) + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd -- Override print to use snacks for `:=` command + + -- Create some toggle mappings + Snacks.toggle.option('spell', { name = 'Spelling' }):map 'us' + Snacks.toggle.option('wrap', { name = 'Wrap' }):map 'uw' + Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map 'uL' + Snacks.toggle.diagnostics():map 'ud' + Snacks.toggle.line_number():map 'ul' + Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map 'uc' + Snacks.toggle.treesitter():map 'uT' + Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map 'ub' + Snacks.toggle.inlay_hints():map 'uh' + end, + }) + end, +} diff --git a/lua/custom/plugins/supermaven.lua b/lua/custom/plugins/supermaven.lua new file mode 100644 index 00000000..cf881347 --- /dev/null +++ b/lua/custom/plugins/supermaven.lua @@ -0,0 +1,8 @@ +return { + { + "supermaven-inc/supermaven-nvim", + config = function() + require("supermaven-nvim").setup({}) + end, + }, +} diff --git a/lua/custom/plugins/tmux-vim.lua b/lua/custom/plugins/tmux-vim.lua new file mode 100755 index 00000000..4421fed9 --- /dev/null +++ b/lua/custom/plugins/tmux-vim.lua @@ -0,0 +1,17 @@ +return { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + keys = { + { "", "TmuxNavigateLeft" }, + { "", "TmuxNavigateDown" }, + { "", "TmuxNavigateUp" }, + { "", "TmuxNavigateRight" }, + { "", "TmuxNavigatePrevious" }, + }, +} diff --git a/lua/custom/plugins/vimtex.lua b/lua/custom/plugins/vimtex.lua new file mode 100644 index 00000000..d246d642 --- /dev/null +++ b/lua/custom/plugins/vimtex.lua @@ -0,0 +1,32 @@ +return { + { + "lervag/vimtex", + lazy = false, -- we don't want to lazy load VimTeX + -- tag = "v2.15", -- uncomment to pin to a specific release + init = function() + -- VimTeX configuration goes here, e.g. + vim.g.vimtex_view_general_viewer = "" + vim.g.vimtex_view_general_options = "" + vim.g.vimtex_view_method = "" + vim.g.vimtex_compiler_method = "latexmk" + vim.g.vimtex_view_general_options = '--unique file:@pdf""#src:@line@tex' + vim.g.tex_conceal = "abdmg" + vim.g.tex_flavor = "latex" + vim.g.vimtex_syntax_conceal = { + accents = true, + ligatures = true, + cites = true, + fancy = true, + spacing = true, + greek = true, + math_bounds = true, + math_delimiters = true, + math_fracs = true, + math_super_sub = true, + math_symbols = true, + sections = true, + styles = true, + } + end, + }, +} diff --git a/lua/custom/plugins/wakatime.lua b/lua/custom/plugins/wakatime.lua new file mode 100644 index 00000000..e151fc34 --- /dev/null +++ b/lua/custom/plugins/wakatime.lua @@ -0,0 +1 @@ +return { "wakatime/vim-wakatime", lazy = false }