Skip to content

Commit

Permalink
feat(neovim): separate config in another repository
Browse files Browse the repository at this point in the history
This caused issues when using lua_ls where the symlinks
created by home-manager were not followed correctly.

And this is, more generally, more stable and easily maintanable.
  • Loading branch information
d4ilyrun committed Dec 14, 2023
1 parent cf68f73 commit dcb8349
Show file tree
Hide file tree
Showing 55 changed files with 36 additions and 3,504 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "applications/neovim/config"]
path = applications/neovim/config
url = [email protected]:d4ilyrun/nvim-config.git
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ repos:
hooks:
- id: shellcheck
- id: apply-nixpkgs-fmt

- repo: "https://github.com/JohnnyMorganz/StyLua"
rev: "v0.17.1"
hooks:
- id: stylua-system
6 changes: 6 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"
1 change: 1 addition & 0 deletions applications/neovim/config
Submodule config added at 7071b4
144 changes: 12 additions & 132 deletions applications/neovim/default.nix
Original file line number Diff line number Diff line change
@@ -1,142 +1,22 @@
{ config, lib, pkgs, ... }:
{ pkgs, ... }:

let
vim_folder = "${config.dotfiles.folders.applications}/neovim";
vim_plugins = "${vim_folder}/plugins";
vim_lua = "${vim_folder}/lua";
vim_themes = "${vim_folder}/themes";

# 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";

pluginWithName = name: repo: pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = name;
version = "HEAD";
src = builtins.fetchGit {
url = "https://github.com/${repo}.git";
ref = "HEAD";
};
};

in
{
# Packages needed for neovim to work
home.packages = with pkgs; [
nodePackages.npm
nodePackages.pyright
nodePackages.typescript-language-server
sumneko-lua-language-server
ripgrep
glow
nil
];

programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
vimdiffAlias = true;
withNodeJs = true;

extraConfig = ''
lua home = "${config.dotfiles.homeDirectory}"
lua path = "${vim_lua}"
let g:vim_plugins_path="${vim_plugins}"
" You might have to force true color when using regular vim inside tmux as the
" colorscheme can appear to be grayscale with "termguicolors" option enabled.
if !has('gui_running') && &term =~ '^\%(screen\|tmux\)'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
set termguicolors
source ${vim_themes}/${config.dotfiles.theme.name}.vim
source ${vim_folder}/init.vim
source ${vim_plugins}/plugins.vim
lua dofile("${vim_lua}/init.lua")
'';

plugins = with pkgs.vimPlugins; [
# Navigation
(plugin "max397574/which-key.nvim")
(plugin "airblade/vim-rooter")
(plugin "startup-nvim/startup.nvim")
(plugin "nvim-telescope/telescope.nvim")
(plugin "kyazdani42/nvim-tree.lua")
(plugin "akinsho/bufferline.nvim")
(plugin "moll/vim-bbye")
(plugin "folke/trouble.nvim")
(plugin "folke/todo-comments.nvim")
(plugin "BurntSushi/ripgrep")

# Eyecandy
nvim-treesitter
nvim-web-devicons
# (plugin "glepnir/galaxyline.nvim")
(plugin "nvim-lualine/lualine.nvim")
(plugin "glepnir/galaxyline.nvim")
(plugin "norcalli/nvim-colorizer.lua") # color-previewer
(plugin "lukas-reineke/indent-blankline.nvim")
(plugin "smithbm2316/centerpad.nvim")
(plugin "rcarriga/nvim-notify")
(plugin "j-hui/fidget.nvim")

# LSP
(plugin "neovim/nvim-lspconfig")
(plugin "williamboman/nvim-lsp-installer")
(plugin "williamboman/mason-lspconfig.nvim")
(plugin "williamboman/mason.nvim")
(plugin "ojroques/nvim-lspfuzzy")

# CMP
(plugin "hrsh7th/nvim-cmp")
(plugin "hrsh7th/cmp-nvim-lsp")
(plugin "hrsh7th/cmp-cmdline")
(plugin "hrsh7th/cmp-buffer")
(plugin "hrsh7th/cmp-path")
(plugin "hrsh7th/cmp-nvim-lsp-signature-help")

# Snippets
(plugin "L3MON4D3/LuaSnip")
(plugin "saadparwaiz1/cmp_luasnip")
(plugin "tami5/lspsaga.nvim")
(plugin "mortepau/codicons.nvim")
(plugin "onsails/lspkind-nvim")

# Dev
(plugin "nvim-lua/plenary.nvim")
(plugin "jose-elias-alvarez/null-ls.nvim")
(plugin "mfussenegger/nvim-dap")
(plugin "rcarriga/nvim-dap-ui")
(plugin "nvim-telescope/telescope-dap.nvim")
(plugin "Shatur/neovim-cmake")
# (plugin "danymat/neogen")
(plugin "lewis6991/gitsigns.nvim")
(plugin "nvim-neotest/neotest")
(plugin "alfaix/neotest-gtest")
(plugin "antoinemadec/FixCursorHold.nvim")
(plugin "GnikDroy/projections.nvim")
(plugin "sindrets/diffview.nvim")

# Media files
(plugin "marioortizmanero/adoc-pdf-live.nvim") # PDF viewer
glow-nvim

# Themes
(pluginWithName "catpuccin" "catppuccin/nvim")
(plugin "joshdick/onedark.vim")
(plugin "tiagovla/tokyodark.nvim")
extraPackages = with pkgs; [
ripgrep # for telescope/fzf
];
};

# LSP
home.packages = with pkgs; [
nil
sumneko-lua-language-server
nodePackages.pyright
];
}
77 changes: 0 additions & 77 deletions applications/neovim/init.vim

This file was deleted.

81 changes: 0 additions & 81 deletions applications/neovim/lua/bufferline.lua

This file was deleted.

Loading

0 comments on commit dcb8349

Please sign in to comment.