feat: make neovim config from scratch

This commit is contained in:
matt1432 2023-07-19 21:52:35 -04:00
parent e00412252a
commit ce6e287ca6
10 changed files with 132 additions and 3 deletions

View file

@ -0,0 +1,8 @@
" make tabs only 2 spaces
set tabstop=2
set shiftwidth=2
set expandtab
set smartindent
set number
set relativenumber

View file

@ -0,0 +1,2 @@
vim.opt.fillchars = {eob = " "}
vim.cmd[[colorscheme dracula]]

3
nixos/home/.nvim/lsp.lua Normal file
View file

@ -0,0 +1,3 @@
local lspconfig = require('lspconfig')
lspconfig.bashls.setup {}
lspconfig.nixd.setup {}

View file

@ -27,6 +27,7 @@
./dotfiles.nix
./packages.nix
./misc.nix
./nvim.nix
];
home.stateVersion = "23.05";

62
nixos/home/nvim.nix Normal file
View file

@ -0,0 +1,62 @@
# https://breuer.dev/blog/nixos-home-manager-neovim
{ config, pkgs, lib, ... }:
let
# installs a vim plugin from git with a given tag / branch
pluginGit = ref: repo: pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = ref;
src = builtins.fetchGit {
url = "https://github.com/${repo}.git";
ref = ref;
};
};
# always installs latest version
plugin = pluginGit "HEAD";
in {
programs.neovim = {
enable = true;
package = pkgs.neovim-nightly;
# read in the vim config from filesystem
# this enables syntaxhighlighting when editing those
extraConfig = builtins.concatStringsSep "\n" [
(lib.strings.fileContents ./.nvim/base.vim)
# (lib.strings.fileContents ./.nvim/plugins.vim)
# (lib.strings.fileContents ./.nvim/lsp.vim)
''
lua << EOF
${lib.strings.fileContents ./.nvim/config.lua}
${lib.strings.fileContents ./.nvim/lsp.lua}
EOF
''
];
extraPackages = with pkgs; [
# used to compile tree-sitter grammar
tree-sitter
# https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
nodePackages.bash-language-server
shellcheck
nixd
];
plugins = with pkgs.vimPlugins; [
# you can use plugins from the pkgs
vim-which-key
clangd_extensions-nvim
nvim-treesitter.withAllGrammars
nvim-treesitter
# or you can use our function to directly fetch plugins from git
(plugin "hrsh7th/nvim-cmp") # completion
(plugin "neovim/nvim-lspconfig")
(plugin "Mofiqul/dracula.nvim")
(plugin "nvim-neo-tree/neo-tree.nvim")
# this installs the plugin from 'lua' branch
(plugin "lukas-reineke/indent-blankline.nvim")
];
};
}

View file

@ -124,7 +124,6 @@
grim
slurp
swappy
neovim
fontfor
qt5ct
lxappearance