mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2024-11-15 05:13:10 +01:00
use nixvim
This commit is contained in:
parent
7ff419c094
commit
5b7a195446
121
flake.lock
121
flake.lock
|
@ -16,6 +16,44 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"beautysh": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
],
|
||||
"poetry2nix": "poetry2nix",
|
||||
"utils": "utils_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1669854260,
|
||||
"narHash": "sha256-Z8NAL3g4i5LAhxveNGJhrVDHxIBbUf1lVIy/Thr2RMU=",
|
||||
"owner": "lovesegfault",
|
||||
"repo": "beautysh",
|
||||
"rev": "d616eb8d9d05ee4fb33de9c5521d99c3f0695d52",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lovesegfault",
|
||||
"repo": "beautysh",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1676283394,
|
||||
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -24,11 +62,11 @@
|
|||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677012759,
|
||||
"narHash": "sha256-OtpMvJiChwpMc0rZ/WSKLgpBcx/1zuUcT9MhOPVoz34=",
|
||||
"lastModified": 1677104801,
|
||||
"narHash": "sha256-2V5nKOYVFMYlseYdDKiEaww2xqcE0GtS1ax3SoUX99I=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "c7c69ec40543d5c088abf0af816aff7b738ccaa2",
|
||||
"rev": "4295fdfa6b0005c32f2e1f0b732faf5810c1bc7f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -47,11 +85,11 @@
|
|||
"xdph": "xdph"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677012422,
|
||||
"narHash": "sha256-8FiSyHE3lscZKts1W+U6DSyxdvxKzeql2RQ9qln7Ra4=",
|
||||
"lastModified": 1677107771,
|
||||
"narHash": "sha256-eS/ylmm1y4ELz/Ow0goDA9u9LbuUPujdHpcdXcSYHJc=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "Hyprland",
|
||||
"rev": "66e3679ba3dd1412f47e08c52872b7583deff291",
|
||||
"rev": "2bf7f9e4136ebef6db1159c636b163ecb96f23cc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -137,11 +175,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1676973346,
|
||||
"narHash": "sha256-rft8oGMocTAhUVqG3LW6I8K/Fo9ICGmNjRqaWTJwav0=",
|
||||
"lastModified": 1677063315,
|
||||
"narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d0d55259081f0b97c828f38559cad899d351cad1",
|
||||
"rev": "988cc958c57ce4350ec248d2d53087777f9e1949",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -182,6 +220,55 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixvim": {
|
||||
"inputs": {
|
||||
"beautysh": "beautysh",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677143916,
|
||||
"narHash": "sha256-XlwHrSGK9323LGpF2KNuokHXdn8zlL6uj0h0e64tGUs=",
|
||||
"owner": "pta2002",
|
||||
"repo": "nixvim",
|
||||
"rev": "67f5db9cfd56ec45dcc5234d99edec7428d12107",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "pta2002",
|
||||
"repo": "nixvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"poetry2nix": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"nixvim",
|
||||
"beautysh",
|
||||
"utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"beautysh",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1658665240,
|
||||
"narHash": "sha256-/wkx7D7enyBPRjIkK0w7QxLQhzEkb3UxNQnjyc3FTUI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"rev": "8b8edc85d24661d5a6d0d71d6a7011f3e699780f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
|
@ -190,6 +277,7 @@
|
|||
"nix-colors": "nix-colors",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixvim": "nixvim",
|
||||
"sops-nix": "sops-nix"
|
||||
}
|
||||
},
|
||||
|
@ -229,6 +317,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wlroots": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
|
@ -8,14 +8,16 @@
|
|||
nix-colors.url = github:Misterio77/nix-colors;
|
||||
hyprpaper.url = github:hyprwm/hyprpaper;
|
||||
nixos-hardware.url = github:nixos/nixos-hardware;
|
||||
nixvim.url = github:pta2002/nixvim;
|
||||
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
hyprland.inputs.nixpkgs.follows = "nixpkgs";
|
||||
hyprpaper.inputs.nixpkgs.follows = "nixpkgs";
|
||||
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
nixvim.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, hyprland, hyprpaper, sops-nix, nix-colors, nixos-hardware }@attrs: {
|
||||
outputs = { self, nixpkgs, home-manager, hyprland, hyprpaper, sops-nix, nix-colors, nixos-hardware, nixvim }@attrs: {
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
|
||||
nixosConfigurations = {
|
||||
thinkpad = nixpkgs.lib.nixosSystem {
|
||||
|
@ -33,6 +35,7 @@
|
|||
imports = [
|
||||
nix-colors.homeManagerModule
|
||||
hyprland.homeManagerModules.default
|
||||
nixvim.homeManagerModules.nixvim
|
||||
];
|
||||
config = {
|
||||
colorScheme = nix-colors.colorSchemes.dracula;
|
||||
|
|
|
@ -2,30 +2,128 @@
|
|||
{
|
||||
home.packages = with pkgs; [
|
||||
# a few language servers
|
||||
python310Packages.python-lsp-server
|
||||
python310Packages.python-lsp-black
|
||||
python310Packages.black
|
||||
python310Packages.pylint
|
||||
rnix-lsp
|
||||
ripgrep
|
||||
#python310Packages.python-lsp-server
|
||||
#python310Packages.python-lsp-black
|
||||
#python310Packages.black
|
||||
#python310Packages.pylint
|
||||
#rnix-lsp
|
||||
];
|
||||
programs.neovim = {
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
nerdtree
|
||||
nerdcommenter
|
||||
vim-repeat
|
||||
vim-airline
|
||||
fzf-vim
|
||||
dracula-vim
|
||||
vim-nix # this destroys my tab settings, ffs
|
||||
nvim-lspconfig
|
||||
nvim-cmp
|
||||
lsp-format-nvim
|
||||
cmp-buffer
|
||||
cmp-nvim-lsp
|
||||
cmp-path
|
||||
colorscheme = "dracula";
|
||||
options =
|
||||
{
|
||||
shiftwidth = 4;
|
||||
expandtab = false;
|
||||
preserveindent = true;
|
||||
number = true;
|
||||
relativenumber = true;
|
||||
tabstop = 4;
|
||||
smartcase = true;
|
||||
colorcolumn = "120";
|
||||
wrap = false;
|
||||
};
|
||||
globals = {
|
||||
mapleader = " ";
|
||||
dracula_colorterm = 0;
|
||||
};
|
||||
maps = {
|
||||
normalVisualOp = {
|
||||
";" = ":";
|
||||
":" = ";";
|
||||
};
|
||||
normal = {
|
||||
# remove ex mode shortcut
|
||||
"Q" = "<Nop>";
|
||||
#trigger the fuzzy finder (fzf)
|
||||
"<leader>f" = ":Files<CR>";
|
||||
"<leader>g" = ":GFiles<CR>";
|
||||
"<leader>b" = ":Buffers<CR>";
|
||||
"<leader>r" = ":Rg<CR>";
|
||||
# diacnostics
|
||||
"<leader>e" = "vim.diagnostic.open_float";
|
||||
"<leader>q" = "vim.diagnostic.setloclist";
|
||||
|
||||
#quickfixlist binds
|
||||
"<C-j>" = ":cnext<CR>";
|
||||
"<C-k>" = ":cprev<CR>";
|
||||
|
||||
#locallist binds
|
||||
"<C-l>" = ":lnext<CR>";
|
||||
"<C-h>" = ":lprev<CR>";
|
||||
|
||||
#split keybinds
|
||||
"<leader>s" = ":sp<CR>";
|
||||
"<leader>v" = ":vs<CR>";
|
||||
"<leader>h" = "<C-w>h";
|
||||
"<leader>j" = "<C-w>j";
|
||||
"<leader>k" = "<C-w>k";
|
||||
"<leader>l" = "<C-w>l";
|
||||
|
||||
};
|
||||
};
|
||||
plugins = {
|
||||
airline = {
|
||||
enable = true;
|
||||
powerline = true;
|
||||
};
|
||||
nvim-tree = {
|
||||
enable = true;
|
||||
autoClose = true;
|
||||
};
|
||||
comment-nvim.enable = true;
|
||||
lsp = {
|
||||
enable = true;
|
||||
onAttach = ''
|
||||
require("lsp-format").on_attach(client)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
'';
|
||||
servers = {
|
||||
pyright = {
|
||||
enable = true;
|
||||
};
|
||||
rnix-lsp = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
nvim-cmp = {
|
||||
enable = true;
|
||||
sources = [
|
||||
{
|
||||
name = "nvim_lsp";
|
||||
}
|
||||
{ name = "path"; }
|
||||
{ name = "buffer"; }
|
||||
];
|
||||
};
|
||||
xdg.configFile."nvim/init.lua".source = ./init.lua;
|
||||
};
|
||||
extraPlugins = with pkgs.vimPlugins;
|
||||
[
|
||||
dracula-vim
|
||||
nerdcommenter
|
||||
lsp-format-nvim
|
||||
];
|
||||
highlight.ColorColumn.ctermbg = "darkgray";
|
||||
extraConfigLuaPre = ''
|
||||
local lsp_format = require("lsp-format")
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
local g = vim.g
|
||||
local opt = vim.opt
|
||||
local cmd = vim.cmd
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
--local map = vim.api.nvim_set_keymap opt.shiftwidth = 4
|
||||
opt.expandtab = false
|
||||
opt.preserveindent = true
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.tabstop = 4
|
||||
opt.smartcase = true
|
||||
opt.colorcolumn = { '120' }
|
||||
opt.wrap = false
|
||||
cmd('highlight ColorColumn ctermbg=darkgray')
|
||||
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local options = { noremap=true }
|
||||
if opts then options = vim.tbl_extend('force', options, opts)
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
map({'n', 'v'}, ';', ':')
|
||||
map({'n', 'v'}, ':', ';')
|
||||
|
||||
-- set space as leader
|
||||
map('n', '<SPACE>', '<Nop>')
|
||||
g.mapleader = " "
|
||||
|
||||
--air-line
|
||||
g.airline_powerline_fonts = 1
|
||||
|
||||
--NERDTree
|
||||
map('n', '<leader>n :NERDTreeFocus<CR>', ':NERDTreeRefreshRoot<CR>')
|
||||
--NERDTree autostart"
|
||||
autocmd('VimEnter', {command = 'NERDTree | wincmd p'})
|
||||
|
||||
--Close the tab if NERDTree is the only window remaining in it.
|
||||
--autocmd("BufEnter", {
|
||||
--pattern = "*",
|
||||
--command = "if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif"
|
||||
--})
|
||||
|
||||
-- remove ex-mode shortcut
|
||||
map('n', 'Q', '<Nop>')
|
||||
|
||||
--trigger the fuzzy finder (fzf)
|
||||
map('n', '<leader>f', ":Files<CR>")
|
||||
map('n', '<leader>g', ":GFiles<CR>")
|
||||
map('n', '<leader>b', ":Buffers<CR>")
|
||||
map('n', '<leader>r', ":Rg<CR>")
|
||||
|
||||
--quickfixlist binds
|
||||
map('n', '<C-j>', ":cnext<CR>")
|
||||
map('n', '<C-k>', ":cprev<CR>")
|
||||
|
||||
--locallist binds
|
||||
map('n', '<C-l>', ":lnext<CR>")
|
||||
map('n', '<C-h>', ":lprev<CR>")
|
||||
|
||||
--split keybinds
|
||||
map('n', '<leader>s', ":sp<CR>")
|
||||
map('n', '<leader>v', ":vs<CR>")
|
||||
|
||||
map('n', '<leader>h', "<C-w>h")
|
||||
map('n', '<leader>j', "<C-w>j")
|
||||
map('n', '<leader>k', "<C-w>k")
|
||||
map('n', '<leader>l', "<C-w>l")
|
||||
|
||||
--coloring stuff
|
||||
g.dracula_colorterm = 0
|
||||
cmd('colorscheme dracula')
|
||||
|
||||
local lsp = require("lspconfig")
|
||||
local lsp_format = require("lsp-format")
|
||||
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
lsp_format.on_attach(client)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
|
||||
lsp.pylsp.setup {
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pylint = { enable = true },
|
||||
black = {
|
||||
enable = true,
|
||||
line_legth=120,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lsp.rnix.setup {
|
||||
on_attach = on_attach
|
||||
}
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup {
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = false }),
|
||||
|
||||
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{
|
||||
name = 'buffer',
|
||||
option = {
|
||||
keyword_pattern = [[\k\+]], -- allow unicode multibyte characters
|
||||
},
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue