commit 2ac5bfdb9742e580ce4057d3520d43302944a82c Author: nicknase27 Date: Sun Jul 26 18:42:56 2026 +0200 init diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..850cbb1 --- /dev/null +++ b/init.lua @@ -0,0 +1,18 @@ +vim.opt.rtp:prepend(vim.fn.stdpath("config")) +local opts = { noremap = true, silent = true } + +vim.pack.add({ + { src = "https://github.com/neovim/nvim-lspconfig" }, + { src = "https://github.com/goolord/alpha-nvim" }, + { src = "https://github.com/stevearc/oil.nvim" }, + { src = "https://github.com/ibhagwan/fzf-lua" }, + { src = "https://github.com/nvim-lualine/lualine.nvim" }, + { src = "https://github.com/nvim-mini/mini.nvim" }, + { src = "https://github.com/rafamadriz/friendly-snippets" }, +}) + +require('lspconf') +require('settings') +require('lualineconf') +require('mini') +require('ui') diff --git a/lua/lspconf.lua b/lua/lspconf.lua new file mode 100644 index 0000000..127ab67 --- /dev/null +++ b/lua/lspconf.lua @@ -0,0 +1,21 @@ +vim.lsp.enable({ "lua_ls", "nixd", "clang", "rust-analyzer"}) + +-- RUST +vim.lsp.config('rust-analyzer', { + cmd = { 'rust-analyzer' }, + filetypes = { 'rust' }, +}) + +-- NIX +vim.lsp.config('nixd', { + cmd = { 'nixd' }, + filetypes = { 'nix' }, + root_markers = { 'flake.nix', '.git' }, + settings = { + nixd = { + formatting = { + command = { "alejandra" }, + }, + }, + }, +}) diff --git a/lua/lualineconf.lua b/lua/lualineconf.lua new file mode 100644 index 0000000..339a758 --- /dev/null +++ b/lua/lualineconf.lua @@ -0,0 +1,40 @@ +-- lua/conf_statusline.lua +require('lualine').setup({ + options = { + theme = 'auto', -- Automatically matches your colorscheme + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + globalstatus = true, -- Single statusline at the bottom for all windows + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = { + { + -- Custom function to show which LSP is active + function() + local msg = 'No Active LSP' + local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 }) + local clients = vim.lsp.get_clients({ bufnr = 0 }) + 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, + icon = ' ', + color = { fg = '#ffffff', gui = 'bold' }, + }, + 'encoding', + 'fileformat', + 'filetype' + }, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, +}) + diff --git a/lua/mini.lua b/lua/mini.lua new file mode 100644 index 0000000..32a1378 --- /dev/null +++ b/lua/mini.lua @@ -0,0 +1,38 @@ +require('mini.pairs').setup() +require('mini.comment').setup() +require('mini.surround').setup() +require('mini.icons').setup() + +require('mini.notify').setup({ + -- only show messages + content = { + format = function(notif) + return notif.msg + end, + }, +}) + +require('mini.cmdline').setup({ + autocorrect = { enable = false } +}) + +local MiniCompletion = require('mini.completion') +MiniCompletion.setup({ + lsp_completion = { + auto_setup = true, + process_items = function(items, base) + return MiniCompletion.default_process_items(items, base, { + filtersort = "fuzzy", + }) + end, + } +}) + +local MiniSnipets = require('mini.snippets') +MiniSnipets.setup({ + snippets = { + MiniSnipets.gen_loader.from_lang(), + }, +}) +MiniSnipets.start_lsp_server({ match = false }) + diff --git a/lua/settings.lua b/lua/settings.lua new file mode 100644 index 0000000..e46fa93 --- /dev/null +++ b/lua/settings.lua @@ -0,0 +1,66 @@ +vim.g.mapleader = " " +vim.o.number = true +vim.o.relativenumber = true +vim.o.wrap = true +vim.o.winborder = "rounded" + +-- vim.o.signcolumn = "no" +vim.o.signcolumn = "yes" +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.o.expandtab = true +vim.o.breakindent = true +vim.o.undofile = true +vim.o.swapfile = false +vim.o.backup = false + +vim.o.clipboard = 'unnamedplus' + +vim.keymap.set('n', 'o', ':update :source') +vim.keymap.set('n', '', "nohlsearch") +vim.keymap.set('n', 'lf', vim.lsp.buf.format) + +vim.keymap.set({ 'n', 'v', 'x' }, 'y', '"+y') +vim.keymap.set({ 'n', 'v', 'x' }, 'd', '"+d') + +-- delete without yanking +vim.keymap.set("n", "d", '"_d', opts) +vim.keymap.set("v", "d", '"_d', opts) +vim.keymap.set("n", "x", '"_x', opts) +vim.keymap.set("n", "D", '"_D', opts) + +-- delete with leader to yank +vim.keymap.set("n", "d", '""d') +vim.keymap.set("n", "D", '""D') +vim.keymap.set("v", "d", '""d') + +-- Plugin Keybinds +vim.keymap.set('n', 'e', 'Oil', { desc = "Open parent directory" }) +vim.keymap.set('n', 'D', 'Alpha', { desc = "Open dashboard" }) + +-- Fuzzy find files and open them (or their directory in Oil) +vim.keymap.set('n', 'ff', "FzfLua files", { desc = "Fuzzy Find Files" }) + +vim.o.autocomplete = true +vim.opt.completeopt = { 'menuone', 'noselect' } +vim.opt.shortmess:append('c') + +vim.keymap.set('n', 'gl', vim.diagnostic.open_float) + +vim.o.pumheight = 5 +vim.o.pumborder = 'rounded' + +vim.g.vimtex_view_method = "zathura" +vim.cmd("filetype plugin indent on") + +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('my.lsp', {}), + callback = function(ev) + local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) + if client:supports_method('textDocument/completion') then + vim.lsp.completion.enable(true, client.id, ev.buf, {autotrigger = true}) + end + end, + }) +vim.cmd("syntax enable") + diff --git a/lua/ui.lua b/lua/ui.lua new file mode 100644 index 0000000..814db57 --- /dev/null +++ b/lua/ui.lua @@ -0,0 +1,58 @@ +-- Dashboard +local alpha = require('alpha') +local dashboard = require('alpha.themes.dashboard') + +-- Custom Header (Minimalist) +dashboard.section.header.val = { + -- [[ __ ]], + [[ ___ ___ ___ __ __ /\_\ ___ ___ ]], + [[ /' _ `\ /' __`\/\__\ /\ \/\ \\/\ \ /' __` __`\ ]], + [[ /\ \/\ \/\ __/\/_/\ \ \ \_/ |\ \ \ /\ \/\ \/\ \ ]], + [[ \ \_\ \_\ \____\ \ \_\ \___/ \ \_\\ \_\ \_\ \_\]], + [[ \/_/\/_/\/____/ \/_/\/__/ \/_/ \/_/\/_/\/_/]], +} + +-- Custom Buttons (Integrating your Zsh logic) +dashboard.section.buttons.val = { + dashboard.button("n", " Nix Configuration", ":cd ~/nicksOs | Oil"), + dashboard.button("v", " Neovim Config", ":cd ~/.config/nvim | Oil"), + dashboard.button("h", " Habits", ":cd ~/Documents | :e habits.md "), + dashboard.button("f", "󰈞 Find File", ":Oil"), + dashboard.button("q", "󰅚 Quit", ":qa"), +} + +-- Recent Files Section (Last 5 files) +local function get_mru(count) + local mru = {} + for _, file in ipairs(vim.v.oldfiles) do + if #mru >= count then break end + if vim.fn.filereadable(file) == 1 then + table.insert(mru, dashboard.button(tostring(#mru + 1), "󰈚 " .. vim.fn.fnamemodify(file, ":t"), ":e " .. file .. "")) + end + end + return mru +end + +-- Assemble the layout +dashboard.config.layout = { + { type = "padding", val = 2 }, + dashboard.section.header, + { type = "padding", val = 2 }, + { type = "group", val = dashboard.section.buttons.val }, + { type = "padding", val = 2 }, { type = "text", val = "Recent Files", opts = { hl = "Special", align = "center" } }, { type = "padding", val = 1 }, + { type = "group", val = function() return get_mru(5) end }, +} + +alpha.setup(dashboard.config) + +-- File Browser +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +require("oil").setup({ + columns = { "icon" }, + view_options = { show_hidden = true }, +}) + +vim.cmd("colorscheme habamax") +vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) + diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json new file mode 100644 index 0000000..7a29059 --- /dev/null +++ b/nvim-pack-lock.json @@ -0,0 +1,56 @@ +{ + "plugins": { + "Comment.nvim": { + "rev": "e30b7f2008e52442154b66f7c519bfd2f1e32acb", + "src": "https://github.com/numToStr/Comment.nvim" + }, + "alpha-nvim": { + "rev": "6c6a89d5b068b5251c8bdf0dd57bb921bcfeeb09", + "src": "https://github.com/goolord/alpha-nvim" + }, + "blink.lib": { + "rev": "5876dd95deeb70aadbe9f1c0b7117a135061cdac", + "src": "https://github.com/saghen/blink.lib" + }, + "blink.nvim": { + "rev": "d1e7c7c45d45c6b6a25427bf62db4db73b03ff3d", + "src": "https://github.com/Saghen/blink.nvim" + }, + "friendly-snippets": { + "rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9", + "src": "https://github.com/rafamadriz/friendly-snippets" + }, + "fzf-lua": { + "rev": "511651f198068ef5841ee1635ade58daa2486ef7", + "src": "https://github.com/ibhagwan/fzf-lua" + }, + "lualine.nvim": { + "rev": "221ce6b2d999187044529f49da6554a92f740a96", + "src": "https://github.com/nvim-lualine/lualine.nvim" + }, + "mini.nvim": { + "rev": "946ae64e0ee807ae3c41f382f0114b4ed4915b2c", + "src": "https://github.com/nvim-mini/mini.nvim" + }, + "nvim-autopairs": { + "rev": "7b9923abad60b903ece7c52940e1321d39eccc79", + "src": "https://github.com/windwp/nvim-autopairs" + }, + "nvim-lspconfig": { + "rev": "d592c1e6ad9a0a01b3d5ed3f0345d68407167181", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "61df84986b4b4ec469ee745a182e433d49f8c27e", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "nvim-web-devicons": { + "rev": "2ae6958df7ced50baac5035cec0c15799eedfbf7", + "src": "https://github.com/nvim-tree/nvim-web-devicons" + }, + "oil.nvim": { + "rev": "b73018b75affd13fa38e2fc94ef753b465f770d7", + "src": "https://github.com/stevearc/oil.nvim" + } + } +}