feat: no more using nix to install nvim plugins
This commit is contained in:
parent
400794b28c
commit
92caa088aa
|
@ -12,3 +12,6 @@ My flake based nixos configuration. To use this, just rebuild your system using
|
|||
- automatically save/restore state using continuum
|
||||
- customize status bar
|
||||
- clean out the mess I made for installing fish themes
|
||||
- customize picom
|
||||
- vim:
|
||||
- configure lualine more
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
-- Import my other files
|
||||
require("my.options").setup()
|
||||
require('my.keymaps').setup()
|
||||
require('my.plugins').setup()
|
||||
require("telescope.extensions.unicode").setupAbbreviations()
|
13
dotfiles/neovim/lua/my/init.lua
Normal file
13
dotfiles/neovim/lua/my/init.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Import my other files
|
||||
require("my.paq").setup()
|
||||
require("my.theme").setup()
|
||||
require("my.options").setup()
|
||||
require('my.keymaps').setup()
|
||||
require('my.plugins').setup()
|
||||
require("telescope.extensions.unicode").setupAbbreviations()
|
||||
end
|
||||
|
||||
return M
|
|
@ -10,7 +10,6 @@ function M.setup()
|
|||
"setf " .. syntax)
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
49
dotfiles/neovim/lua/my/paq.lua
Normal file
49
dotfiles/neovim/lua/my/paq.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
local paq = require("paq")
|
||||
local themePackages = require("my.theme").deps
|
||||
local base = {
|
||||
"neovim/nvim-lspconfig", -- configures lsps for me
|
||||
"windwp/nvim-autopairs", -- closes pairs for me (should look for a better one)
|
||||
"nvim-lua/plenary.nvim", -- async utility lib it seems?
|
||||
"nvim-telescope/telescope.nvim", -- fuzzy search for say opening files
|
||||
"purescript-contrib/purescript-vim", -- purescript support
|
||||
"terrortylor/nvim-comment", -- allows toggling line comments
|
||||
{"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}, -- use treesitter for syntax highlighting
|
||||
{"nvim-treesitter/nvim-treesitter-textobjects", run = ":TSUpdate"}, -- the lean plugin wants me to install this, lol
|
||||
"startup-nvim/startup.nvim", -- splash screen
|
||||
"kyazdani42/nvim-web-devicons", -- nice looking icons
|
||||
"nvim-lualine/lualine.nvim", -- customizable status line
|
||||
"kyazdani42/nvim-tree.lua", -- file tree
|
||||
"lervag/vimtex", -- latex support
|
||||
"jose-elias-alvarez/null-ls.nvim", -- generic language server
|
||||
"nvim-telescope/telescope-file-browser.nvim", -- file creation/deletion menu
|
||||
"onsails/lspkind.nvim", -- show icons in lsp completion menus
|
||||
"preservim/vimux", -- interact with tmux from within vim
|
||||
"christoomey/vim-tmux-navigator", -- easly switch between tmux and vim panes
|
||||
"kana/vim-arpeggio", -- chord support, let"s fucking goooo
|
||||
{"andweeb/presence.nvim", run = ":DownloadUnicode"}, -- discord rich presence
|
||||
"Julian/lean.nvim", -- lean support
|
||||
"kmonad/kmonad-vim", -- kmonad config support
|
||||
"LucHermitte/lh-vim-lib", -- dependency for lh-brackets
|
||||
"LucHermitte/lh-brackets", -- kinda useless bruh
|
||||
-- Cmp related stuff
|
||||
"hrsh7th/cmp-nvim-lsp", -- lsp completion
|
||||
"hrsh7th/cmp-buffer", -- idr what this is
|
||||
"hrsh7th/cmp-path", -- path completion ig?
|
||||
"hrsh7th/cmp-cmdline", -- cmdline completion perhaps?
|
||||
"hrsh7th/nvim-cmp", -- completion engine
|
||||
"L3MON4D3/LuaSnip", -- snippeting engine
|
||||
"saadparwaiz1/cmp_luasnip" -- snippet support for cmp
|
||||
}
|
||||
|
||||
for _, v in ipairs(themePackages) do
|
||||
-- append package in the base list
|
||||
table.insert(base, v)
|
||||
end
|
||||
|
||||
paq(base)
|
||||
end
|
||||
|
||||
return M
|
|
@ -3,6 +3,7 @@ local A = require("my.plugins.arpeggio")
|
|||
local M = {}
|
||||
|
||||
local function map(buf, mode, lhs, rhs, opts)
|
||||
|
||||
local options = {noremap = true, silent = true}
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
|
||||
|
@ -12,7 +13,8 @@ function M.on_attach(client, bufnr)
|
|||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
print("Initializing formatter...")
|
||||
vim.cmd([[
|
||||
augroup LspFormatting
|
||||
autocmd! * <buffer>
|
||||
|
@ -21,36 +23,39 @@ function M.on_attach(client, bufnr)
|
|||
]])
|
||||
end
|
||||
|
||||
print("Setting up keybinds...")
|
||||
-- Go to declaration / definition / implementation
|
||||
map(bufnr, "n", 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
|
||||
map(bufnr, "n", 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
|
||||
map(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
|
||||
|
||||
-- Hover
|
||||
map(bufnr, 'n', 'J',
|
||||
"<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>")
|
||||
map(bufnr, 'n', 'J', "<cmd>lua vim.diagnostic.open_float()<CR>")
|
||||
map(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
|
||||
map(bufnr, 'n', 'L', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
|
||||
|
||||
-- Workspace stuff
|
||||
map(bufnr, 'n', '<leader>wa',
|
||||
'<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||
map(bufnr, 'n', '<leader>wr',
|
||||
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
|
||||
map(bufnr, 'n', '<leader>wl',
|
||||
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
|
||||
-- map(bufnr, 'n', '<leader>wa',
|
||||
-- '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||
-- map(bufnr, 'n', '<leader>wr',
|
||||
-- '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
|
||||
-- map(bufnr, 'n', '<leader>wl',
|
||||
-- '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
|
||||
|
||||
-- Code actions
|
||||
map(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
|
||||
map(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>')
|
||||
-- map(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
|
||||
map(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
|
||||
map(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
|
||||
map(bufnr, 'n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>')
|
||||
map(bufnr, 'n', '<leader>f',
|
||||
'<cmd>lua vim.lsp.buf.format({async = true})<CR>')
|
||||
|
||||
print("Initialized language server!")
|
||||
end
|
||||
|
||||
local function on_attach_typescript(client, bufnr)
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
client.resolved_capabilities.document_range_formatting = false
|
||||
-- We handle formatting using null-ls and prettierd
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
|
||||
M.on_attach(client, bufnr)
|
||||
end
|
||||
|
|
|
@ -12,9 +12,7 @@ local bindings = {
|
|||
live_grep = "<c-F>",
|
||||
|
||||
-- See diagnostics with space + d
|
||||
lsp_document_diagnostics = "<Leader>d",
|
||||
lsp_workspace_diagnostics = "<Leader>wd",
|
||||
lsp_code_actions = "<Leader>ca",
|
||||
diagnostics = "<Leader>d",
|
||||
|
||||
-- Open a list with all the pickers
|
||||
builtin = "<Leader>t",
|
||||
|
|
|
@ -2,10 +2,16 @@ local M = {}
|
|||
|
||||
function M.setup()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = "maintained",
|
||||
ensure_installed = {
|
||||
"bash", "javascript", "typescript", "c", "cpp", "css", "dockerfile",
|
||||
"elixir", "fish", "html", "json", "latex", "python", "rust", "scss",
|
||||
"toml", "tsx", "vim", "yaml", "nix"
|
||||
},
|
||||
sync_install = false,
|
||||
indent = {enable = true},
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = {"lua"}, -- WHY TF DOES THIS NOT WORK
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
|
|
|
@ -40,4 +40,4 @@ set-option -g @fastcopy-action 'tmux load-buffer -w -'
|
|||
set-option -g @fastcopy-key a
|
||||
|
||||
# Keep state around using resurrect
|
||||
set -g @resurrect-processes '"./result/bin/qkm ./myConfig.json"'
|
||||
set -g @resurrect-processes '"~python3"'
|
||||
|
|
|
@ -1,36 +1,13 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{ pkgs, lib, paths, ... }:
|
||||
let
|
||||
theme = pkgs.myThemes.current;
|
||||
|
||||
# config-nvim = "/etc/nixos/configuration/dotfiles/neovim";
|
||||
config-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
name = "config-nvim";
|
||||
src = ../../dotfiles/neovim;
|
||||
paq = pkgs.fetchFromGitHub {
|
||||
owner = "savq";
|
||||
repo = "paq-nvim";
|
||||
rev = "cbbb8a550e35b1e6c9ddf7b098b25e6c2d8b1e86";
|
||||
sha256 = "0fsbww2kqwayi1azhglsjal6mwh68n03ylxxqzq17v7sar17vx4c";
|
||||
};
|
||||
|
||||
# Lua code for importing a theme
|
||||
loadTheme = (theme: ''
|
||||
${theme.neovim.theme}
|
||||
|
||||
vim.g.lualineTheme = ${theme.neovim.lualineTheme}
|
||||
'');
|
||||
|
||||
# Wrap a piece of lua code
|
||||
lua = (code: ''
|
||||
lua << EOF
|
||||
${code}
|
||||
EOF
|
||||
'');
|
||||
in
|
||||
{
|
||||
home-manager.users.adrielus.programs.neovim = {
|
||||
enable = true;
|
||||
package = pkgs.neovim-nightly;
|
||||
|
||||
extraConfig = ''
|
||||
${lua (loadTheme theme)}
|
||||
luafile ${config-nvim}/init.lua
|
||||
'';
|
||||
theme = pkgs.myThemes.current;
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# Language servers
|
||||
|
@ -51,51 +28,42 @@ in
|
|||
ripgrep # grep rewrite (I think?)
|
||||
nodePackages.typescript # typescript language
|
||||
update-nix-fetchgit # useful for nix stuff
|
||||
tree-sitter # syntax highlighting
|
||||
|
||||
texlive.combined.scheme-full # latex stuff
|
||||
python38Packages.pygments # required for latex syntax highlighting
|
||||
];
|
||||
|
||||
plugins = with pkgs.vimPlugins;
|
||||
with pkgs.vimExtraPlugins; with pkgs.myVimPlugins; theme.neovim.plugins ++ [
|
||||
config-nvim # my neovim config
|
||||
nvim-lspconfig # configures lsps for me
|
||||
nvim-autopairs # close pairs for me
|
||||
telescope-nvim # fuzzy search for say opening files
|
||||
purescript-vim # purescript syntax highlighting
|
||||
nvim-comment # allows toggling line-comments
|
||||
nvim-treesitter # use treesitter for syntax highlighting
|
||||
nvim-treesitter-textobjects # the lean plugin told me to add this
|
||||
startup-nvim # splash screen
|
||||
vim-devicons # nice looking icons
|
||||
nvim-web-devicons # fork of vim-devicons?
|
||||
plenary-nvim # async utility lib it seems?
|
||||
lualine-nvim # customizable status line
|
||||
nvim-tree-lua # file tree
|
||||
vimtex # latex plugin
|
||||
null-ls-nvim # generic language server
|
||||
telescope-file-browser-nvim # file creation/deletion using telescope
|
||||
lspkind-nvim # show icons in lsp completion menus
|
||||
# symbols-outline-nvim # tree view for symbols in document
|
||||
vimux # interact with tmux from within vim
|
||||
vim-tmux-navigator # easly switch between tmux and vim panes
|
||||
arpeggio # allows me to setup chord keybinds (keybinds where all the keys are pressed at the same time)
|
||||
presence-nvim # discord rich presence
|
||||
agda-nvim # agda support
|
||||
unicode-vim # better unicode support
|
||||
lean-nvim # lean support
|
||||
kmonad # support for the kmonad config language
|
||||
lh-vim-lib # dependency for lh-brackets
|
||||
lh-brackets # bracket customization
|
||||
myConfig = ''
|
||||
vim.g.lualineTheme = ${theme.neovim.lualineTheme}
|
||||
vim.opt.runtimepath:append("${paths.dotfiles}/neovim")
|
||||
-- dofile("${paths.dotfiles}/neovim/my/init.lua").setup()
|
||||
require("my.init").setup()
|
||||
'';
|
||||
|
||||
# Cmp related stuff. See https://github.com/hrsh7th/nvim-cmp
|
||||
cmp-nvim-lsp
|
||||
cmp-buffer
|
||||
cmp-path
|
||||
cmp-cmdline
|
||||
cmp_luasnip
|
||||
nvim-cmp # completion engine
|
||||
luasnip # snippet engine
|
||||
];
|
||||
base = pkgs.neovim-nightly;
|
||||
neovim =
|
||||
pkgs.symlinkJoin {
|
||||
inherit (base) name meta;
|
||||
paths = [ base ];
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nvim \
|
||||
--prefix PATH : ${lib.makeBinPath extraPackages}
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
home-manager.users.adrielus =
|
||||
{
|
||||
home.file.".local/share/nvim/site/pack/paqs/start/paq-nvim".source = paq;
|
||||
xdg.configFile."nvim/init.lua".text = myConfig;
|
||||
xdg.configFile."nvim/lua/my/theme.lua".source = theme.neovim.theme;
|
||||
home.packages = [ neovim ];
|
||||
|
||||
programs.neovim = {
|
||||
enable = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
./applications
|
||||
./themes
|
||||
./overlays
|
||||
./meta
|
||||
|
||||
./network.nix
|
||||
./xserver.nix
|
||||
|
|
3
modules/meta/default.nix
Normal file
3
modules/meta/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{ pkgs, ... }: {
|
||||
home-manager.sharedModules = [ ./simlink.nix ];
|
||||
}
|
13
modules/meta/simlink.nix
Normal file
13
modules/meta/simlink.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
# This is a home-manager config!!!
|
||||
{ pkgs, lib, config, ... }: with lib; {
|
||||
options.home.sfile = mkOption {
|
||||
description = "Attribute set of files to link into the user home without placing them into the store first";
|
||||
default = { };
|
||||
type = types.attrsOf types.string;
|
||||
};
|
||||
config.systemd.user.tmpfiles.rules = mapAttrsToList
|
||||
(name: value:
|
||||
"L+ ${name} - - - - ${value}"
|
||||
)
|
||||
config.home.sfile;
|
||||
}
|
|
@ -9,16 +9,8 @@ in
|
|||
wallpaper = wallpaper.foreign or "${foreign.wallpapers}/${wallpaper}";
|
||||
|
||||
neovim = {
|
||||
theme = builtins.readFile ./nvim.lua;
|
||||
theme = ./nvim.lua;
|
||||
lualineTheme = "catppuccin";
|
||||
plugins = [
|
||||
(
|
||||
pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
name = "catppuccin";
|
||||
src = foreign.nvim;
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
# grub.path = "${foreign.grub}/catppuccin-grub-theme/theme.txt";
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
{ fetchFromGitHub, ... }: {
|
||||
nvim = fetchFromGitHub {
|
||||
owner = "catppuccin";
|
||||
repo = "nvim";
|
||||
sha256 = "1w96rvpbm7lk9lcc5i13d6dyb5b10vkjh1902xmklqvpzy1wya19";
|
||||
rev = "8a67df6da476cba68ecf26a519a5279686edbd2e";
|
||||
};
|
||||
tmux = fetchFromGitHub {
|
||||
owner = "catppuccin";
|
||||
repo = "tmux";
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
local catppuccin = require("catppuccin")
|
||||
local M = {}
|
||||
|
||||
catppuccin.setup({
|
||||
M.deps = {{"catppuccin/nvim", as = "catppuccin"}}
|
||||
|
||||
function M.setup()
|
||||
local catppuccin = require("catppuccin")
|
||||
|
||||
catppuccin.setup({
|
||||
transparent_background = true,
|
||||
integrations = {nvimtree = {transparent_panel = true}}
|
||||
})
|
||||
})
|
||||
|
||||
vim.cmd [[colorscheme catppuccin]]
|
||||
vim.cmd [[colorscheme catppuccin]]
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Reference in a new issue