Initial Commit

This commit is contained in:
2024-10-02 00:54:05 -05:00
commit 46ebfc5cb6
45 changed files with 4120 additions and 0 deletions

271
programs/neovim/flake.nix Normal file
View File

@@ -0,0 +1,271 @@
{
description = "neovim config";
inputs = {
};
outputs = { self, ... }@inputs: {
module = {}: {};
hmModule = { config, lib, pkgs, ... }: {
imports = [];
home.packages = with pkgs; [
neovim-remote
];
home.sessionVariables.SUDO_EDITOR = "kitten edit-in-kitty";
programs.neovim = with pkgs; {
enable = true;
#package = neovim;
defaultEditor = true;
extraLuaConfig = ''
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.opt.nu = true
vim.opt.rnu = true
vim.opt.scrolloff = 12
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})
-- vim.opt.termguicolors = true
require("nvim-tree").setup()
local lsp_zero = require('lsp-zero')
-- lsp_attach is where you enable features that only work
-- if there is a language server active in the file
local lsp_attach = function(client, bufnr)
local opts = {buffer = bufnr}
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
end
lsp_zero.extend_lspconfig({
sign_text = true,
lsp_attach = lsp_attach,
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})
local lspconfig = require("lspconfig")
lspconfig.ccls.setup{}
lspconfig.nil_ls.setup{}
lspconfig.statix.setup{}
lspconfig.pyright.setup{}
lspconfig.gopls.setup{}
-- local llm = require('llm')
-- llm.setup({
-- api_token = nil, -- cf Install paragraph
-- model = "codellama:7b", -- the model ID, behavior depends on backend
-- backend = "ollama", -- backend ID, "huggingface" | "ollama" | "openai" | "tgi"
-- url = "http://localhost:11434", -- the http url of the backend
-- tokens_to_clear = { "<|endoftext|>" }, -- tokens to remove from the model's output
-- parameters that are added to the request body, values are arbitrary, you can set any field:value pair here it will be passed as is to the backend
-- request_body = {
-- parameters = {
-- temperature = 0.2,
-- top_p = 0.95,
-- },
-- },
-- set this if the model supports fill in the middle
-- fim = {
-- enabled = true,
-- prefix = "<fim_prefix>",
-- middle = "<fim_middle>",
-- suffix = "<fim_suffix>",
-- },
-- debounce_ms = 150,
-- accept_keymap = "<Tab>",
-- dismiss_keymap = "<S-Tab>",
-- tls_skip_verify_insecure = false,
-- llm-ls configuration, cf llm-ls section
-- lsp = {
-- bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "${pkgs.llm-ls}/bin/llm-ls",
-- host = nil,
-- port = nil,
-- cmd_env = nil, -- or { LLM_LOG_LEVEL = "DEBUG" } to set the log level of llm-ls
-- version = "0.5.3",
-- },
-- tokenizer = nil, -- cf Tokenizer paragraph
-- context_window = 1024, -- max number of tokens for the context window
-- enable_suggestions_on_startup = true,
-- enable_suggestions_on_files = "*", -- pattern matching syntax to enable suggestions on specific files, either a string or a list of strings
-- disable_url_path_completion = false, -- cf Backend
-- })
local luasnip = require("luasnip")
-- nvim-cmp setup
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
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' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
})
require("noice").setup()
require("barbar").setup()
require("pywal").setup()
require("lualine").setup({
options = {
theme = 'pywal-nvim',
},
})
vim.cmd[[colorscheme pywal]]
vim.notify = require("notify")
vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<CR>", {desc = "find files"})
vim.keymap.set("n", "<leader>fa", "<cmd>Telescope find_files no_ignore=true hidden=true<CR>", {desc = "find files"})
vim.keymap.set("n", "<leader>fc", "<cmd>Telescope treesitter<CR>", {desc = "find code"})
vim.keymap.set("n", "<leader>t", "<cmd>NvimTreeToggle<CR>", {desc = "toggle tree"})
vim.keymap.set("n", "<C-.>", "<cmd>BufferNext<CR>", {desc = "move to next tab"})
vim.keymap.set("n", "<C-,>", "<cmd>BufferPrevious<CR>", {desc = "move to previous tab"})
vim.keymap.set("n", "<C-h>", "<cmd>wincmd h<CR>", {desc = "move to left window"})
vim.keymap.set("n", "<C-j>", "<cmd>wincmd j<CR>", {desc = "move to below window"})
vim.keymap.set("n", "<C-k>", "<cmd>wincmd k<CR>", {desc = "move to above window"})
vim.keymap.set("n", "<C-l>", "<cmd>wincmd l<CR>", {desc = "move to right window"})
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", {desc = "move selected down"})
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", {desc = "move selected up"})
vim.keymap.set("n", "J", "mzJ`z", {desc = "cursor still when appending next line"})
vim.keymap.set("n", "<C-d>", "<C-d>zz", {desc = "cursor mid when page down"})
vim.keymap.set("n", "<C-u>", "<C-u>zz", {desc = "cursor mid when page up"})
vim.keymap.set("n", "n", "nzzzv", {desc = "search term mid"})
vim.keymap.set("n", "N", "Nzzzv", {desc = "search term mid"})
vim.keymap.set("x", "<leader>p", "\"_dP", {desc = "no overwrite paste buffer"})
vim.keymap.set("n", "<leader>y", "\"+y", {desc = "yank to system clipboard"})
vim.keymap.set("v", "<leader>y", "\"+y", {desc = "^"})
vim.keymap.set("n", "<leader>Y", "\"+Y", {desc = "^"})
vim.keymap.set("n", "Q", "<nop>", {desc = "unmap Q"})
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], {desc = "replace current word entire file"})
vim.keymap.set("n", "<leader>F", function() vim.lsp.buf.format() end, {desc = "format buffer?"})
'';
plugins = with vimPlugins; [
telescope-nvim
nvim-tree-lua
nvim-web-devicons
mini-nvim
noice-nvim
nvim-notify
barbar-nvim
pywal-nvim
lualine-nvim
tokyonight-nvim
llm-nvim
cmp-buffer
cmp-nvim-lsp
cmp_luasnip
luasnip
cmp-path
cmp-cmdline
nvim-cmp
nvim-lspconfig
lsp-zero-nvim
nvim-treesitter
nvim-treesitter-parsers.cpp
nvim-treesitter-parsers.nix
nvim-treesitter-parsers.bash
nvim-treesitter-parsers.python
nvim-treesitter-parsers.lua
nvim-treesitter-parsers.vim
nvim-treesitter-parsers.javascript
nvim-treesitter-parsers.css
nvim-treesitter-parsers.hyprlang
];
extraPackages = with pkgs; [
nil
statix # Lints and suggestions for the nix programming language
pyright
gopls
ccls
];
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
};
};
};
}