diff --git a/configuration.nix b/configuration.nix index b348866..8ee914a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -47,7 +47,6 @@ environment = { systemPackages = with pkgs; [ - vim # Nix nh alejandra diff --git a/users/coyote/dotfiles.nix b/users/coyote/dotfiles.nix new file mode 100644 index 0000000..6d77215 --- /dev/null +++ b/users/coyote/dotfiles.nix @@ -0,0 +1,25 @@ +{ + pkgs, + lib, + ... +}: let + mkVim = src: langs: + builtins.listToAttrs (map (lang: { + name = ".vim/after/ftplugin/${lang}.vim"; + value = {source = src;}; + }) + langs); +in { + home.file = lib.mkMerge [ + { + ".config/fastfetch/config.jsonc".source = ./dotfiles/fastfetch.jsonc; + ".config/helix/config.toml".source = ./dotfiles/helix/helix.toml; + ".config/helix/languages.toml".source = ./dotfiles/helix/helix-languages.toml; + } + + (mkVim ./dotfiles/vim/langs/tab2.vim ["javascript" "typescript" "html" "css" "json" "nix" "vim"]) + (mkVim ./dotfiles/vim/langs/tab4.vim ["python" "rust" "java" "lua" "c" "cpp" "h" "hpp"]) + (mkVim ./dotfiles/vim/langs/tabs.vim ["go" "make"]) + (mkVim ./dotfiles/vim/langs/lisp.vim ["lisp" "scheme" "clojure" "racket"]) + ]; +} diff --git a/users/coyote/dotfiles/nvim/.neoconf.json b/users/coyote/dotfiles/nvim/.neoconf.json deleted file mode 100644 index 7c48087..0000000 --- a/users/coyote/dotfiles/nvim/.neoconf.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "neodev": { - "library": { - "enabled": true, - "plugins": true - } - }, - "neoconf": { - "plugins": { - "lua_ls": { - "enabled": true - } - } - } -} diff --git a/users/coyote/dotfiles/nvim/init.lua b/users/coyote/dotfiles/nvim/init.lua deleted file mode 100644 index 2514f9e..0000000 --- a/users/coyote/dotfiles/nvim/init.lua +++ /dev/null @@ -1,2 +0,0 @@ --- bootstrap lazy.nvim, LazyVim and your plugins -require("config.lazy") diff --git a/users/coyote/dotfiles/nvim/lua/config/autocmds.lua b/users/coyote/dotfiles/nvim/lua/config/autocmds.lua deleted file mode 100644 index 4221e75..0000000 --- a/users/coyote/dotfiles/nvim/lua/config/autocmds.lua +++ /dev/null @@ -1,8 +0,0 @@ --- 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/users/coyote/dotfiles/nvim/lua/config/keymaps.lua b/users/coyote/dotfiles/nvim/lua/config/keymaps.lua deleted file mode 100644 index 2c134f7..0000000 --- a/users/coyote/dotfiles/nvim/lua/config/keymaps.lua +++ /dev/null @@ -1,3 +0,0 @@ --- 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/users/coyote/dotfiles/nvim/lua/config/lazy.lua b/users/coyote/dotfiles/nvim/lua/config/lazy.lua deleted file mode 100644 index d73bfa1..0000000 --- a/users/coyote/dotfiles/nvim/lua/config/lazy.lua +++ /dev/null @@ -1,53 +0,0 @@ -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/users/coyote/dotfiles/nvim/lua/config/options.lua b/users/coyote/dotfiles/nvim/lua/config/options.lua deleted file mode 100644 index 3ea1454..0000000 --- a/users/coyote/dotfiles/nvim/lua/config/options.lua +++ /dev/null @@ -1,3 +0,0 @@ --- 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/users/coyote/dotfiles/nvim/lua/plugins/core.lua b/users/coyote/dotfiles/nvim/lua/plugins/core.lua deleted file mode 100644 index 21da2fc..0000000 --- a/users/coyote/dotfiles/nvim/lua/plugins/core.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - { - "LazyVim/LazyVim", - opts = { - colorscheme = "gruvbox", - } - } -} diff --git a/users/coyote/dotfiles/nvim/lua/plugins/example.lua b/users/coyote/dotfiles/nvim/lua/plugins/example.lua deleted file mode 100644 index 17f53d6..0000000 --- a/users/coyote/dotfiles/nvim/lua/plugins/example.lua +++ /dev/null @@ -1,197 +0,0 @@ --- 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/users/coyote/dotfiles/nvim/stylua.toml b/users/coyote/dotfiles/nvim/stylua.toml deleted file mode 100644 index 5d6c50d..0000000 --- a/users/coyote/dotfiles/nvim/stylua.toml +++ /dev/null @@ -1,3 +0,0 @@ -indent_type = "Spaces" -indent_width = 2 -column_width = 120 \ No newline at end of file diff --git a/users/coyote/dotfiles/vim/vim-lisp b/users/coyote/dotfiles/vim/langs/lisp.vim similarity index 100% rename from users/coyote/dotfiles/vim/vim-lisp rename to users/coyote/dotfiles/vim/langs/lisp.vim diff --git a/users/coyote/dotfiles/vim/vim-tab2 b/users/coyote/dotfiles/vim/langs/tab2.vim similarity index 100% rename from users/coyote/dotfiles/vim/vim-tab2 rename to users/coyote/dotfiles/vim/langs/tab2.vim diff --git a/users/coyote/dotfiles/vim/vim-tab4 b/users/coyote/dotfiles/vim/langs/tab4.vim similarity index 100% rename from users/coyote/dotfiles/vim/vim-tab4 rename to users/coyote/dotfiles/vim/langs/tab4.vim diff --git a/users/coyote/dotfiles/vim/vim-tabs b/users/coyote/dotfiles/vim/langs/tabs.vim similarity index 100% rename from users/coyote/dotfiles/vim/vim-tabs rename to users/coyote/dotfiles/vim/langs/tabs.vim diff --git a/users/coyote/dotfiles/vim/vimrc b/users/coyote/dotfiles/vim/vimrc deleted file mode 100644 index 075bfbc..0000000 --- a/users/coyote/dotfiles/vim/vimrc +++ /dev/null @@ -1,48 +0,0 @@ -set nocompatible -set encoding=utf-8 -set backspace=indent,eol,start -set clipboard=unnamedplus -set mouse=a -set history=1000 -set updatetime=300 - -syntax on -set ruler -set showcmd -set showmode -set laststatus=2 -set wildmenu -set wildmode=longest,list,full -set ttyfast -set lazyredraw - -filetype plugin indent on -set autoindent -set smartindent -set expandtab -set smarttab -set tabstop=4 -set shiftwidth=4 -set softtabstop=4 - -set hlsearch -set incsearch -set ignorecase -set smartcase -set showmatch - -" vim-plug auto-install & config -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' -if empty(glob(data_dir . '/autoload/plug.vim')) - silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -endif - -call plug#begin() - Plug 'junegunn/vim-plug' - Plug 'luochen1990/rainbow' - Plug 'mhinz/vim-signify' - Plug 'vim-airline/vim-airline' -call plug#end() - -let g:rainbow_active = 1 diff --git a/users/coyote/home.nix b/users/coyote/home.nix index 67f2156..26b8d1c 100644 --- a/users/coyote/home.nix +++ b/users/coyote/home.nix @@ -3,16 +3,19 @@ lib, ... }: let - mkVimFt = src: langs: - builtins.listToAttrs (map (lang: { - name = ".vim/after/ftplugin/${lang}.vim"; - value = {source = src;}; - }) - langs); + programsDir = ./programs; + programsImports = map (name: programsDir + "/${name}") ( + builtins.filter + (name: builtins.match ".*\\.nix" name != null) + (builtins.attrNames (builtins.readDir programsDir)) + ); in { + imports = [ + ./dotfiles.nix + ] ++ programsImports; + home = { stateVersion = "26.05"; # I hope you know what you're doing. :) - username = "coyote"; homeDirectory = "/home/coyote"; shell.enableShellIntegration = true; @@ -41,35 +44,9 @@ in { # emulation (unstable.bottles.override {removeWarningPopup = true;}) ]; - - file = lib.mkMerge [ - { - ".vimrc".source = ./dotfiles/vim/vimrc; - ".config/fastfetch/config.jsonc".source = ./dotfiles/fastfetch.jsonc; - ".config/helix/config.toml".source = ./dotfiles/helix/helix.toml; - ".config/helix/languages.toml".source = ./dotfiles/helix/helix-languages.toml; - ".config/nvim" = { - source = ./dotfiles/nvim; - recursive = true; - }; - } - (mkVimFt ./dotfiles/vim/vim-tab2 ["javascript" "typescript" "html" "css" "json" "nix" "vim"]) - (mkVimFt ./dotfiles/vim/vim-tab4 ["python" "rust" "java" "lua" "c" "cpp" "h" "hpp"]) - (mkVimFt ./dotfiles/vim/vim-tabs ["go" "make"]) - (mkVimFt ./dotfiles/vim/vim-lisp ["lisp" "scheme" "clojure" "racket"]) - ]; }; programs = { - vim = { - enable = true; - packageConfigurable = pkgs.unstable.vim-full; - defaultEditor = true; - }; - neovim = { - enable = true; - package = pkgs.unstable.neovim-unwrapped; - }; git = { enable = true; settings = { diff --git a/users/coyote/programs/neovim.nix b/users/coyote/programs/neovim.nix new file mode 100644 index 0000000..dc499a6 --- /dev/null +++ b/users/coyote/programs/neovim.nix @@ -0,0 +1,9 @@ +{ + pkgs, + lib, + ... +}: { + programs.neovim = { + enable = true; + }; +} diff --git a/users/coyote/programs/vim.nix b/users/coyote/programs/vim.nix new file mode 100644 index 0000000..b76c10e --- /dev/null +++ b/users/coyote/programs/vim.nix @@ -0,0 +1,99 @@ +{ + pkgs, + lib, + ... +}: { + programs.vim = { + enable = true; + packageConfigurable = pkgs.unstable.vim-full; + plugins = with pkgs.unstable.vimPlugins; [ + gruvbox + vim-surround + vim-commentary + vim-easymotion + vim-visual-multi + fzf-vim + vim-signify + vim-airline + rainbow + ]; + defaultEditor = true; + extraConfig = '' + set nocompatible + set encoding=utf-8 + set backspace=indent,eol,start + set clipboard=unnamedplus + set mouse=a + set history=1000 + set updatetime=300 + + syntax on + set ruler + set showcmd + set showmode + set laststatus=2 + set wildmenu + set wildmode=longest,list,full + set ttyfast + set lazyredraw + + filetype plugin indent on + set autoindent + set smartindent + set expandtab + set smarttab + set tabstop=4 + set shiftwidth=4 + set softtabstop=4 + + set hlsearch + set incsearch + set ignorecase + set smartcase + set showmatch + + " gruvbox + set termguicolors + set background=dark + colorscheme gruvbox + + " airline + let g:airline_powerline_fonts = 1 + let g:airline_theme = 'gruvbox' + let g:airline_section_a = ''' + let g:airline_section_y = ''' + + let g:airline#extensions#tabline#enabled = 1 + let g:airline#extensions#whitespace#enabled = 1 + let g:airline#extensions#signify#enabled = 1 + let g:airline#extensions#term#enabled = 0 + + let g:airline#extensions#tabline#formatter = 'unique_tail_improved' + let g:airline#extensions#tabline#show_splits = 0 + let g:airline#extensions#tabline#show_tabs = 0 + + let g:airline#extensions#empty_sections = 1 + + " rainbow + let g:rainbow_active = 1 + + " fzf + let $COLORTERM = 'truecolor' + let $FZF_DEFAULT_OPTS='--reverse --info=inline' + let g:fzf_colors = {} + let g:fzf_colors["fg"] = ["fg", "Normal"] + let g:fzf_colors["bg"] = ["bg", "Normal"] + let g:fzf_colors["hl"] = ["fg", "Comment"] + let g:fzf_colors["fg+"] = ["fg", "CursorLine", "CursorColumn", "Normal"] + let g:fzf_colors["bg+"] = ["bg", "CursorLine", "CursorColumn"] + let g:fzf_colors["hl+"] = ["fg", "Statement"] + let g:fzf_colors["info"] = ["fg", "PreProc"] + let g:fzf_colors["border"] = ["fg", "Ignore"] + let g:fzf_colors["prompt"] = ["fg", "Conditional"] + let g:fzf_colors["pointer"] = ["fg", "Exception"] + let g:fzf_colors["marker"] = ["fg", "Keyword"] + let g:fzf_colors["spinner"] = ["fg", "Label"] + let g:fzf_colors["header"] = ["fg", "Comment"] + ''; + }; +}