mirror of
https://github.com/davegallant/nix-config
synced 2025-08-05 23:03:40 +00:00
Migrate to nixvim
This commit is contained in:
237
flake.lock
generated
237
flake.lock
generated
@@ -1,5 +1,28 @@
|
||||
{
|
||||
"nodes": {
|
||||
"beautysh": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
],
|
||||
"poetry2nix": "poetry2nix",
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1680308980,
|
||||
"narHash": "sha256-aUEHV0jk2qIFP3jlsWYWhBbm+w/N9gzH3e4I5DcdB5s=",
|
||||
"owner": "lovesegfault",
|
||||
"repo": "beautysh",
|
||||
"rev": "9845efc3ea3e86cc0d41465d720a47f521b2799c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lovesegfault",
|
||||
"repo": "beautysh",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -20,6 +43,80 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1685518550,
|
||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"pre-commit-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1660459072,
|
||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -89,6 +186,22 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1704290814,
|
||||
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1708151420,
|
||||
@@ -121,6 +234,82 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixvim": {
|
||||
"inputs": {
|
||||
"beautysh": "beautysh",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1704297403,
|
||||
"narHash": "sha256-g7+4SiXDGzIlWIfANyH1J5CeEaY+Alah6KOm6IO4nIk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "b3ea5256e07ee9105060cffa075028402946bd63",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "nixos-23.11",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixvim",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1703939133,
|
||||
"narHash": "sha256-Gxe+mfOT6bL7wLC/tuT2F+V+Sb44jNr8YsJ3cyIl4Mo=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "9d3d7e18c6bc4473d7520200d4ddab12f8402d38",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"darwin": "darwin",
|
||||
@@ -128,7 +317,53 @@
|
||||
"nix-ld": "nix-ld",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"nixvim": "nixvim"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1678901627,
|
||||
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@@ -16,6 +16,11 @@
|
||||
url = "github:lnl7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixvim = {
|
||||
url = "github:nix-community/nixvim/nixos-23.11";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {...} @ args: import ./outputs.nix args;
|
||||
|
206
home/default.nix
206
home/default.nix
@@ -4,16 +4,6 @@
|
||||
unstable,
|
||||
...
|
||||
}: let
|
||||
hound-nvim = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "hound-nvim";
|
||||
nativeBuildInputs = with pkgs; [lua53Packages.luacheck stylua];
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "davegallant";
|
||||
repo = "hound.nvim";
|
||||
rev = "e85ba4f65ece79fe6332d8a0ccc594a0d367f4ed";
|
||||
sha256 = "sha256-fxPtixVB6dVjrxpJ1oP+eA00JSiKxWuii8pMxVeuyMY=";
|
||||
};
|
||||
};
|
||||
inherit (pkgs) stdenv;
|
||||
in {
|
||||
home.stateVersion = "23.11";
|
||||
@@ -377,38 +367,173 @@ in {
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
neovim = {
|
||||
nixvim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
# home-manager doesn't yet support `init.lua`
|
||||
extraConfig = "lua require('init')";
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
cmp-nvim-lsp
|
||||
cmp-path
|
||||
cmp-treesitter
|
||||
diffview-nvim
|
||||
git-blame-nvim
|
||||
gitsigns-nvim
|
||||
gruvbox-nvim
|
||||
lualine-nvim
|
||||
luasnip
|
||||
nvim-cmp
|
||||
nvim-lspconfig
|
||||
nvim-tree-lua
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-ts-rainbow
|
||||
nvim-web-devicons
|
||||
plenary-nvim
|
||||
telescope-fzy-native-nvim
|
||||
vim-commentary
|
||||
vim-markdown
|
||||
vim-repeat
|
||||
vim-sneak
|
||||
vim-surround
|
||||
colorschemes.gruvbox.enable = true;
|
||||
keymaps = [
|
||||
{
|
||||
key = "<C-n>";
|
||||
mode = ["n"];
|
||||
action = "<cmd>tabnew<cr>";
|
||||
options = {
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
# copy to OS clipboard
|
||||
{
|
||||
key = "<leader>y";
|
||||
mode = ["v"];
|
||||
action = "\"+y";
|
||||
}
|
||||
{
|
||||
key = "gD";
|
||||
mode = ["n"];
|
||||
action = "<cmd>lua vim.lsp.buf.declaration()<CR>";
|
||||
}
|
||||
{
|
||||
key = "gd";
|
||||
mode = ["n"];
|
||||
action = "<cmd>lua vim.lsp.buf.definition()<CR>";
|
||||
}
|
||||
{
|
||||
key = "gr";
|
||||
mode = ["n"];
|
||||
action = "<cmd>lua vim.lsp.buf.references()<CR>";
|
||||
}
|
||||
];
|
||||
|
||||
plugins = {
|
||||
cmp-path.enable = true;
|
||||
cmp-treesitter.enable = true;
|
||||
commentary.enable = true;
|
||||
diffview.enable = true;
|
||||
gitblame.enable = true;
|
||||
gitsigns.enable = true;
|
||||
lualine.enable = true;
|
||||
lsp.enable = true;
|
||||
lsp.servers = {
|
||||
#ansiblels.enable = true;
|
||||
bashls.enable = true;
|
||||
#dockerls.enable = true;
|
||||
gopls.enable = true;
|
||||
#helm-ls.enable = true;
|
||||
jsonls.enable = true;
|
||||
pyright.enable = true;
|
||||
rnix-lsp.enable = true;
|
||||
terraformls.enable = true;
|
||||
yamlls.enable = true;
|
||||
};
|
||||
nvim-cmp.enable = true;
|
||||
rainbow-delimiters.enable = true;
|
||||
treesitter.enable = true;
|
||||
telescope = {
|
||||
enable = true;
|
||||
defaults = {
|
||||
layout_strategy = "vertical";
|
||||
layout_config = {
|
||||
vertical = {
|
||||
width = 0.9;
|
||||
};
|
||||
};
|
||||
};
|
||||
package = pkgs.vimPlugins.telescope-fzy-native-nvim;
|
||||
keymaps = {
|
||||
"<leader>ff" = {
|
||||
action = "git_files";
|
||||
desc = "Telescope Git Files";
|
||||
};
|
||||
"<leader>fg" = "live_grep";
|
||||
};
|
||||
keymapsSilent = true;
|
||||
};
|
||||
};
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
nvim-lspconfig
|
||||
];
|
||||
options = {
|
||||
autoindent = true;
|
||||
backup = false;
|
||||
belloff = "all";
|
||||
completeopt = [
|
||||
"menuone"
|
||||
"noselect"
|
||||
];
|
||||
cursorline = true;
|
||||
expandtab = true;
|
||||
fillchars = {
|
||||
diff = "∙";
|
||||
eob = " ";
|
||||
vert = "┃";
|
||||
};
|
||||
hlsearch = true;
|
||||
ignorecase = true;
|
||||
incsearch = true;
|
||||
modelines = 5;
|
||||
mouse = "a";
|
||||
number = true;
|
||||
pumblend = 10;
|
||||
scrolloff = 3;
|
||||
shell = "bash";
|
||||
shiftround = false;
|
||||
shiftwidth = 2;
|
||||
showbreak = "↳ ";
|
||||
showcmd = true;
|
||||
sidescroll = 0;
|
||||
sidescrolloff = 3;
|
||||
smartcase = true;
|
||||
smarttab = true;
|
||||
spellcapcheck = "";
|
||||
splitbelow = true;
|
||||
splitright = true;
|
||||
swapfile = false;
|
||||
switchbuf = "usetab";
|
||||
tabstop = 2;
|
||||
termguicolors = true;
|
||||
wildmenu = true;
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
-- Format JSON
|
||||
vim.cmd([[command! JsonFormat execute "::%!jq '.'"]])
|
||||
|
||||
-- Remember line number
|
||||
vim.cmd([[au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]])
|
||||
|
||||
-- Replace visual selection
|
||||
vim.cmd([[vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>]])
|
||||
|
||||
-- Indent YAML
|
||||
vim.cmd([[au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab]])
|
||||
|
||||
-- Indent Python
|
||||
vim.cmd([[au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix]])
|
||||
|
||||
-- Highlight whitespace
|
||||
vim.cmd([[highlight ExtraWhitespace ctermbg=red guibg=red]])
|
||||
vim.cmd([[match ExtraWhitespace /\s\+$/]])
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- completion {{{1 -------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- folding
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
set foldmethod=expr
|
||||
set foldlevel=20
|
||||
set nofoldenable
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
]],
|
||||
true
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
vscode = {
|
||||
@@ -455,7 +580,6 @@ in {
|
||||
};
|
||||
|
||||
home.file = {
|
||||
".config/nvim/lua".source = ./nvim/lua;
|
||||
".aws/config".source = ./.aws/config;
|
||||
};
|
||||
}
|
||||
|
@@ -1,308 +0,0 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-- Options {{{1 ---------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.backup = false
|
||||
vim.opt.belloff = "all"
|
||||
vim.opt.completeopt = "menuone"
|
||||
vim.opt.completeopt = vim.opt.completeopt + "noselect"
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.fillchars = {
|
||||
diff = "∙",
|
||||
eob = " ",
|
||||
vert = "┃",
|
||||
}
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.modelines = 5
|
||||
vim.opt.mouse = "a"
|
||||
vim.opt.number = true
|
||||
vim.opt.pumblend = 10
|
||||
vim.opt.scrolloff = 3
|
||||
vim.opt.shell = "bash"
|
||||
vim.opt.shiftround = false
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.shortmess = vim.opt.shortmess + "A"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "I"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "O"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "T"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "W"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "a"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "c"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "o"
|
||||
vim.opt.shortmess = vim.opt.shortmess + "t"
|
||||
vim.opt.showbreak = "↳ "
|
||||
vim.opt.showcmd = true
|
||||
vim.opt.sidescroll = 0
|
||||
vim.opt.sidescrolloff = 3
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.smarttab = true
|
||||
vim.opt.spellcapcheck = ""
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.switchbuf = "usetab"
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.wildmenu = true
|
||||
|
||||
-- Format JSON
|
||||
vim.cmd([[command! JsonFormat execute "::%!jq '.'"]])
|
||||
|
||||
-- Tab shortcuts
|
||||
vim.api.nvim_set_keymap("n", "<C-n>", "<cmd>tabnew<cr>", { noremap = true })
|
||||
|
||||
-- Copy to OS clipboard
|
||||
vim.api.nvim_set_keymap("v", "<leader>y", '"+y', { noremap = true })
|
||||
|
||||
-- Folding
|
||||
vim.api.nvim_set_keymap("n", "<space>", "za", { silent = true, noremap = true })
|
||||
|
||||
-- Map gx to xdg-open
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"gx",
|
||||
":execute 'silent! !xdg-open ' . shellescape(expand('<cWORD>'), 1)<cr>",
|
||||
{ silent = true, noremap = true }
|
||||
)
|
||||
|
||||
-- Remember line number
|
||||
vim.cmd([[au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]])
|
||||
|
||||
-- Replace visual selection
|
||||
vim.cmd([[vnoremap <C-r> "hy:%s/<C-r>h//g<left><left>]])
|
||||
|
||||
-- Indent YAML
|
||||
vim.cmd([[au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab]])
|
||||
|
||||
-- Indent Python
|
||||
vim.cmd([[au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix]])
|
||||
|
||||
-- Highlight whitespace
|
||||
vim.cmd([[highlight ExtraWhitespace ctermbg=red guibg=red]])
|
||||
vim.cmd([[match ExtraWhitespace /\s\+$/]])
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- LSP {{{1 -------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
|
||||
local opts = { noremap=true, silent=true }
|
||||
vim.api.nvim_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
vim.api.nvim_set_keymap("n", "<space>", "za", { silent = true, noremap = true })
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- packer {{{1 -------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
-- require("packer").startup(function()
|
||||
-- use({ "MunifTanjim/nui.nvim" })
|
||||
-- use({ "dpayne/CodeGPT.nvim" })
|
||||
-- end)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- completion {{{1 -------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup {
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' },
|
||||
{ name = 'treesitter' },
|
||||
},
|
||||
preselect = cmp.PreselectMode.None,
|
||||
mapping = {
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}
|
||||
}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- lsp {{{1 -------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
lspconfig.ansiblels.setup({
|
||||
capabilities = capabilities,
|
||||
cmd = {os.getenv("HOME") .. "/.npm-packages/bin/ansible-language-server", "--stdio"};
|
||||
})
|
||||
|
||||
lspconfig.bashls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- lspconfig.lua_ls.setup({
|
||||
-- capabilities = capabilities,
|
||||
-- settings = {
|
||||
-- Lua = {
|
||||
-- diagnostics = {
|
||||
-- globals = { 'vim' }
|
||||
-- }
|
||||
-- }
|
||||
-- }
|
||||
-- })
|
||||
|
||||
lspconfig.pyright.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.rls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.rnix.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.solargraph.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.terraformls.setup({
|
||||
filetypes={"terraform","tf","hcl"},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.tflint.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lspconfig.yamlls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
require'luasnip'.filetype_extend("go", {"go"})
|
||||
require'luasnip'.filetype_extend("ruby", {"rails"})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Plugins {{{1 ---------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-- status line
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "gruvbox",
|
||||
},
|
||||
})
|
||||
|
||||
-- nvim-telescope
|
||||
require('telescope').setup({
|
||||
defaults = {
|
||||
layout_strategy='vertical',
|
||||
layout_config = {
|
||||
vertical = { width = 0.9 }
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- nvim-tree
|
||||
require'nvim-tree'.setup {}
|
||||
|
||||
-- gitsigns
|
||||
require('gitsigns').setup()
|
||||
|
||||
-- treesitter
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {},
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
rainbow = {
|
||||
enable = true,
|
||||
extended_mode = true,
|
||||
},
|
||||
})
|
||||
|
||||
-- folding
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
set foldmethod=expr
|
||||
set foldlevel=20
|
||||
set nofoldenable
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
]],
|
||||
true
|
||||
)
|
||||
|
||||
-- vim-markdown
|
||||
vim.g.vim_markdown_override_foldtext = 0
|
||||
vim.g.vim_markdown_no_default_key_mappings = 1
|
||||
vim.g.vim_markdown_emphasis_multiline = 0
|
||||
vim.g.vim_markdown_conceal = 0
|
||||
vim.g.vim_markdown_frontmatter = 1
|
||||
vim.g.vim_markdown_new_list_item_indent = 0
|
||||
|
||||
-- vim-prettier
|
||||
vim.g["prettier#autoformat"] = 1
|
||||
|
||||
-- git-blame
|
||||
vim.g.gitblame_enabled = 1
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<leader>ff", "<cmd>Telescope find_files find_command=rg,--ignore,--hidden,--files,-g,!.git prompt_prefix=🔍<cr>", { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>fg", "<cmd>Telescope live_grep<cr>", { silent = true, noremap = true })
|
||||
|
||||
-- NvimTree
|
||||
vim.api.nvim_set_keymap("n", "<leader>n", "<cmd>NvimTreeToggle<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>r", "<cmd>NvimTreeRefresh<cr>", { noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>nf", "<cmd>NvimTreeFindFile<cr>", { noremap = true })
|
||||
|
||||
--Set colorscheme
|
||||
vim.o.termguicolors = true
|
||||
vim.cmd([[colorscheme gruvbox]])
|
@@ -56,7 +56,7 @@ in {
|
||||
|
||||
# cloud
|
||||
unstable.google-cloud-sdk
|
||||
unstable.flyctl
|
||||
unstable.awscli2
|
||||
|
||||
# language servers
|
||||
nodePackages.bash-language-server
|
||||
|
21
outputs.nix
21
outputs.nix
@@ -39,12 +39,11 @@
|
||||
];
|
||||
};
|
||||
registry = {nixpkgs.flake = nixpkgs;};
|
||||
};
|
||||
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 30d";
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "daily";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
@@ -54,7 +53,10 @@
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.dave.imports = [./home/default.nix];
|
||||
users.dave.imports = [
|
||||
./home/default.nix
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
inherit unstable;
|
||||
};
|
||||
@@ -107,7 +109,10 @@
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users."dave.gallant".imports = [./home/default.nix];
|
||||
users."dave.gallant".imports = [
|
||||
./home/default.nix
|
||||
inputs.nixvim.homeManagerModules.nixvim
|
||||
];
|
||||
extraSpecialArgs = {
|
||||
inherit unstable;
|
||||
};
|
||||
|
Reference in New Issue
Block a user