diff --git a/init.lua b/init.lua index 6e3b8f72..593ec2ec 100644 --- a/init.lua +++ b/init.lua @@ -22,6 +22,7 @@ What is Kickstart? + Kickstart.nvim is *not* a distribution. Kickstart.nvim is a starting point for your own configuration. @@ -91,7 +92,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 = true +vim.g.have_nerd_font = false -- [[ Setting options ]] -- See `:help vim.opt` @@ -102,13 +103,14 @@ vim.g.have_nerd_font = true 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. @@ -128,7 +130,7 @@ vim.opt.ignorecase = true vim.opt.smartcase = true -- Keep signcolumn on by default -vim.opt.signcolumn = 'auto' +vim.opt.signcolumn = 'yes' -- Decrease update time vim.opt.updatetime = 250 @@ -154,7 +156,7 @@ vim.opt.inccommand = 'split' vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 15 +vim.opt.scrolloff = 10 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -175,10 +177,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 @@ -254,6 +256,7 @@ 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 @@ -268,6 +271,7 @@ 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' @@ -868,12 +872,14 @@ 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 = true } + statusline.setup { use_icons = vim.g.have_nerd_font } -- You can configure sections in the statusline by overriding their -- default behavior. For example, here we set the section for @@ -887,54 +893,6 @@ 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', @@ -971,10 +929,10 @@ require('lazy').setup({ -- 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.indent_line', require 'kickstart.plugins.lint', require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', + -- 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` @@ -982,7 +940,6 @@ require('lazy').setup({ -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. { import = 'custom.plugins' }, - -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! @@ -1012,9 +969,9 @@ 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 --- + +-- NOTE: addietions + require('rose-pine').setup { variant = 'main', -- auto, main, moon, or dawn dark_variant = 'main', -- main, moon, or dawn @@ -1101,9 +1058,15 @@ vim.cmd 'colorscheme rose-pine' -- -- 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('n', 'e', 'Telescope emoji', { desc = 'Open NerdIcons' }) +vim.cmd [[ + autocmd CmdwinEnter * q +]] vim.keymap.set('n', 'n', 'NerdIcons', { desc = 'Open NerdIcons' }) vim.keymap.set({ 'n', 'v' }, '', '"*p', { desc = 'Paste from selection clipboard' }) @@ -1134,9 +1097,9 @@ end, { desc = 'Open file ' }) -- NOTE: THESE ARE FROM https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua vim.keymap.set({ 'n', 'x' }, 'j', "v:count == 0 ? 'gj' : 'j'", { desc = 'Down', expr = true, silent = true }) -vim.keymap.set({ 'n', 'x' }, '', "v:count == 0 ? 'gj' : 'j'", { desc = 'Down', expr = true, silent = true }) +-- vim.keymap.set({ 'n', 'x' }, '', "v:count == 0 ? 'gj' : 'j'", { desc = 'Down', expr = true, silent = true }) vim.keymap.set({ 'n', 'x' }, 'k', "v:count == 0 ? 'gk' : 'k'", { desc = 'Up', expr = true, silent = true }) -vim.keymap.set({ 'n', 'x' }, '', "v:count == 0 ? 'gk' : 'k'", { desc = 'Up', expr = true, silent = true }) +-- vim.keymap.set({ 'n', 'x' }, '', "v:count == 0 ? 'gk' : 'k'", { desc = 'Up', expr = true, silent = true }) -- to window using the hjkl keys vim.keymap.set('n', '', 'h', { desc = 'Go to Left Window', remap = true }) @@ -1174,3 +1137,226 @@ if vim.fn.has 'nvim-0.11' == 0 then return vim.snippet.active { direction = -1 } and 'lua vim.snippet.jump(-1)' or '' end, { expr = true, desc = 'Jump Previous' }) end +-- inc rename + +vim.keymap.set('n', 'cr', function() + return ':IncRename ' .. vim.fn.expand '' +end, { expr = true }) + +-- NOTE: END OF LINE CHARS +vim.opt.fillchars = { eob = ' ' } +-- NOTE: LULALINE CONFIG +-- +-- +local lualine = require 'lualine' + +-- Color table for highlights +-- stylua: ignore +local colors = { + bg = '#191724', + fg = '#26233a', + yellow = '#f6c177', + cyan = '#9ccfd8', + darkblue = '#31748f', + green = '#31748f', + orange = '#ebbcba', + violet = '#c4a7e7', + magenta = '#c4a7e7', + blue = '#31748f', + red = 'eb6f92', +} + +local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand '%:t') ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand '%:p:h' + local gitdir = vim.fn.finddir('.git', filepath .. ';') + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, +} + +-- Config +-- +-- + +local config = { + options = { + -- Disable sections and component separators + component_separators = '', + section_separators = '', + theme = { + -- We are going to use lualine_c an lualine_x as left and + -- right section. Both are highlighted by c theme . So we + -- are just setting default looks o statusline + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, + }, + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, +} + +-- Inserts a component in lualine_c at left section +local function ins_left(component) + table.insert(config.sections.lualine_c, component) +end + +-- Inserts a component in lualine_x at right section +local function ins_right(component) + table.insert(config.sections.lualine_x, component) +end + +ins_left { + function() + return '▊' + end, + color = { fg = colors.blue }, -- Sets highlighting of component + padding = { left = 0, right = 1 }, -- We don't need space before this +} + +ins_left { + -- mode component + function() + return '' + end, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.red, + i = colors.green, + v = colors.blue, + [''] = colors.blue, + V = colors.blue, + c = colors.magenta, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.violet, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { right = 1 }, +} + +ins_left { + -- filesize component + 'filesize', + cond = conditions.buffer_not_empty, + color = { fg = colors.yellow }, +} + +ins_left { + 'filename', + cond = conditions.buffer_not_empty, + color = { fg = colors.magenta, gui = 'bold' }, +} + +ins_left { 'location', color = { fg = colors.yellow } } + +-- Insert mid section. You can make any number of sections in neovim :) +-- for lualine it's any number greater then 2 +ins_left { + function() + return '%=' + end, +} + +ins_left { + icon = ' LSP:', + color = { fg = '#ffffff', gui = 'bold' }, + 'filetype', + -- -- Lsp server name . + -- function() + -- local msg = 'No Active Lsp' + -- local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) + -- local clients = vim.lsp.get_clients() + -- if next(clients) == nil then + -- return msg + -- end + -- for _, client in ipairs(clients) do + -- local filetypes = client.config.filetypes + -- if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + -- return client.name + -- end + -- end + -- return msg + -- end, +} + +-- Add components to right sections +-- ins_right { +-- 'o:encoding', -- option component same as &encoding in viml +-- fmt = string.upper, -- I'm not sure why it's upper case either ;) +-- cond = conditions.hide_in_width, +-- color = { fg = colors.green, gui = 'bold' }, +-- } + +-- ins_right { +-- 'fileformat', +-- fmt = string.upper, +-- icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh +-- color = { fg = colors.green, gui = 'bold' }, +-- } + +ins_right { + 'branch', + icon = '', + color = { fg = colors.violet, gui = 'bold' }, +} + +ins_right { + 'diff', + -- Is it me or the symbol for modified us really weird + symbols = { added = ' ', modified = '󰬊 ', removed = ' ' }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, +} + +ins_right { + function() + return '▊' + end, + color = { fg = colors.blue }, + padding = { left = 1 }, +} + +-- Now don't forget to initialize lualine +lualine.setup(config) + +vim.api.nvim_set_hl(0, 'CursorLine', { bg = '#191724' }) -- Use a darker or blended color diff --git a/lua/custom/keybinds/binds.lua b/lua/custom/keybinds/binds.lua deleted file mode 100644 index e0a2ec96..00000000 --- a/lua/custom/keybinds/binds.lua +++ /dev/null @@ -1,34 +0,0 @@ -return { - 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/lua/custom/plugins/alpha.lua b/lua/custom/plugins/alpha.lua new file mode 100644 index 00000000..98861209 --- /dev/null +++ b/lua/custom/plugins/alpha.lua @@ -0,0 +1,133 @@ +return { + + 'goolord/alpha-nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local alpha = require 'alpha' + local dashboard = require 'alpha.themes.dashboard' + + _Gopts = { + position = 'center', + hl = 'Type', + wrap = 'overflow', + } + + -- DASHBOARD HEADER + + local function getGreeting(name) + local tableTime = os.date '*t' + local datetime = os.date ' %Y-%m-%d-%A  %H:%M:%S ' + local hour = tableTime.hour + local greetingsTable = { + [1] = ' Sleep well', + [2] = ' Good morning', + [3] = ' Good afternoon', + [4] = ' Good evening', + [5] = '󰖔 Good night', + } + local greetingIndex = 0 + if hour == 23 or hour < 7 then + greetingIndex = 1 + elseif hour < 12 then + greetingIndex = 2 + elseif hour >= 12 and hour < 18 then + greetingIndex = 3 + elseif hour >= 18 and hour < 21 then + greetingIndex = 4 + elseif hour >= 21 then + greetingIndex = 5 + end + return datetime .. ' ' .. greetingsTable[greetingIndex] .. ', ' .. name + end + + local logo = [[ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⢔⢅⠣⡣⢑⠅⡇⣆⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠤⡐⢌⢆⠣⡱⡨⢂⠕⠬⡨⢪⣠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢊⠐⠌⠔⣁⢦⣣⢵⢬⡢⣃⠅⡉⠺⡮⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠠⢕⢣⢳⡸⣌⠮⢓⡹⣺⢔⣔⣐⢑⢌⠪⡮⠁⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⣀⡦⢗⡞⣟⢮⢥⢀⠣⡗⠉⢳⢹⢪⡫⢞⡮⣖⡥⡣⠺⠀⠀⠀⠀⠀⢀⠠⠈⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⢕⡺⡶⡴⣁⡹⡱⢷⡑⡕⢅⠘⠮⣍⢧⢷⡸⡢⡑⢕⠫⡯⡳⣄⠀⠀⡐⠈⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠀⠀⢀⢪⡨⢓⡐⣈⠫⠓⡆⠍⠅⠣⡘⡈⢧⢸⢵⢱⡱⢩⢝⡔⡢⢑⢽⢝⡮⣳⡨⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⡧⡤⡎⡚⡉⡅⡋⣊⢝⢼⠇⣌⠌⡆⠙⡺⡬⡇⡇⠅⡢⠑⡑⣵⡳⣆⡂⡝⢪⢣⡻⣪⢆⡀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡏⡜⢜⠍⠲⠢⡨⡫⡵⠗⢧⣢⡁⠜⠀⡌⢝⢌⡇⠅⠌⠢⡉⡮⡎⠌⢌⠚⣧⡳⣝⢮⡫⣞⡀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡣⠞⡣⡢⡑⠡⠑⡦⡊⢎⠉⢌⢚⠄⠪⡘⢜⢼⠂⡡⠠⡈⢄⠪⠸⢭⢌⠝⡘⠕⡎⠕⡝⡮⡪⢄⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⢐⢊⢚⠧⢚⡵⣌⣑⠅⢨⢑⢐⠀⠡⠡⣀⠁⢄⢇⡧⠠⠐⠅⡂⠌⠂⠀⢓⢕⢮⢰⢅⠹⡨⡊⢎⡎⡎⡆⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠘⣀⣲⢽⣸⡔⠀⣀⠡⠺⠐⠁⡱⡝⣬⢖⡝⠡⢊⢔⢢⠑⡐⠅⡈⠀⠀⢌⢎⠕⡕⡕⣇⠕⡬⡂⠱⡕⡵⡀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠥⠩⡓⡕⡍⣹⠁⠄⡬⢐⢀⢴⢯⣳⢕⠥⡑⣙⢜⢔⠅⠂⠨⠀⡠⠀⠜⠬⡨⣘⠸⣜⢬⠂⡑⢡⢪⢪⢣⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⡣⣊⡂⡂⠅⠈⢒⢚⡱⡮⡫⡕⢏⠮⢫⢚⠳⠌⡮⣀⢀⠀⠄⢄⠢⠀⠂⡈⡲⡕⡸⡵⡱⡀⠄⠂⢁⠳⡀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠊⣗⢾⠴⡐⡐⡯⠏⣪⠦⠬⢥⠏⠦⡡⡝⡣⡨⡌⡄⠌⡈⠄⠕⠌⡐⡀⡴⡕⡼⡱⡓⢔⠐⠈⠀⠨⠈⠂⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢊⢆⢇⢇⡳⢙⢲⠺⠭⠬⡉⣐⢰⡣⣈⢂⠥⡀⢀⠀⢢⢈⠠⠀⢄⡯⢮⢫⡪⡣⣃⠪⠈⠀⠄⢑⠀⠄ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠢⡑⣈⢾⡸⣪⠲⣋⢭⣍⡡⠖⣌⡐⣔⠸⡌⡃⠌⠤⡰⣐⡐⣰⠼⠵⡝⢕⠱⡑⢵⢕⠇⠈⠀⠀⡳⣐⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡂⢐⡡⡔⢖⢕⢬⢤⣫⡈⡧⢆⢕⠪⡆⡪⠈⡔⡉⡪⢨⢪⠪⡢⣣⢣⠫⠡⠱⠡⡑⡌⡇⠏⠀⠠⠈⠀⢀⠠⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠔⡨⢪⠱⠨⠨⢒⢊⠲⡱⣪⠺⣍⢂⠵⡘⣘⡠⡣⡣⡒⡬⠠⢱⠱⣱⢕⠥⡨⡸⠸⢜⢜⠬⠊⠀⢀⠐⡀⠌⠠⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢄⠢⡢⠢⠊⠆⢅⠢⡑⢌⠢⢑⠐⢕⢝⠀⠉⡧⡘⡀⢢⠪⠘⠌⠎⢈⢎⠬⠐⠌⠊⠈⠄⠀⡀⢀⠀⢀⠠⠠⠀⡀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⡠⡴⠼⢜⢌⠪⡠⢥⢁⠪⢐⠔⢄⢕⢌⡀⠐⠀⠡⠉⠎⠊⢀⠐⢀⢠⠅⠇⠋⠨⠀⠂⠁⠀⠀⡈⠠⠀⠄⠠⠀⠄⠀⠅⠊⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⢀⢄⣄⠀⠀⠀⠀⢄⢖⠁⡎⠪⡣⢅⢓⢜⡐⢕⢕⠂⠌⡊⠢⢑⠘⠘⢈⠂⠂⠃⠑⠐⠈⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢐⠐⡨⠀⠢⠈⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢁⠢⢊⡠⢂⠢⡲⠑⡌⠪⠉⠀⠀⠠⠘⠔⢅⠣⠡⠂⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⡀⢀⠀⠀⢀⢓⠃⢂⠡⠴⢑⠗⠠⡅⡮⡨⡂⢝⡥⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠆⠁⠀⠀⠅⡀⠀⠀⠁⠀⠀⠀⠈⠈⠈⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠆⠀⠐⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ + ]] + + local userName = 'Lazy' + local greeting = getGreeting(userName) + local marginBottom = 0 + dashboard.section.header.val = vim.split(logo, '\n') + + -- Split logo into lines + local logoLines = {} + for line in logo:gmatch '[^\r\n]+' do + table.insert(logoLines, line) + end + + -- Calculate padding for centering the greeting + local logoWidth = logo:find '\n' - 1 -- Assuming the logo width is the width of the first line + local greetingWidth = #greeting + local padding = math.floor((logoWidth - greetingWidth) / 2) + + -- Generate spaces for padding + local paddedGreeting = string.rep(' ', padding) .. greeting + + -- Add margin lines below the padded greeting + local margin = string.rep('\n', marginBottom) + + -- Concatenate logo, padded greeting, and margin + local adjustedLogo = logo .. '\n' .. paddedGreeting .. margin + + dashboard.section.buttons.val = { + dashboard.button('n', ' New file', ':ene startinsert '), + dashboard.button('f', ' Find file', ':cd $HOME | silent Telescope find_files hidden=true no_ignore=true '), + dashboard.button('t', ' Find text', ':Telescope live_grep '), + dashboard.button('r', '󰄉 Recent files', ':Telescope oldfiles '), + dashboard.button('u', '󱐥 Update plugins', 'Lazy update'), + dashboard.button('c', ' Settings', ':e $HOME/.config/nvim/init.lua'), + dashboard.button('p', ' Projects', ':e $HOME/git '), + dashboard.button('d', '󱗼 Dotfiles', ':e $HOME/.dotfiles '), + dashboard.button('q', '󰿅 Quit', 'qa'), + } + + -- local function footer() + -- return "Footer Text" + -- end + + -- dashboard.section.footer.val = vim.split('\n\n' .. getGreeting 'Lazy', '\n') + + vim.api.nvim_create_autocmd('User', { + pattern = 'LazyVimStarted', + desc = 'Add Alpha dashboard footer', + once = true, + callback = function() + local stats = require('lazy').stats() + local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 + dashboard.section.footer.val = { ' ', ' ', ' ', ' Loaded ' .. stats.count .. ' plugins  in ' .. ms .. ' ms ' } + dashboard.section.header.opts.hl = 'DashboardFooter' + pcall(vim.cmd.AlphaRedraw) + end, + }) + + dashboard.opts.opts.noautocmd = true + alpha.setup(dashboard.opts) + end, +} diff --git a/lua/custom/plugins/dashboard.lua b/lua/custom/plugins/dashboard.lua deleted file mode 100644 index 3061293b..00000000 --- a/lua/custom/plugins/dashboard.lua +++ /dev/null @@ -1,18 +0,0 @@ -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/inc-rename.lua b/lua/custom/plugins/inc-rename.lua index 77bf4f9c..cc0089f9 100644 --- a/lua/custom/plugins/inc-rename.lua +++ b/lua/custom/plugins/inc-rename.lua @@ -1,5 +1,6 @@ return { 'smjonas/inc-rename.nvim', - cmd = 'IncRename', - opts = {}, + config = function() + require('inc_rename').setup() + end, } diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..2f7b6274 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,74 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + + { + 'folke/ts-comments.nvim', + opts = { + { + lang = { + astro = '', + axaml = '', + blueprint = '// %s', + c = '// %s', + c_sharp = '// %s', + clojure = { ';; %s', '; %s' }, + cpp = '// %s', + cs_project = '', + cue = '// %s', + fsharp = '// %s', + fsharp_project = '', + gleam = '// %s', + glimmer = '{{! %s }}', + graphql = '# %s', + handlebars = '{{! %s }}', + hcl = '# %s', + html = '', + hyprlang = '# %s', + ini = '; %s', + ipynb = '# %s', + javascript = { + '// %s', -- default commentstring when no treesitter node matches + '/* %s */', + call_expression = '// %s', -- specific commentstring for call_expression + jsx_attribute = '// %s', + jsx_element = '{/* %s */}', + jsx_fragment = '{/* %s */}', + spread_element = '// %s', + statement_block = '// %s', + }, + kdl = '// %s', + php = '// %s', + rego = '# %s', + rescript = '// %s', + rust = { '// %s', '/* %s */' }, + sql = '-- %s', + styled = '/* %s */', + svelte = '', + templ = { + '// %s', + component_block = '', + }, + terraform = '# %s', + tsx = { + '// %s', -- default commentstring when no treesitter node matches + '/* %s */', + call_expression = '// %s', -- specific commentstring for call_expression + jsx_attribute = '// %s', + jsx_element = '{/* %s */}', + jsx_fragment = '{/* %s */}', + spread_element = '// %s', + statement_block = '// %s', + }, + twig = '{# %s #}', + typescript = { '// %s', '/* %s */' }, -- langs can have multiple commentstrings + vue = '', + xaml = '', + }, + }, + }, + event = 'VeryLazy', + enabled = vim.fn.has 'nvim-0.10.0' == 1, + }, +} diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua new file mode 100644 index 00000000..13fff713 --- /dev/null +++ b/lua/custom/plugins/lualine.lua @@ -0,0 +1,4 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua index c4245ef7..c141131a 100644 --- a/lua/custom/plugins/noice.lua +++ b/lua/custom/plugins/noice.lua @@ -1,7 +1,261 @@ +-- lazy.nvim return { 'folke/noice.nvim', - optional = true, + event = 'VeryLazy', opts = { - presets = { inc_rename = true }, + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + 'MunifTanjim/nui.nvim', + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + 'rcarriga/nvim-notify', + }, + require('noice').setup { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + ['vim.lsp.util.stylize_markdown'] = true, + ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + cmdline = { + format = { + cmdline = { icon = '>' }, + search_down = { icon = '🔍⌄' }, + search_up = { icon = '🔍⌃' }, + filter = { icon = '$' }, + lua = { icon = '☾' }, + help = { icon = '?' }, + }, + }, + format = { + level = { + icons = { + error = '✖', + warn = '▼', + info = '●', + }, + }, + }, + popupmenu = { + kind_icons = false, + }, + inc_rename = { + cmdline = { + format = { + IncRename = { icon = '⟳' }, + }, + }, + }, + { + cmdline = { + enabled = true, -- enables the Noice cmdline UI + view = 'cmdline_popup', -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom + opts = {}, -- global options for the cmdline. See section on views + ---@type table + format = { + -- conceal: (default=true) This will hide the text in the cmdline that matches the pattern. + -- view: (default is cmdline view) + -- opts: any options passed to the view + -- icon_hl_group: optional hl_group for the icon + -- title: set to anything or empty string to hide + cmdline = { pattern = '^:', icon = '', lang = 'vim' }, + search_down = { kind = 'search', pattern = '^/', icon = ' ', lang = 'regex' }, + search_up = { kind = 'search', pattern = '^%?', icon = ' ', lang = 'regex' }, + filter = { pattern = '^:%s*!', icon = '$', lang = 'bash' }, + lua = { pattern = { '^:%s*lua%s+', '^:%s*lua%s*=%s*', '^:%s*=%s*' }, icon = '', lang = 'lua' }, + help = { pattern = '^:%s*he?l?p?%s+', icon = '' }, + input = { view = 'cmdline_input', icon = '󰥻 ' }, -- Used by input() + -- lua = false, -- to disable a format, set to `false` + }, + }, + messages = { + -- NOTE: If you enable messages, then the cmdline is enabled automatically. + -- This is a current Neovim limitation. + enabled = true, -- enables the Noice messages UI + view = 'notify', -- default view for messages + view_error = 'notify', -- view for errors + view_warn = 'notify', -- view for warnings + view_history = 'messages', -- view for :messages + view_search = 'virtualtext', -- view for search count messages. Set to `false` to disable + }, + popupmenu = { + enabled = true, -- enables the Noice popupmenu UI + ---@type 'nui'|'cmp' + backend = 'nui', -- backend to use to show regular cmdline completions + ---@type NoicePopupmenuItemKind|false + -- Icons for completion item kinds (see defaults at noice.config.icons.kinds) + kind_icons = {}, -- set to `false` to disable icons + }, + -- default options for require('noice').redirect + -- see the section on Command Redirection + ---@type NoiceRouteConfig + redirect = { + view = 'popup', + filter = { event = 'msg_show' }, + }, + -- You can add any custom commands below that will be available with `:Noice command` + ---@type table + commands = { + history = { + -- options for the message history that you get with `:Noice` + view = 'split', + opts = { enter = true, format = 'details' }, + filter = { + any = { + { event = 'notify' }, + { error = true }, + { warning = true }, + { event = 'msg_show', kind = { '' } }, + { event = 'lsp', kind = 'message' }, + }, + }, + }, + -- :Noice last + last = { + view = 'popup', + opts = { enter = true, format = 'details' }, + filter = { + any = { + { event = 'notify' }, + { error = true }, + { warning = true }, + { event = 'msg_show', kind = { '' } }, + { event = 'lsp', kind = 'message' }, + }, + }, + filter_opts = { count = 1 }, + }, + -- :Noice errors + errors = { + -- options for the message history that you get with `:Noice` + view = 'popup', + opts = { enter = true, format = 'details' }, + filter = { error = true }, + filter_opts = { reverse = true }, + }, + all = { + -- options for the message history that you get with `:Noice` + view = 'split', + opts = { enter = true, format = 'details' }, + filter = {}, + }, + }, + notify = { + -- Noice can be used as `vim.notify` so you can route any notification like other messages + -- Notification messages have their level and other properties set. + -- event is always "notify" and kind can be any log level as a string + -- The default routes will forward notifications to nvim-notify + -- Benefit of using Noice for this is the routing and consistent history view + enabled = true, + view = 'notify', + }, + lsp = { + progress = { + enabled = true, + -- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin + -- See the section on formatting for more details on how to customize. + --- @type NoiceFormat|string + format = 'lsp_progress', + --- @type NoiceFormat|string + format_done = 'lsp_progress_done', + throttle = 1000 / 30, -- frequency to update lsp progress message + view = 'mini', + }, + override = { + -- override the default lsp markdown formatter with Noice + ['vim.lsp.util.convert_input_to_markdown_lines'] = false, + -- override the lsp markdown formatter with Noice + ['vim.lsp.util.stylize_markdown'] = false, + -- override cmp documentation with Noice (needs the other options to work) + ['cmp.entry.get_documentation'] = false, + }, + hover = { + enabled = true, + silent = false, -- set to true to not show a message if hover is not available + view = nil, -- when nil, use defaults from documentation + ---@type NoiceViewOptions + opts = {}, -- merged with defaults from documentation + }, + signature = { + enabled = true, + auto_open = { + enabled = true, + trigger = true, -- Automatically show signature help when typing a trigger character from the LSP + luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes + throttle = 50, -- Debounce lsp signature help request by 50ms + }, + view = nil, -- when nil, use defaults from documentation + ---@type NoiceViewOptions + opts = {}, -- merged with defaults from documentation + }, + message = { + -- Messages shown by lsp servers + enabled = true, + view = 'notify', + opts = {}, + }, + -- defaults for hover and signature help + documentation = { + view = 'hover', + ---@type NoiceViewOptions + opts = { + lang = 'markdown', + replace = true, + render = 'plain', + format = { '{message}' }, + win_options = { concealcursor = 'n', conceallevel = 3 }, + }, + }, + }, + markdown = { + hover = { + ['|(%S-)|'] = vim.cmd.help, -- vim help links + ['%[.-%]%((%S-)%)'] = require('noice.util').open, -- markdown links + }, + highlights = { + ['|%S-|'] = '@text.reference', + ['@%S+'] = '@parameter', + ['^%s*(Parameters:)'] = '@text.title', + ['^%s*(Return:)'] = '@text.title', + ['^%s*(See also:)'] = '@text.title', + ['{%S-}'] = '@parameter', + }, + }, + health = { + checker = true, -- Disable if you don't want health checks to run + }, + ---@type NoicePresets + presets = { + -- you can enable a preset by setting it to true, or a table that will override the preset config + -- you can also add custom presets that you can enable/disable with enabled=true + bottom_search = false, -- use a classic bottom cmdline for search + command_palette = false, -- position the cmdline and popupmenu together + long_message_to_split = false, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + throttle = 1000 / 30, -- how frequently does Noice need to check for ui updates? This has no effect when in blocking mode. + ---@type NoiceConfigViews + views = {}, ---@see section on views + ---@type NoiceRouteConfig[] + routes = {}, --- @see section on routes + ---@type table + status = {}, --- @see section on statusline components + ---@type NoiceFormatOptions + format = {}, --- @see section on formatting + }, }, } diff --git a/lua/custom/plugins/snacks.lua b/lua/custom/plugins/snacks.lua index 640c429c..7a599fec 100644 --- a/lua/custom/plugins/snacks.lua +++ b/lua/custom/plugins/snacks.lua @@ -11,8 +11,8 @@ return { timeout = 3000, }, quickfile = { enabled = true }, - statuscolumn = { enabled = true }, - words = { enabled = true }, + statuscolumn = { enabled = false }, + words = { enabled = false }, styles = { notification = { wo = { wrap = true }, -- Wrap notifications diff --git a/lua/custom/plugins/supermaven.lua b/lua/custom/plugins/supermaven.lua index cf881347..b4518565 100644 --- a/lua/custom/plugins/supermaven.lua +++ b/lua/custom/plugins/supermaven.lua @@ -1,8 +1,26 @@ return { { - "supermaven-inc/supermaven-nvim", + 'supermaven-inc/supermaven-nvim', config = function() - require("supermaven-nvim").setup({}) + require('supermaven-nvim').setup { + keymaps = { + accept_suggestion = '', + clear_suggestion = '', + accept_word = '', + }, + ignore_filetypes = { cpp = true }, -- or { "cpp", } + color = { + suggestion_color = '#c4a7e7', + + cterm = 244, + }, + log_level = 'info', -- set to "off" to disable logging completely + disable_inline_completion = false, -- disables inline completion for use with cmp + disable_keymaps = false, -- disables built in keymaps for more manual control + condition = function() + return false + end, -- condition to check for stopping supermaven, `true` means to stop supermaven when the condition is true. + } end, }, }