mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 10:20:14 +00:00
create more optional neovim settings
This commit is contained in:
14
modules/common/neovim/config/github.lua
Normal file
14
modules/common/neovim/config/github.lua
Normal file
@ -0,0 +1,14 @@
|
||||
-- Keymap to open file in GitHub web
|
||||
vim.keymap.set("n", "<Leader>gr", ":!gh browse %<CR><CR>", { silent = true })
|
||||
|
||||
-- Pop a terminal to watch the current run
|
||||
local gitwatch =
|
||||
require("toggleterm.terminal").Terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
|
||||
|
||||
-- Set a toggle for this terminal
|
||||
function GITWATCH_TOGGLE()
|
||||
gitwatch:toggle()
|
||||
end
|
||||
|
||||
-- Keymap to toggle the run
|
||||
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
|
6
modules/common/neovim/config/kubernetes.lua
Normal file
6
modules/common/neovim/config/kubernetes.lua
Normal file
@ -0,0 +1,6 @@
|
||||
local k9s = require("toggleterm.terminal").Terminal:new({ cmd = "k9s" })
|
||||
function K9S_TOGGLE()
|
||||
k9s:toggle()
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
|
@ -1,13 +1,16 @@
|
||||
{ pkgs, lib, config, dsl, ... }: {
|
||||
|
||||
# Terraform optional because non-free
|
||||
options.useTerraform = lib.mkEnableOption "Whether to enable Terraform LSP";
|
||||
options.terraform = lib.mkEnableOption "Whether to enable Terraform LSP";
|
||||
options.github = lib.mkEnableOption "Whether to enable GitHub features";
|
||||
options.kubernetes =
|
||||
lib.mkEnableOption "Whether to enable Kubernetes features";
|
||||
|
||||
config =
|
||||
|
||||
let
|
||||
|
||||
terraformFormat = if config.useTerraform then ''
|
||||
terraformFormat = if config.terraform then ''
|
||||
require("null-ls").builtins.formatting.terraform_fmt.with({
|
||||
command = "${pkgs.terraform}/bin/terraform",
|
||||
extra_filetypes = { "hcl" },
|
||||
@ -40,7 +43,11 @@
|
||||
};
|
||||
|
||||
use.lspconfig.terraformls.setup = dsl.callWith {
|
||||
cmd = [ "${pkgs.terraform-ls}/bin/terraform-ls" "serve" ];
|
||||
cmd = if config.terraform then [
|
||||
"${pkgs.terraform-ls}/bin/terraform-ls"
|
||||
"serve"
|
||||
] else
|
||||
[ "echo" ];
|
||||
};
|
||||
|
||||
use.lspconfig.rust_analyzer.setup = dsl.callWith {
|
||||
|
@ -26,17 +26,5 @@ function NIXPKGS_TOGGLE()
|
||||
nixpkgs:toggle()
|
||||
end
|
||||
|
||||
local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
|
||||
function GITWATCH_TOGGLE()
|
||||
gitwatch:toggle()
|
||||
end
|
||||
|
||||
local k9s = terminal:new({ cmd = "k9s" })
|
||||
function K9S_TOGGLE()
|
||||
k9s:toggle()
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
|
||||
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ pkgs, dsl, ... }: {
|
||||
{ pkgs, dsl, config, ... }: {
|
||||
|
||||
# Toggleterm provides a floating terminal inside the editor for quick access
|
||||
|
||||
@ -10,6 +10,10 @@
|
||||
direction = "float";
|
||||
};
|
||||
|
||||
lua = builtins.readFile ./toggleterm.lua;
|
||||
lua = ''
|
||||
${builtins.readFile ./toggleterm.lua}
|
||||
${if config.github then (builtins.readFile ./github.lua) else ""}
|
||||
${if config.kubernetes then (builtins.readFile ./kubernetes.lua) else ""}
|
||||
'';
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user