Skip to content

Commit

Permalink
Update plugins version (#9)
Browse files Browse the repository at this point in the history
* feat(flake): added copilot chat derivation

* feat(languages): added postgres lsp support

* feat(plugins): update copilot chat version

* feat(lib): update binaries to include secrets

* refactor: update key mappings and package references

* feat: Replace nerdcommenter with comment-nvim

This commit replaces the nerdcommenter plugin with comment-nvim for
better commenting functionality. It also adds a new keymap for
committing staged changes using CopilotChat. Minor adjustments are
made to the setup of notify and noice plugins.
  • Loading branch information
erikreinert authored Mar 19, 2024
1 parent a4b213f commit c702814
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 68 deletions.
24 changes: 21 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
description = "Neovim configuration for TheAltF4Stream as a plugin";

inputs.copilotchat.flake = false;
inputs.copilotchat.url = "github:CopilotC-Nvim/CopilotChat.nvim?ref=canary";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs = inputs @ {
Expand All @@ -24,15 +26,22 @@
system,
...
}: let
inherit (pkgs) just mkShell;
inherit (pkgs) alejandra just mkShell;
in {
apps = {
nvim = {
program = "${config.packages.neovim}/bin/nvim";
type = "app";
};
};

devShells = {
default = mkShell {
buildInputs = [just];
};
};

formatter = pkgs.alejandra;
formatter = alejandra;

packages = {
default = self.lib.mkVimPlugin {inherit system;};
Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ cache-shell cache_name="altf4llc-os":

check:
nix flake check

update:
nix flake update
33 changes: 21 additions & 12 deletions lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{inputs}: let
inherit (inputs.nixpkgs) legacyPackages;
in rec {
mkCopilotChat = {system}: let
inherit (pkgs) vimUtils;
inherit (vimUtils) buildVimPlugin;
pkgs = legacyPackages.${system};
in
buildVimPlugin {
name = "CopilotChat";
src = inputs.copilotchat;
};

mkVimPlugin = {system}: let
inherit (pkgs) vimUtils;
inherit (vimUtils) buildVimPlugin;
Expand All @@ -23,8 +33,9 @@ in rec {

mkNeovimPlugins = {system}: let
inherit (pkgs) vimPlugins;
CopilotChat-nvim = mkCopilotChat {inherit system;};
pkgs = legacyPackages.${system};
thealtf4stream-nvim = mkVimPlugin {inherit system;};
TheAltF4Stream-nvim = mkVimPlugin {inherit system;};
in [
# languages
vimPlugins.nvim-lspconfig
Expand All @@ -43,11 +54,13 @@ in rec {
vimPlugins.vim-floaterm

# extras
CopilotChat-nvim
vimPlugins.ChatGPT-nvim
vimPlugins.comment-nvim
vimPlugins.copilot-lua
vimPlugins.gitsigns-nvim
vimPlugins.lualine-nvim
vimPlugins.nerdcommenter
vimPlugins.noice-nvim
vimPlugins.nui-nvim
vimPlugins.nvim-colorizer-lua
vimPlugins.nvim-notify
Expand All @@ -58,12 +71,11 @@ in rec {
vimPlugins.trouble-nvim

# configuration
thealtf4stream-nvim
TheAltF4Stream-nvim
];

mkExtraPackages = {system}: let
inherit (pkgs) nodePackages ocamlPackages python311Packages;

inherit (pkgs) nodePackages ocamlPackages python3Packages;
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
Expand All @@ -88,6 +100,7 @@ in rec {
pkgs.lua-language-server
pkgs.nil
pkgs.omnisharp-roslyn
pkgs.postgres-lsp
pkgs.rust-analyzer
pkgs.terraform-ls

Expand All @@ -97,14 +110,10 @@ in rec {
pkgs.golines
pkgs.rustfmt
pkgs.terraform
python311Packages.black
python3Packages.black

# support
python311Packages.prompt-toolkit
python311Packages.pynvim
python311Packages.python-dotenv
python311Packages.requests
python311Packages.tiktoken
# secrets
pkgs.doppler
];

mkExtraConfig = ''
Expand Down
20 changes: 9 additions & 11 deletions lua/TheAltF4Stream/chatgpt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ local function init()

chatgpt.setup({
api_key_cmd = api_key_cmd,
openai_params = { max_tokens = 128000, model = "gpt-4-turbo-preview" },
openai_params = { model = "gpt-4-turbo-preview" },
openai_edit_params = { model = "gpt-4" }
})

local map = vim.api.nvim_set_keymap
local options = { noremap = true, silent = true }

local options = { noremap = true }

map('n', '<leader>ga', '<CMD>ChatGPTActAs<CR>', options)
map('n', '<leader>gg', '<CMD>ChatGPT<CR>', options)
map('v', '<leader>ge', '<CMD>ChatGPTEditWithInstructions<CR>', options)
map('v', '<leader>gb', '<CMD>ChatGPTRun fix_bugs<CR>', options)
map('v', '<leader>go', '<CMD>ChatGPTRun optimize_code<CR>', options)
map('v', '<leader>gs', '<CMD>ChatGPTRun summarize<CR>', options)
map('v', '<leader>gt', '<CMD>ChatGPTRun add_tests<CR>', options)
vim.keymap.set('n', '<leader>ga', '<CMD>ChatGPTActAs<CR>', options)
vim.keymap.set('n', '<leader>gg', '<CMD>ChatGPT<CR>', options)
vim.keymap.set('v', '<leader>ge', '<CMD>ChatGPTEditWithInstruction<CR>', options)
vim.keymap.set('v', '<leader>gb', '<CMD>ChatGPTRun fix_bugs<CR>', options)
vim.keymap.set('v', '<leader>go', '<CMD>ChatGPTRun optimize_code<CR>', options)
vim.keymap.set('v', '<leader>gs', '<CMD>ChatGPTRun summarize<CR>', options)
vim.keymap.set('v', '<leader>gt', '<CMD>ChatGPTRun add_tests<CR>', options)
end

return {
Expand Down
25 changes: 18 additions & 7 deletions lua/TheAltF4Stream/copilot.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
local copilot_chat = require("CopilotChat")
local copilotchat = require("CopilotChat")
local copilotchat_select = require("CopilotChat.select")

local function init()
copilot_chat.setup()
local function CopilotChatWithInput()
local input = vim.fn.input("Prompt: ")
if input ~= "" then
copilotchat.ask(input, { selection = copilotchat_select.visual })
end
end

local map = vim.api.nvim_set_keymap
local function init()
copilotchat.setup { debug = false }

local options = { noremap = true }
local options = { noremap = true, silent = true }

map('n', '<leader>co', ':lua require("CopilotChat.code_actions").show_help_actions()', options)
map('n', '<leader>cp', ':lua require("CopilotChat.code_actions").show_prompt_actions(true)', options)
vim.keymap.set('n', '<leader>cm', "<CMD>CopilotChatCommitStaged<CR>", options)
vim.keymap.set('v', '<leader>ce', "<CMD>CopilotChatExplain<CR>", options)
vim.keymap.set('n', '<leader>cf', "<CMD>CopilotChatFixDiagnostic<CR>", options)
vim.keymap.set('v', '<leader>cd', "<CMD>CopilotChatDocs<CR>", options)
vim.keymap.set('v', '<leader>co', "<CMD>CopilotChatOptimize<CR>", options)
vim.keymap.set('v', '<leader>cp', CopilotChatWithInput, options)
vim.keymap.set('v', '<leader>ct', "<CMD>CopilotChatTests<CR>", options)
end

return {
Expand Down
16 changes: 7 additions & 9 deletions lua/TheAltF4Stream/floaterm.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
local function init()
local map = vim.api.nvim_set_keymap
local options = { noremap = true, silent = true }

local options = { noremap = true }

map('n', '<leader>bb', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 btm<CR>', options)
map('n', '<leader>k9', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 k9s<CR>', options)
map('n', '<leader>ld', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazydocker<CR>', options)
map('n', '<leader>lg', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazygit<CR>', options)
map('n', '<leader>nn', '<CMD>FloatermNew --autoclose=2 --height=0.75 --width=0.75 nnn -Hde<CR>', options)
map('n', '<leader>tt', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 zsh<CR>', options)
vim.keymap.set('n', '<leader>bb', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 btm<CR>', options)
vim.keymap.set('n', '<leader>k9', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 k9s<CR>', options)
vim.keymap.set('n', '<leader>ld', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazydocker<CR>', options)
vim.keymap.set('n', '<leader>lg', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 lazygit<CR>', options)
vim.keymap.set('n', '<leader>nn', '<CMD>FloatermNew --autoclose=2 --height=0.75 --width=0.75 nnn -Hde<CR>', options)
vim.keymap.set('n', '<leader>tt', '<CMD>FloatermNew --autoclose=2 --height=0.9 --width=0.9 zsh<CR>', options)
end

return {
Expand Down
6 changes: 6 additions & 0 deletions lua/TheAltF4Stream/languages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ local function init()
["textDocument/definition"] = omnisharp_extended.handler,
},
},
postgres_lsp = {},
pyright = {
settings = {
python = {
Expand Down Expand Up @@ -192,9 +193,14 @@ local function init()
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)

treesitter.setup {
auto_install = false,
ensure_installed = {},
highlight = { enable = true },
ignore_install = {},
indent = { enable = true },
modules = {},
rainbow = { enable = true },
sync_install = false,
}

treesitter_context.setup()
Expand Down
28 changes: 13 additions & 15 deletions lua/TheAltF4Stream/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,25 @@ local function init()

telescope.load_extension('notify')

local map = vim.api.nvim_set_keymap

local options = { noremap = true }
local options = { noremap = true, silent = true }

-- Builtin
map('n', '<leader>fg', '<CMD>lua require("telescope.builtin").git_files{}<CR>', options)
map('n', '<leader>ff', '<CMD>lua require("telescope.builtin").find_files{ hidden = true }<CR>', options)
map('n', '<leader>fl', '<CMD>lua require("telescope.builtin").live_grep()<CR>', options)
map('n', '<leader>fb', '<CMD>lua require("telescope.builtin").buffers()<CR>', options)
map('n', '<leader>fh', '<CMD>lua require("telescope.builtin").help_tags()<CR>', options)
map('n', '<leader>fd', '<CMD>lua require("telescope.builtin").diagnostics()<CR>', options)
map('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)
vim.keymap.set('n', '<leader>fg', '<CMD>lua require("telescope.builtin").git_files{}<CR>', options)
vim.keymap.set('n', '<leader>ff', '<CMD>lua require("telescope.builtin").find_files{ hidden = true }<CR>', options)
vim.keymap.set('n', '<leader>fl', '<CMD>lua require("telescope.builtin").live_grep()<CR>', options)
vim.keymap.set('n', '<leader>fb', '<CMD>lua require("telescope.builtin").buffers()<CR>', options)
vim.keymap.set('n', '<leader>fh', '<CMD>lua require("telescope.builtin").help_tags()<CR>', options)
vim.keymap.set('n', '<leader>fd', '<CMD>lua require("telescope.builtin").diagnostics()<CR>', options)
vim.keymap.set('n', '<leader>fr', '<CMD>lua require("telescope.builtin").registers()<CR>', options)

-- Language Servers
map('n', '<leader>lsd', '<CMD>lua require("telescope.builtin").lsp_definitions{}<CR>', options)
map('n', '<leader>lsi', '<CMD>lua require("telescope.builtin").lsp_implementations{}<CR>', options)
map('n', '<leader>lsl', '<CMD>lua require("telescope.builtin").lsp_code_actions{}<CR>', options)
map('n', '<leader>lst', '<CMD>lua require("telescope.builtin").lsp_type_definitions{}<CR>', options)
vim.keymap.set('n', '<leader>lsd', '<CMD>lua require("telescope.builtin").lsp_definitions{}<CR>', options)
vim.keymap.set('n', '<leader>lsi', '<CMD>lua require("telescope.builtin").lsp_implementations{}<CR>', options)
vim.keymap.set('n', '<leader>lsl', '<CMD>lua require("telescope.builtin").lsp_code_actions{}<CR>', options)
vim.keymap.set('n', '<leader>lst', '<CMD>lua require("telescope.builtin").lsp_type_definitions{}<CR>', options)

-- Extensions
map('n', '<leader>fn', '<CMD>lua require("telescope").extensions.notify.notify()<CR>', options)
vim.keymap.set('n', '<leader>fn', '<CMD>lua require("telescope").extensions.notify.notify()<CR>', options)
end

return {
Expand Down
30 changes: 27 additions & 3 deletions lua/TheAltF4Stream/theme.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
local colorizer = require 'colorizer'
local gitsigns = require 'gitsigns'
local lualine = require 'lualine'
local noice = require 'noice'
local notify = require 'notify'
local oxocarbon = require('oxocarbon').oxocarbon
local comment = require 'Comment'

local function init()
colorizer.setup {}

comment.setup {}

gitsigns.setup {}

lualine.setup {
options = {
component_separators = { left = '', right = '' },
extensions = { "fzf", "quickfix" },
icons_enabled = false,
section_separators = { left = '', right = '' },
},
}

notify.setup {
background_colour = "#000000",
render = "wrapped-compact",
timeout = 2500,
}

noice.setup {
lsp = {
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
},
},
presets = {
bottom_search = true,
command_palette = true,
inc_rename = false,
long_message_to_split = true,
lsp_doc_border = false,
},
}

Expand Down
11 changes: 5 additions & 6 deletions lua/TheAltF4Stream/vim.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ local function set_vim_opt()
end

local function set_vim_keymaps()
local map = vim.api.nvim_set_keymap
local options = { noremap = false }
local options = { noremap = false, silent = true }

map('n', '<leader>h', '<CMD>wincmd h<CR>', options)
map('n', '<leader>j', '<CMD>wincmd j<CR>', options)
map('n', '<leader>k', '<CMD>wincmd k<CR>', options)
map('n', '<leader>l', '<CMD>wincmd l<CR>', options)
vim.keymap.set('n', '<leader>h', '<CMD>wincmd h<CR>', options)
vim.keymap.set('n', '<leader>j', '<CMD>wincmd j<CR>', options)
vim.keymap.set('n', '<leader>k', '<CMD>wincmd k<CR>', options)
vim.keymap.set('n', '<leader>l', '<CMD>wincmd l<CR>', options)
end

local function init()
Expand Down

0 comments on commit c702814

Please sign in to comment.