automate/conf-print_nvim-lazy-snippe...

188 lines
5.5 KiB
Bash

#!/usr/bin/env bash
# a collection of addition plugins for neovim with lazy
DEST=${1:-/etc/skel}
LAZY_DEST=${DEST}/.config/nvim/lua/plugins
conf-print() {
cat <<-EOF
EOF
}
# conf_print > ${DEST}
# nvim-dap Debug Adapter Protocol client
# https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
# nvim-dap-python An extension for nvim-dap for python debug, test methods or classes.
conf_print_nvim-dap() {
cat <<-EOF
return {
{
"mfussenegger/nvim-dap",
optional = true,
dependencies = {
"mfussenegger/nvim-dap-python",
keys = {
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method", ft = "python" },
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class", ft = "python" },
},
config = function()
local path = require("mason-registry").get_package("debugpy"):get_install_path()
require("dap-python").setup(path .. "/venv/bin/python")
end,
},
}
}
EOF
}
conf_print_nvim-dap >"${LAZY_DEST}/nvim-dap.lua"
# https://github.com/folke/lazy.nvim
conf-print-nvim-lazygit() {
cat <<-EOF
require("lazy").setup({
{
"kdheepak/lazygit.nvim",
cmd = {
"LazyGit",
"LazyGitConfig",
"LazyGitCurrentFile",
"LazyGitFilter",
"LazyGitFilterCurrentFile",
},
-- optional for floating window border decoration
dependencies = {
"nvim-lua/plenary.nvim",
},
-- setting the keybinding for LazyGit with 'keys' is recommended in
-- order to load the plugin when the command is run for the first time
keys = {
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" }
}
},
})
EOF
conf_print_nvim-lazygit >"${LAZY_DEST}/nvim-lazygit.lua"
# FIXME: Not sure where we put these settingsm assuming nvim.conf
conf_print_nvim-lazygit_map() {
cat <<-EOF
let g:lazygit_floating_window_winblend = 0 " transparency of floating window
let g:lazygit_floating_window_scaling_factor = 0.9 " scaling factor for floating window
let g:lazygit_floating_window_border_chars = ['╭','─', '╮', '│', '╯','─', '╰', '│'] " customize lazygit popup window border characters
let g:lazygit_floating_window_use_plenary = 0 " use plenary.nvim to manage floating window if available
let g:lazygit_use_neovim_remote = 1 " fallback to 0 if neovim-remote is not installed
let g:lazygit_use_custom_config_file_path = 0 " config file path is evaluated if this value is 1
let g:lazygit_config_file_path = '' " custom config file path
" OR
let g:lazygit_config_file_path = [] " list of custom config file paths
" setup mapping to call :LazyGit
nnoremap <silent> <leader>gg :LazyGit<CR>
EOF
}
# conf_print_nvim-lazygit_map > "${LAZY_DEST}"/
# https://sw.kovidgoyal.net/kitty/overview/
# https://github.com/mikesmithgh/kitty-scrollback.nvim/wiki/kitty_scrollback_nvim
# https://github.com/mikesmithgh/kitty-scrollback.nvim?tab=readme-ov-file#-installation
conf_print_nvim-kitty-scrollback() {
cat <<-EOF
{
'mikesmithgh/kitty-scrollback.nvim',
enabled = true,
lazy = true,
cmd = { 'KittyScrollbackGenerateKittens', 'KittyScrollbackCheckHealth' },
event = { 'User KittyScrollbackLaunch' },
-- version = '*', -- latest stable version, may have breaking changes if major version changed
-- version = '^4.0.0', -- pin major version, include fixes and features that do not have breaking changes
config = function()
require('kitty-scrollback').setup()
end,
}
EOF
}
conf_print_nvim-kitty-scrollback >"${LAZY_DEST}/nvim-kitty-scrollback.lua"
# https://github.com/rcarriga/nvim-dap-ui
conf_print_nvim-dap-ui() {
cat <<-EOF
{
"rcarriga/nvim-dap-ui",
dependencies = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"}
}
EOF
}
# the command 'Codeium Chat' will start a chat session with the default browser
# the indexing seems not to work but it is new 02-04-2024
conf_print_nvim-codeium_enable-chat() {
cat <<-EOF
-- ~/.config/nvim/lua/plugins/nvim-codeium_enable-chat.lua
-- Assuming you want to configure the codeium plugin
return {
"Exafunction/codeium.nvim",
config = function()
-- Require the codeium module
local codeium = require("codeium.config")
-- Modify the options to enable chat, local search, and index service
codeium.options = {
enable_chat = true,
enable_local_search = true,
enable_index_service = true,
}
-- Call the setup function with the modified options
codeium.setup(codeium.options)
end,
}
EOF
}
conf_print_nvim-codeium_enable-chat >"${LAZY_DEST}/nvim-codeium_enable-chat.lua"
# the key for codeium sometimes gets wiped, put it back
CODEIUM_KEY_HOME=/home/default/.cache/nvim/codeium/config.json
conf_print_nvim-codeium-key() {
cat <<-EOF
{"api_key": "c8cbca7c-fabb-42bb-95e2-1c86fe71bd45"}
EOF
}
conf_print_nvim-codeium-key >"${CODEIUM_KEY_HOME}"
# an example of allowing fix on save
conf_print_nvim-lint-markdownlint() {
cat <<-EOF
return {
{
"mfussenegger/nvim-lint",
opts = {
linters = {
markdownlint = {
args = { "--fix" },
},
},
},
},
}
EOF
}
# conf_print_nvim-lint-markdownlint >"${LAZY_DEST}"/nvim-lint-markdownlint.lua