diff --git a/home-manager/features/config/neovim/init.lua b/home-manager/features/config/neovim/init.lua index 6e95120..2514f9e 100644 --- a/home-manager/features/config/neovim/init.lua +++ b/home-manager/features/config/neovim/init.lua @@ -1,37 +1,2 @@ --- Leader must be set before lazy is setup. -vim.g.mapleader = "," - -vim.cmd [[ -colorscheme decay-dark -set autoindent -set expandtab -set smartindent -set shiftwidth=2 -set tabstop=2 -set softtabstop=2 -filetype on -]] - --- Make sure sesssion options includes `localoptions` so that auto-sessions will start properly -vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" - -local telescope = require('telescope.builtin') - -vim.keymap.set("n", "", "RnvimrToggle", { noremap = true, silent = true }) -vim.keymap.set("n", "", "TabNext", { noremap = true, silent = true }) -vim.keymap.set("n", "", telescope.find_files, { desc = "Telescope find files" }) -vim.keymap.set("n", "", telescope.buffers, { desc = "Telescope buffers" }) - - -vim.filetype.add { - extension = { - rasi = 'rasi', - }, - pattern = { - -- Some common config files and their types - ['.*/waybar/config'] = 'jsonc', - ['.*/mako/config'] = 'dosini', - ['.*/kitty/*.conf'] = 'bash', - ['.*/hypr/.*%.conf'] = 'hyprlang', - }, -} +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/home-manager/features/config/neovim/lua/config/autocmds.lua b/home-manager/features/config/neovim/lua/config/autocmds.lua new file mode 100644 index 0000000..4221e75 --- /dev/null +++ b/home-manager/features/config/neovim/lua/config/autocmds.lua @@ -0,0 +1,8 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- +-- Add any additional autocmds here +-- with `vim.api.nvim_create_autocmd` +-- +-- Or remove existing autocmds by their group name (which is prefixed with `lazyvim_` for the defaults) +-- e.g. vim.api.nvim_del_augroup_by_name("lazyvim_wrap_spell") diff --git a/home-manager/features/config/neovim/lua/config/keymaps.lua b/home-manager/features/config/neovim/lua/config/keymaps.lua new file mode 100644 index 0000000..2c134f7 --- /dev/null +++ b/home-manager/features/config/neovim/lua/config/keymaps.lua @@ -0,0 +1,3 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here diff --git a/home-manager/features/config/neovim/lua/config/lazy.lua b/home-manager/features/config/neovim/lua/config/lazy.lua new file mode 100644 index 0000000..d73bfa1 --- /dev/null +++ b/home-manager/features/config/neovim/lua/config/lazy.lua @@ -0,0 +1,53 @@ +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) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { + enabled = true, -- check for plugin updates periodically + notify = false, -- notify on update + }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/home-manager/features/config/neovim/lua/config/options.lua b/home-manager/features/config/neovim/lua/config/options.lua new file mode 100644 index 0000000..3ea1454 --- /dev/null +++ b/home-manager/features/config/neovim/lua/config/options.lua @@ -0,0 +1,3 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here diff --git a/home-manager/features/config/neovim/lua/plugins/auto-session.lua b/home-manager/features/config/neovim/lua/plugins/auto-session.lua deleted file mode 100644 index e63a3f7..0000000 --- a/home-manager/features/config/neovim/lua/plugins/auto-session.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - 'rmagatti/auto-session', - lazy = false, - - ---enables autocomplete for opts - ---@module "auto-session" - ---@type AutoSession.Config - opts = { - suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, - -- log_level = 'debug', - show_auto_restore_notif = true, - cwd_change_handling = true, - } -} diff --git a/home-manager/features/config/neovim/lua/plugins/decay.lua b/home-manager/features/config/neovim/lua/plugins/decay.lua deleted file mode 100644 index cfc8ed5..0000000 --- a/home-manager/features/config/neovim/lua/plugins/decay.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - "decaycs/decay.nvim", - name = "decay", - lazy = false, - priority = 1000, -} diff --git a/home-manager/features/config/neovim/lua/plugins/example.lua b/home-manager/features/config/neovim/lua/plugins/example.lua new file mode 100644 index 0000000..17f53d6 --- /dev/null +++ b/home-manager/features/config/neovim/lua/plugins/example.lua @@ -0,0 +1,197 @@ +-- since this is just an example spec, don't actually load anything here and return an empty spec +-- stylua: ignore +if true then return {} end + +-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim +-- +-- In your plugin files, you can: +-- * add extra plugins +-- * disable/enabled LazyVim plugins +-- * override the configuration of LazyVim plugins +return { + -- add gruvbox + { "ellisonleao/gruvbox.nvim" }, + + -- Configure LazyVim to load gruvbox + { + "LazyVim/LazyVim", + opts = { + colorscheme = "gruvbox", + }, + }, + + -- change trouble config + { + "folke/trouble.nvim", + -- opts will be merged with the parent spec + opts = { use_diagnostic_signs = true }, + }, + + -- disable trouble + { "folke/trouble.nvim", enabled = false }, + + -- override nvim-cmp and add cmp-emoji + { + "hrsh7th/nvim-cmp", + dependencies = { "hrsh7th/cmp-emoji" }, + ---@param opts cmp.ConfigSchema + opts = function(_, opts) + table.insert(opts.sources, { name = "emoji" }) + end, + }, + + -- change some telescope options and a keymap to browse plugin files + { + "nvim-telescope/telescope.nvim", + keys = { + -- add a keymap to browse plugin files + -- stylua: ignore + { + "fp", + function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, + desc = "Find Plugin File", + }, + }, + -- change some options + opts = { + defaults = { + layout_strategy = "horizontal", + layout_config = { prompt_position = "top" }, + sorting_strategy = "ascending", + winblend = 0, + }, + }, + }, + + -- add pyright to lspconfig + { + "neovim/nvim-lspconfig", + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- pyright will be automatically installed with mason and loaded with lspconfig + pyright = {}, + }, + }, + }, + + -- add tsserver and setup with typescript.nvim instead of lspconfig + { + "neovim/nvim-lspconfig", + dependencies = { + "jose-elias-alvarez/typescript.nvim", + init = function() + require("lazyvim.util").lsp.on_attach(function(_, buffer) + -- stylua: ignore + vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) + vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) + end) + end, + }, + ---@class PluginLspOpts + opts = { + ---@type lspconfig.options + servers = { + -- tsserver will be automatically installed with mason and loaded with lspconfig + tsserver = {}, + }, + -- you can do any additional lsp server setup here + -- return true if you don't want this server to be setup with lspconfig + ---@type table + setup = { + -- example to setup with typescript.nvim + tsserver = function(_, opts) + require("typescript").setup({ server = opts }) + return true + end, + -- Specify * to use this function as a fallback for any server + -- ["*"] = function(server, opts) end, + }, + }, + }, + + -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, + -- treesitter, mason and typescript.nvim. So instead of the above, you can use: + { import = "lazyvim.plugins.extras.lang.typescript" }, + + -- add more treesitter parsers + { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "bash", + "html", + "javascript", + "json", + "lua", + "markdown", + "markdown_inline", + "python", + "query", + "regex", + "tsx", + "typescript", + "vim", + "yaml", + }, + }, + }, + + -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above + -- would overwrite `ensure_installed` with the new value. + -- If you'd rather extend the default config, use the code below instead: + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + -- add tsx and treesitter + vim.list_extend(opts.ensure_installed, { + "tsx", + "typescript", + }) + end, + }, + + -- the opts function can also be used to change the default opts: + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function(_, opts) + table.insert(opts.sections.lualine_x, { + function() + return "😄" + end, + }) + end, + }, + + -- or you can return new options to override all the defaults + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = function() + return { + --[[add your custom lualine config here]] + } + end, + }, + + -- use mini.starter instead of alpha + { import = "lazyvim.plugins.extras.ui.mini-starter" }, + + -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc + { import = "lazyvim.plugins.extras.lang.json" }, + + -- add any tools you want to have installed below + { + "williamboman/mason.nvim", + opts = { + ensure_installed = { + "stylua", + "shellcheck", + "shfmt", + "flake8", + }, + }, + }, +} diff --git a/home-manager/features/config/neovim/lua/plugins/rnvimr.lua b/home-manager/features/config/neovim/lua/plugins/rnvimr.lua deleted file mode 100644 index dfbf394..0000000 --- a/home-manager/features/config/neovim/lua/plugins/rnvimr.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - "kevinhwang91/rnvimr", - lazy = false, -} diff --git a/home-manager/features/config/neovim/lua/plugins/surround.lua b/home-manager/features/config/neovim/lua/plugins/surround.lua deleted file mode 100644 index 241ec2c..0000000 --- a/home-manager/features/config/neovim/lua/plugins/surround.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - "kylechui/nvim-surround", - version = "*", -- Use for stability; omit to use `main` branch for the latest features - event = "VeryLazy", - config = function() - require("nvim-surround").setup({ - -- Configuration here, or leave empty to use defaults - }) - end -} \ No newline at end of file diff --git a/home-manager/features/config/neovim/lua/plugins/telescope.lua b/home-manager/features/config/neovim/lua/plugins/telescope.lua deleted file mode 100644 index bf1514a..0000000 --- a/home-manager/features/config/neovim/lua/plugins/telescope.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - 'nvim-telescope/telescope.nvim', - tag = '0.1.8', - dependencies = { 'nvim-lua/plenary.nvim' } -} diff --git a/home-manager/features/config/neovim/lua/plugins/treesitter.lua b/home-manager/features/config/neovim/lua/plugins/treesitter.lua deleted file mode 100644 index f3a862e..0000000 --- a/home-manager/features/config/neovim/lua/plugins/treesitter.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function () - local configs = require("nvim-treesitter.configs") - - configs.setup({ - -- Make sure these are installed - ensure_installed = { - -- Programming languages - "javascript", - "typescript", - "haskell", - "rust", - "lua", - "bash", - - -- Config files - "vim", - "hyprlang", - "toml", - "yaml", - "dockerfile", - - -- Other - "markdown", - }, - -- Use async install - sync_install = false, - -- Install missing parsers when entering a buffer. - auto_install = true, - - highlight = { enable = true }, - indent = { enable = true }, - }) - end -} diff --git a/home-manager/features/config/neovim/stylua.toml b/home-manager/features/config/neovim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/home-manager/features/config/neovim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file diff --git a/home-manager/features/neovim.nix b/home-manager/features/neovim.nix index d0d7590..034a8e3 100644 --- a/home-manager/features/neovim.nix +++ b/home-manager/features/neovim.nix @@ -18,8 +18,8 @@ in defaultEditor = true; plugins = with pkgs.vimPlugins; [ + # lazy-nvim # treesitterWithGrammars - lazy-nvim # surround-nvim # telescope-nvim # plenary-nvim # dependency of telescope @@ -33,6 +33,10 @@ in ripgrep # Search support wayclip # Clipboard support fd # finder for telescope + fzf # Fuzzy finder + lazygit # LazyVim dep? + wget # LazyVim dep? + sqlite # For Snacks ]; }; diff --git a/home-manager/features/terminal.nix b/home-manager/features/terminal.nix index c02271e..2e0ef6e 100644 --- a/home-manager/features/terminal.nix +++ b/home-manager/features/terminal.nix @@ -25,8 +25,16 @@ # Other jq + + # Font + nerd-fonts.inconsolata + nerd-fonts.fira-code + nerd-fonts.jetbrains-mono ]; + # Allow Home Manager to set fonts. + fonts.fontconfig.enable = true; + programs.alacritty = { enable = true; settings = { @@ -35,6 +43,14 @@ opacity = 0.85; }; + font = { + normal = { + family = "FiraCode Nerd Font"; + style = "Regular"; + }; + size = 14; + }; + selection.save_to_clipboard = true; colors = { diff --git a/system/hosts/drew-desktop/configuration.nix b/system/hosts/drew-desktop/configuration.nix index 55727c3..75cce0f 100644 --- a/system/hosts/drew-desktop/configuration.nix +++ b/system/hosts/drew-desktop/configuration.nix @@ -159,4 +159,8 @@ }; services.openssh.enable = true; + + # Enable the font directory for managing fonts + # This doesn't seem to be needed though. + # fonts.fontDir.enable = true; }