Skip to content

Commit

Permalink
fix: swap to astronvim work around eval issue
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Rabbito <[email protected]>
  • Loading branch information
anthr76 committed Apr 5, 2024
1 parent b27a27a commit 94d0796
Show file tree
Hide file tree
Showing 13 changed files with 536 additions and 84 deletions.
159 changes: 78 additions & 81 deletions home-manager/personalities/cli/editor/nvim/default.nix
Original file line number Diff line number Diff line change
@@ -1,87 +1,84 @@
{ pkgs, ... }: {
home.sessionVariables = { EDITOR = "lvim"; };
home.packages = [ pkgs.unstable.lunarvim ];
home.shellAliases = {
"nvim" = "lvim";
"vim" = "lvim";
"vi" = "lvim";
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
};
xdg.configFile = {
init = {
recursive = false;
target = "lvim/config.lua";
text = # lua
''
vim.cmd([[
autocmd BufRead,BufNewFile */templates/*.y*ml,*/templates/*.tpl,*.gotmpl,helmfile*.yml set ft=helm
autocmd BufRead,BufNewFile */templates/*.y*ml,*/templates/*.tpl,*.gotmpl,helmfile*.yml LspStop yammls
]])
local configs = require('lspconfig.configs')
local lspconfig = require('lspconfig')
local util = require('lspconfig.util')
require "nvim-treesitter.install".compilers = { "gcc" }
if not configs.helm_ls then
configs.helm_ls = {
default_config = {
cmd = {"helm_ls", "serve"},
filetypes = {'helm'},
root_dir = function(fname)
return util.root_pattern('Chart.yaml')(fname)
end,
},
}
end
lspconfig.helm_ls.setup {
filetypes = {"helm"},
cmd = {"helm_ls", "serve"},
}
-- Disable YAMLLS for Helm chart files
vim.cmd([[
autocmd FileType yaml if getline(1) =~# '^#.*helm' | LspStop | endif
]])
lvim.plugins = {
{
"towolf/vim-helm",
event = "VeryLazy",
},
{
"folke/todo-comments.nvim",
event = "BufReadPost",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
},
{
"andweeb/presence.nvim",
event = "VeryLazy",
opts = {
}
},
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({})
end
},
{
"zbirenbaum/copilot-cmp",
event = "InsertEnter",
dependencies = { "zbirenbaum/copilot.lua" },
config = function()
vim.defer_fn(function()
require("copilot").setup() -- https://github.com/zbirenbaum/copilot.lua/blob/master/README.md#setup-and-configuration
require("copilot_cmp").setup() -- https://github.com/zbirenbaum/copilot-cmp/blob/master/README.md#configuration
end, 100)
end
},
xdg.configFile."nvim/.neoconf.json".text = /* json */ ''
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
'';
}
},
"lspconfig": {
"lua_ls": {
"Lua.format.enable": false
}
}
}
'';
xdg.configFile."nvim/.stylua.toml".text = /* toml */ ''
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"
collapse_simple_statement = "Always"
'';
xdg.configFile."nvim/init.lua".text = /* lua */ ''
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(lazypath)
-- validate that lazy is available
if not pcall(require, "lazy") then
-- stylua: ignore
vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
vim.fn.getchar()
vim.cmd.quit()
end
require "lazy_setup"
require "polish"
'';
xdg.configFile."nvim/.neovim.yml".text = /* yaml */ ''
---
base: lua51
globals:
vim:
any: true
'';
xdg.configFile."nvim/.selene.toml".text = /* toml */ ''
std = "neovim"
[rules]
global_usage = "allow"
if_same_then_else = "allow"
incorrect_standard_library_use = "allow"
mixed_table = "allow"
multiple_statements = "allow"
'';
xdg.configFile = {
userConfig = {
recursive = true;
target = "nvim/lua";
source = ./lua;
};
};
}
12 changes: 12 additions & 0 deletions home-manager/personalities/cli/editor/nvim/lua/community.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE

-- AstroCommunity: import any community modules here
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
-- This guarantees that the specs are processed before any user plugins.

---@type LazySpec
return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.lua" },
-- import/override with your plugins folder
}
31 changes: 31 additions & 0 deletions home-manager/personalities/cli/editor/nvim/lua/lazy_setup.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require("lazy").setup({
{
"AstroNvim/AstroNvim",
version = "^4", -- Remove version tracking to elect for nighly AstroNvim
import = "astronvim.plugins",
opts = { -- AstroNvim options must be set here with the `import` key
mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up
maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up
icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available)
pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override
},
},
{ import = "community" },
{ import = "plugins" },
} --[[@as LazySpec]], {
-- Configure any other `lazy.nvim` configuration options here
install = { colorscheme = { "astrodark", "habamax" } },
ui = { backdrop = 100 },
performance = {
rtp = {
-- disable some rtp plugins, add more to your liking
disabled_plugins = {
"gzip",
"netrwPlugin",
"tarPlugin",
"tohtml",
"zipPlugin",
},
},
},
} --[[@as LazyConfig]])
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE

-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more!
-- Configuration documentation can be found with `:h astrocore`
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
-- as this provides autocomplete and documentation while editing

---@type LazySpec
return {
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
-- Configure core features of AstroNvim
features = {
large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
autopairs = true, -- enable autopairs at start
cmp = true, -- enable completion at start
diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on)
highlighturl = true, -- highlight URLs at start
notifications = true, -- enable notifications at start
},
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = {
virtual_text = true,
underline = true,
},
-- vim options can be configured here
options = {
opt = { -- vim.opt.<key>
relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number
spell = false, -- sets vim.opt.spell
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
wrap = false, -- sets vim.opt.wrap
},
g = { -- vim.g.<key>
-- configure global vim variables (vim.g)
-- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup`
-- This can be found in the `lua/lazy_setup.lua` file
},
},
-- Mappings can be configured through AstroCore as well.
-- NOTE: keycodes follow the casing in the vimdocs. For example, `<Leader>` must be capitalized
mappings = {
-- first key is the mode
n = {
-- second key is the lefthand side of the map

-- navigate buffer tabs with `H` and `L`
-- L = {
-- function() require("astrocore.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end,
-- desc = "Next buffer",
-- },
-- H = {
-- function() require("astrocore.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end,
-- desc = "Previous buffer",
-- },

-- mappings seen under group name "Buffer"
["<Leader>bD"] = {
function()
require("astroui.status.heirline").buffer_picker(
function(bufnr) require("astrocore.buffer").close(bufnr) end
)
end,
desc = "Pick to close",
},
-- tables with just a `desc` key will be registered with which-key if it's installed
-- this is useful for naming menus
["<Leader>b"] = { desc = "Buffers" },
-- quick save
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
},
t = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
},
},
},
}
Loading

0 comments on commit 94d0796

Please sign in to comment.