fail miserably at neovim

This commit is contained in:
Kopatz
2023-11-07 11:46:01 +01:00
parent dc438a9c6d
commit 94ee3ce222
6 changed files with 114 additions and 48 deletions

View File

@@ -61,6 +61,17 @@
];
specialArgs = { inherit inputs; };
};
nixosConfigurations."nix-laptop" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs; };
modules = [
./users/kopatz.nix
./laptop/configuration.nix
nixos-hardware.nixosModules.dell-xps-15-7590-nvidia
agenix.nixosModules.default
home-manager.nixosModules.home-manager
];
};
nixosConfigurations."nix-laptop-no-gpu" = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs; };

View File

@@ -5,7 +5,7 @@ in
{
imports = [
(
import ./home-manager/nvim.nix ({ user="${user}"; })
import ./home-manager/nvim/nvim.nix ({ user="${user}"; pkgs=pkgs; })
)
];
home-manager = {

View File

@@ -1,46 +0,0 @@
{ user, ... }:
{
home-manager.users.${user} = { pkgs, ...}: {
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
(nvim-treesitter.withAllGrammars)
];
extraPackages = with pkgs;
[];
extraConfig = ''
set autoindent expandtab tabstop=4 shiftwidth=4
set clipboard=unnamed
syntax on
set cc=80
colorscheme habamax
set list
set listchars=tab:\ ,space:·,nbsp:,trail:,precedes:«,extends:»
'';
coc.enable = true;
coc.settings = ''
"suggest.noselect" = true;
"suggest.enablePreview" = true;
"suggest.enablePreselect" = false;
"suggest.disableKind" = true;
"languageserver": {
"nix": {
"command": "${pkgs.nil}/bin/nil",
"filetypes": ["nix"],
"rootPatterns": ["flake.nix"],
// Uncomment these to tweak settings.
// "settings": {
// "nil": {
// "formatting": { "command": ["nixpkgs-fmt"] }
// }
// }
}
}
'';
};
};
}

View File

@@ -0,0 +1,29 @@
-- -------
-- Library
-- -------
function map (mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end
function nmap(shortcut, command)
map('n', shortcut, command)
end
function imap(shortcut, command)
map('i', shortcut, command)
end
-- ------
-- Config
-- ------
vim.cmd([[
set autoindent expandtab tabstop=4 shiftwidth=4
set clipboard=unnamed
syntax on
set cc=80
colorscheme habamax
set list
set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,precedes:«,extends:»
map <Space> <Leader>
]])

View File

@@ -0,0 +1,72 @@
{ user, pkgs, ... }:
{
home-manager.users.${user} = { pkgs, ...}: {
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
(nvim-treesitter.withAllGrammars)
vim-nix
# Buffer tabs
{
plugin = bufferline-nvim;
type = "lua";
config = ''
require("bufferline").setup{ }
nmap("<leader>b", ":BufferLineCycleNext<cr>")
nmap("<leader>B", ":BufferLineCyclePrev<cr>")
'';
}
# File browser
{
plugin = nvim-tree-lua;
type = "lua";
config = ''
require("nvim-tree").setup()
'';
}
{
plugin = vim-which-key;
type = "lua";
# TODO: How to port this to Lua?
config = ''
vim.cmd([[
map <Space> <Leader>
let g:mapleader = "\<Space>"
let g:maplocalleader = ','
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
]])
'';
}
];
extraPackages = with pkgs; [
nodejs
nil
];
extraConfig = ''
lua << EOF
${builtins.readFile ./config.lua}
EOF
'';
coc.enable = true;
coc.settings = ''
"suggest.noselect" = true;
"suggest.enablePreview" = true;
"suggest.enablePreselect" = false;
"suggest.disableKind" = true;
"coc.preferences.formatOnSave" = true;
"languageserver": {
"nix": {
"command": "${pkgs.nil}/bin/nil",
"filetypes": ["nix"],
"rootPatterns": ["flake.nix"],
}
}
'';
};
};
}

View File

@@ -5,7 +5,7 @@ in
{
imports = [
(
import ./home-manager/nvim.nix ({ user="${user}"; })
import ./home-manager/nvim/nvim.nix ({ user="${user}"; pkgs = pkgs; })
)
];
home-manager = {