Compare commits

...

2 Commits

Author SHA1 Message Date
Noah Masur
54e89d3acd add neovim as nix app 2022-11-29 20:48:46 -07:00
Noah Masur
b258a40181 working flake build of neovim 2022-11-29 20:40:15 -07:00
5 changed files with 61 additions and 96 deletions

View File

@ -6,12 +6,24 @@ configuration may be difficult to translate to a non-Nix system.
However, some of the configurations are easier to lift directly:
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/neovim/lua)
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/neovim/config)
- [Fish functions](https://github.com/nmasur/dotfiles/tree/master/modules/shell/fish/functions)
- [More fish aliases](https://github.com/nmasur/dotfiles/blob/master/modules/shell/fish/default.nix)
- [Git aliases](https://github.com/nmasur/dotfiles/blob/master/modules/shell/git.nix)
- [Hammerspoon](https://github.com/nmasur/dotfiles/tree/master/modules/darwin/hammerspoon)
Try out my Neovim config:
```bash
nix run github:nmasur/dotfiles#neovim
```
Or build it as a package:
```bash
nix build github:nmasur/dotfiles#neovim
```
---
# Installation
@ -87,12 +99,6 @@ openssl s_client -showcerts -verify 5 -connect cache.nixos.org:443 < /dev/null
sudo nvim $NIX_SSL_CERT_FILE
```
### Dealing with Neovim issues:
Update Neovim Packer plugins: `:PackerSync`
Update TreeSitter languages: `:TSUpdateSync`
---
# Flake Templates

View File

@ -20,4 +20,19 @@
# Connect machine metrics to Netdata Cloud
netdata = import ./netdata-cloud.nix { inherit pkgs; };
# Run neovim as an app
neovim = {
type = "app";
program = "${
(import ../modules/neovim/package {
inherit pkgs;
colors = import ../modules/colorscheme/gruvbox/neovim-gruvbox.nix {
inherit pkgs;
};
})
}/bin/nvim";
};
nvim = neovim;
}

View File

@ -1,4 +1,4 @@
{ inputs, globals, ... }:
{ inputs, globals, overlays, ... }:
with inputs;
@ -22,7 +22,7 @@ darwin.lib.darwinSystem {
};
mailUser = globals.user;
networking.hostName = "noah-masur-mac";
nixpkgs.overlays = [ firefox-darwin.overlay ];
nixpkgs.overlays = [ firefox-darwin.overlay ] ++ overlays;
# Set registry to flake packages, used for nix X commands
nix.registry.nixpkgs.flake = nixpkgs;
}

View File

@ -1,30 +1,38 @@
{ config, pkgs, lib, ... }: {
{ config, pkgs, lib, ... }:
home-manager.users.${config.user} = {
home.packages = [
(import ./package {
inherit pkgs;
colors = import config.theme.colors.neovimConfig { inherit pkgs; };
})
];
programs.git.extraConfig.core.editor = "nvim";
home.sessionVariables = {
EDITOR = "nvim";
MANPAGER = "nvim +Man!";
};
programs.fish = {
shellAliases = { vim = "nvim"; };
shellAbbrs = {
v = lib.mkForce "nvim";
vl = lib.mkForce "vim -c 'normal! `0' -c 'bdelete 1'";
vll = "nvim -c 'Telescope oldfiles'";
};
};
let
neovim = import ./package {
inherit pkgs;
colors = import config.theme.colors.neovimConfig { inherit pkgs; };
};
in {
home-manager.users.${config.user} =
{
home.packages = [ neovim ];
programs.git.extraConfig.core.editor = "nvim";
home.sessionVariables = {
EDITOR = "nvim";
MANPAGER = "nvim +Man!";
};
programs.fish = {
shellAliases = { vim = "nvim"; };
shellAbbrs = {
v = lib.mkForce "nvim";
vl = lib.mkForce "nvim -c 'normal! `0' -c 'bdelete 1'";
vll = "nvim -c 'Telescope oldfiles'";
};
};
programs.kitty.settings.scrollback_pager = lib.mkForce ''
${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
};
# # Used for icons in Vim
# fonts.fonts = with pkgs; [ nerdfonts ];

View File

@ -1,64 +0,0 @@
# Neovim Plugins
## Must-haves
- neovim/nvim-lspconfig: enable LSP
- hrsh7th/cmp-nvim-lsp: connect LSP to nvim-cmp
- hrsh7th/cmp-buffer: completion from current buffer
- nvim-lua/plenary.nvim: utility functions for other plugins
- jose-elias-alvarez/null-ls.nvim: auto-trigger linting, formatting
- tpope/vim-surround: surround shortcuts
- tpope/vim-repeat: better repeat with .
- numToStr/Comment.nvim: smart comment shortcut
- lewis6991/impatient.nvim: faster start time
- nvim-treesitter/nvim-treesitter: language parsers
- nvim-telescope/telescope.nvim: fuzzy finder
- nvim-telescope/telescope-project.nvim: jump projects
- akinsho/toggleterm.nvim: embedded floating terminal
- lewis6991/gitsigns.nvim: git in sidebar
- hoob3rt/lualine.nvim: status bar
- kyazdani42/nvim-web-devicons: icons in status bar
- akinsho/bufferline.nvim: tab view for buffers
- moll/vim-bbye: fixes for buffer closing
- kyazdani42/nvim-tree.lua: better sidebar explorer
## Optional
- hrsh7th/cmp-path: completion of file path
- hrsh7th/cmp-cmdline: completion of shell commands
- hrsh7th/cmp-nvim-lua: completion of neovim commands
- L3MON4D3/LuaSnip: snippet engine
- saadparwaiz1/cmp_luasnip: completion of luasnip snippets
- lukas-reineke/cmp-rg: completion of ripgrep search
- rafamadriz/friendly-snippets: pre-generated snippets
- folke/lsp-colors.nvim: LSP error highlights
- tpope/vim-eunuch: file manipulation
- tpope/vim-vinegar: better netrw file explorer
- tpope/vim-fugitive: git commands
- godlygeek/tabular: alignment commands
- jakewvincent/mkdnflow.nvim: markdown notes
- nvim-treesitter/nvim-treesitter-textobjects: syntax-aware textobjects
- chr4/nginx.vim: nginx syntax
- towolf/vim-helm: helm syntax
- rodjek/vim-puppet: puppet syntax
- nvim-telescope/telescope-fzy-native.nvim: faster sorting
- jvgrootveld/telescope-zoxide: jump directories
- nvim-telescope/telescope-file-browser.nvim: view files
- ellisonleao/glow.nvim: view markdown with glow
- norcalli/nvim-colorizer.lua: preview hex colors
# Other Tools
- git
- stylua
- black
- flake8
- fish_indent
- nixfmt
- rustfmt
- shellcheck
- shfmt
- terraform
- luacheck
- markdownlint
- pylint