@@ 5,12 5,13 @@ vim.g.maplocalleader = ","
-- Load Plugins
require("plugins")
-- Color Scheme
-vim.cmd.colorscheme "catppuccin-mocha"
-vim.g.everforest_background = "hard"
-vim.opt.background = "dark"
+vim.cmd.colorscheme "catppuccin"
+-- vim.cmd([[colorscheme kanagawa]])
-- Config for Nord, which I usually use
---vim.g.nord_italic = false
---vim.g.nord_bold = false
+-- vim.g.nord_italic = false
+-- vim.g.nord_bold = false
+-- vim.opt.background = "light"
+vim.opt.background = "dark"
-- Formatting and vim config
vim.opt.expandtab = true
@@ 39,17 40,11 @@ vim.opt.textwidth = 88
vim.g.sexp_enable_insert_mode_mappings = 1
-- LuaLine Config
-require("lualine").setup(
- {
- options = {
- icons_enabled = true,
- theme = "auto"
- }
- }
-)
+require("lualine").setup({options = {icons_enabled = true, theme = "auto"}})
-- CTags
-vim.opt.tags = vim.opt.tags + vim.fn.expand("~/.local/tmp/ctags") + vim.fn.expand("~/repos/gerbil/src/TAGS")
+vim.opt.tags = vim.opt.tags + vim.fn.expand("~/.local/tmp/ctags") +
+ vim.fn.expand("~/repos/gerbil/src/TAGS")
-- Conjure
@@ 62,8 57,6 @@ end
set_gerbil()
vim.api.nvim_create_user_command("ConjureGerbil", set_gerbil, {})
-
-
-- Chibi-scheme
local set_chibi = function()
vim.g["conjure#client#scheme#stdio#command"] = "chibi-scheme -R"
@@ 79,18 72,8 @@ local set_chicken = function()
end
vim.api.nvim_create_user_command("ConjureChicken", set_chicken, {})
--- Neoformat
-vim.g.neoformat_run_all_formatters = 1
-vim.g.neoformat_enabled_python = {"black", "docformatter", "isort"}
-vim.g.neoformat_python_black = {
- exe = "ruff",
- stdin = 1,
- args = {'format', '-q', '-'}
-}
-
-- KEYMAPS
-
-local keymap = vim.api.nvim_set_keymap
+local keymap = vim.keymap.set
local noremap = {noremap = true}
local silentnoremap = {noremap = true, silent = true}
-- Easier breaking from edit modes
@@ 146,92 129,43 @@ keymap("n", "<Right>", "zl", silentnoremap)
-- LSP Documentation viewer
keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", silentnoremap)
--- Autoformat
-keymap("n", "<C-n>", "<cmd>Neoformat<CR>", silentnoremap)
+-- Autoformat!
+vim.api.nvim_create_user_command("Format", function(args)
+ local range = nil
+ if args.count ~= -1 then
+ local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
+ range = {
+ start = { args.line1, 0 },
+ ["end"] = { args.line2, end_line:len() },
+ }
+ end
+ require("conform").format({ async = true, lsp_format = "fallback", range = range })
+end, { range = true })
+keymap("n", "<C-n>", "<cmd>Format<CR>", silentnoremap)
-- Python Specific
vim.g.python3_host_prog = vim.fn.expand("~/.envs/nvim/bin/python3")
-- Set up Treesitter
-require("nvim-treesitter.configs").setup(
- {
- highlight = {
- enable = true,
- disable = {}
- },
- indent = {
- enable = true,
- disable = {}
- },
- ensure_installed = {
- "c",
- "cpp",
- "capnp",
- "cmake",
- "bash",
- "dockerfile",
- "diff",
- "devicetree",
- "dot",
- "ebnf",
- "elixir",
- "erlang",
- "clojure",
- "fortran",
- "go",
- "gomod",
- "gosum",
- "graphql",
- "git_config",
- "git_rebase",
- "gitcommit",
- "gitignore",
- "gleam",
- "julia",
- "fish",
- "toml",
- "haskell",
- "hare",
- "http",
- "html",
- "ini",
- "json",
- "jq",
- "latex",
- "llvm",
- "mermaid",
- "make",
- "meson",
- "ninja",
- "yaml",
- "python",
- "proto",
- "racket",
- "rst",
- "scala",
- "html",
- "tsx",
- "rust",
- "scheme",
- "fennel",
- "lua",
- "markdown",
- "markdown_inline",
- "sql",
- "thrift",
- "typescript",
- "verilog",
- "vim",
- "zig",
- "uxntal"
- }
+-- TODO: move this to plugins.lua
+require("nvim-treesitter.configs").setup({
+ highlight = {enable = true, disable = {}},
+ indent = {enable = true, disable = {}},
+ ensure_installed = {
+ "c", "cpp", "capnp", "cmake", "bash", "dockerfile", "diff",
+ "devicetree", "dot", "ebnf", "elixir", "erlang", "clojure", "fortran",
+ "go", "gomod", "gosum", "graphql", "git_config", "git_rebase",
+ "gitcommit", "gitignore", "gleam", "julia", "fish", "toml", "haskell",
+ "hare", "http", "html", "ini", "json", "jq", "latex", "llvm", "mermaid",
+ "make", "meson", "ninja", "yaml", "python", "proto", "racket", "rst",
+ "scala", "html", "tsx", "rust", "scheme", "fennel", "lua", "markdown",
+ "markdown_inline", "sql", "thrift", "typescript", "verilog", "vim",
+ "zig", "uxntal", "kdl", "vimdoc", "janet_simple"
}
-)
+})
--- Set up Which Key?
-require("which-key").setup({})
-- ########################
---# Require other configs #
+-- # Require other configs #
-- ########################
-- LSP
require("lsp")
@@ 18,40 18,99 @@ require("lazy").setup({
-- Color themes
"shaunsingh/nord.nvim", "shaunsingh/moonlight.nvim",
"folke/tokyonight.nvim", "cranberry-clockworks/coal.nvim",
- "hardselius/warlock", "sainnhe/everforest",
- {"catppuccin/nvim", name = "catppuccin", priority = 1000},
- {"rebelot/kanagawa.nvim", opts = {compile = true}},
+ "hardselius/warlock",
+ { "catppuccin/nvim", name = "catppuccin", priority = 1000 },
+ {
+ "neanias/everforest-nvim",
+ version = false,
+ lazy = false,
+ priority = 500, -- make sure to load this before all the other start plugins
+ main = "everforest",
+ opts = { background = "hard" }
+ },
+ { "rebelot/kanagawa.nvim", opts = { compile = true } },
-- show indents and whitespace characters
"lukas-reineke/indent-blankline.nvim", -- Completion
- "hrsh7th/nvim-cmp", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer",
- "hrsh7th/cmp-path", "hrsh7th/cmp-vsnip", "hrsh7th/vim-vsnip",
- "petertriho/cmp-git", -- nvim lsp plugins
- "neovim/nvim-lspconfig", {
+ -- Completion
+ {
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ --"hrsh7th/cmp-vsnip",
+ --"hrsh7th/vim-vsnip",
+ "petertriho/cmp-git",
+ "hrsh7th/cmp-cmdline"
+ }
+ }, -- nvim lsp plugins
+ "neovim/nvim-lspconfig",
+ {
"nvimdev/lspsaga.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons", "nvim-treesitter/nvim-treesitter"
},
- opts = {lightbulb = {enable = false}},
+ opts = { lightbulb = { enable = false } },
event = "LspAttach"
- }, -- Syntax Highlighting from the future
+ },
{
+ -- Syntax Highlighting from the future
"nvim-treesitter/nvim-treesitter",
- init = function() vim.cmd([[":TSUpdate"]]) end
- }, -- GitGutter, shows inline difs
- -- "airblade/vim-gitgutter", -- Git wrapper plugin
- -- "tpope/vim-fugitive",
- {
- "NeogitOrg/neogit", "nvim-lua/plenary.nvim", -- required
- "sindrets/diffview.nvim", -- optional - Diff integration
- "nvim-telescope/telescope.nvim"
- }, "akinsho/git-conflict.nvim", -- surround with pairs ))))))
- -- "tpope/vim-surround",
+ --init = function() vim.cmd([[":TSUpdate"]]) end,
+ main = "nvim-treesitter.configs",
+ opts = {
+ ensure_installed = 'all',
+ ignore_install = { 'norg' },
+ sync_intall = true,
+ highlight = {
+ enable = true,
+ },
+ },
+ build = ":TSUpdate",
+ version = false,
+ dependencies = {
+ "nvim-treesitter/nvim-treesitter-textobjects",
+ },
+ }, -- Git stuff
+ -- GitGutter, shows inline difs
+ "airblade/vim-gitgutter", -- "tpope/vim-fugitive", -- old git command
+ {
+ "NeogitOrg/neogit",
+ dependencies = {
+ "nvim-lua/plenary.nvim", -- required
+ "sindrets/diffview.nvim", -- optional - Diff integration
+ "nvim-telescope/telescope.nvim"
+ },
+ config = true
+ },
-- Auto format tool
- {"sbdchd/neoformat", lazy = true, cmd = "Neoformat"},
- -- Distraction free writing: GoYo + Limelight
- {"junegunn/limelight.vim", lazy = true, ft = "markdown"},
- {"junegunn/goyo.vim", lazy = true, ft = "markdown"}, -- Golang plugins
- -- use {"fatih/vim-go", run = ":GoUpdateBinaries", lazy = true, ft = "go"}
+ {
+ "stevearc/conform.nvim",
+ lazy = true,
+ opt = {
+ python = { "isort", "black" },
+ lua = { "lua-format" },
+ clojure = { "cljfmt" },
+ rust = { "rustfmt" },
+ haskell = { "ormolu", "stylish-haskell" },
+ go = { "goimports", "gofmt" },
+ java = { "google-java-format" },
+ javascript = { "prettier" },
+ html = { "prettier" },
+ yaml = { "prettier" },
+ sh = { "shfmt" },
+ c = { "clang-format" },
+ }
+ },
+ {
+ "hedyhli/outline.nvim",
+ lazy = true,
+ cmd = { "Outline", "OutlineOpen" },
+ config = true,
+ keys = {
+ { "<leader>o", "<cmd>Outline<cr>", desc = "Toggle outline" },
+ },
+ },
{
"ray-x/go.nvim",
ft = "go",
@@ 63,43 122,167 @@ require("lazy").setup({
},
{
"nvim-lualine/lualine.nvim",
- dependencies = {"nvim-tree/nvim-web-devicons"}
- }, "junegunn/fzf.vim", {
+ dependencies = { "nvim-tree/nvim-web-devicons" }
+ },
+ "junegunn/fzf.vim",
+ {
dir = "~/.fzf",
build = function() vim.fn["fzf#install"](0) end,
- dependencies = {"junegunn/fzf.vim"}
- }, -- "romgrk/barbar.nvim", -- Polyglot
- "sheerun/vim-polyglot", -- Telescope, find anything fast
+ dependencies = { "junegunn/fzf.vim" }
+ },
+ -- Telescope, find anything fast
"nvim-lua/plenary.nvim",
- {"nvim-telescope/telescope.nvim", dependencies = {"nvim-lua/plenary.nvim"}},
- "nvim-telescope/telescope-symbols.nvim",
- {"folke/trouble.nvim", dependencies = "nvim-tree/nvim-web-devicons"},
+ {
+ "nvim-telescope/telescope.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-telescope/telescope-symbols.nvim",
+ }
+ },
+ {
+ "folke/trouble.nvim",
+ dependencies = "nvim-tree/nvim-web-devicons"
+ },
-- Which key is bound?
- "folke/which-key.nvim", -- literally the best plugin ever
- -- Lithsps
- {"guns/vim-sexp", ft = {"hy", "scheme", "clojure"}}, -- ))))))
- {"hiphish/rainbow-delimiters.nvim"},
- -- {"gpanders/nvim-parinfer", ft = {"scheme", "lisp", "fennel", "clojure", "lua"}},
- -- {
- -- "eraserhd/parinfer-rust",
- -- build = "RUSTFLAGS='-C target-feature=+crt-static' cargo build --release",
- -- ft = {"scheme", "lisp", "fennel", "clojure", "lua"},
- -- },
+ {
+ "folke/which-key.nvim",
+ init = function()
+ vim.o.timeout = true
+ vim.o.timeoutlen = 300
+ end,
+ config = true
+ }, -- literally the best plugin ever
+ -- Developing my neovim
+ { "folke/neodev.nvim", config = true }, -- Lithsps
+ --{ "m4xshen/autoclose.nvim" },
+ {
+ "windwp/nvim-autopairs",
+ event = "InsertEnter",
+ config = function()
+ local pairs = require("nvim-autopairs")
+
+ pairs.setup({
+ check_ts = true,
+ enable_check_bracket_line = false,
+ })
+
+ pairs.get_rules("`")[1].not_filetypes = { "clojure", "scheme", "scm", "janet" }
+ pairs.get_rules("'")[1].not_filetypes = { "clojure", "scheme", "scm", "janet", "rust" }
+ end,
+ },
+ {
+ "gpanders/nvim-parinfer",
+ ft = { "hy", "scheme", "scm", "clojure", "fennel", "janet", "lisp", "python", "lua" }
+ },
+ --'janet-lang/janet.vim',
+ -- ))))))
+ {
+ "julienvincent/nvim-paredit",
+ config = function()
+ local paredit = require('nvim-paredit')
+ paredit.setup({
+ indent = {
+ enabled = true,
+ },
+ --filetypes = {"clojure", "fennel", "janet"},
+ keys = {
+ ["<localleader>w"] = {
+ function()
+ -- place cursor and set mode to `insert`
+ paredit.cursor.place_cursor(
+ -- wrap element under cursor with `( ` and `)`
+ paredit.wrap.wrap_element_under_cursor("( ", ")"),
+ -- cursor placement opts
+ { placement = "inner_start", mode = "insert" }
+ )
+ end,
+ "Wrap element insert head",
+ },
+
+ ["<localleader>W"] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_element_under_cursor("(", ")"),
+ { placement = "inner_end", mode = "insert" }
+ )
+ end,
+ "Wrap element insert tail",
+ },
+ -- same as above but for enclosing form
+ ["<localleader>i"] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_enclosing_form_under_cursor("( ", ")"),
+ { placement = "inner_start", mode = "insert" }
+ )
+ end,
+ "Wrap form insert head",
+ },
+ ["<localleader>I"] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_enclosing_form_under_cursor("(", ")"),
+ { placement = "inner_end", mode = "insert" }
+ )
+ end,
+ "Wrap form insert tail",
+ },
+ ["<localleader>["] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_enclosing_form_under_cursor("[", "]"),
+ { placement = "inner_start", mode = "insert" }
+ )
+ end,
+ },
+ ["<localleader>{"] = {
+ function()
+ paredit.cursor.place_cursor(
+ paredit.wrap.wrap_enclosing_form_under_cursor("{", "}"),
+ { placement = "inner_end", mode = "insert" }
+ )
+ end,
+ },
+ },
+ })
+ end,
+ ft = { "hy", "scheme", "scm", "clojure", "fennel", "janet", "lisp", "python", "lua" }
+ },
+ {
+ "chiefnoah/nvim-paredit-janet",
+ dependencies = { "julienvincent/nvim-paredit" },
+ lazy = true,
+ ft = { "janet" },
+ config = function()
+ require("nvim-paredit-janet").setup()
+ end,
+ },
+ {
+ "julienvincent/nvim-paredit-fennel",
+ dependencies = { "julienvincent/nvim-paredit" },
+ ft = { "fennel" },
+ config = true,
+ },
+ { "hiphish/rainbow-delimiters.nvim" },
+ --{ "gpanders/nvim-parinfer", ft = { "scheme", "scm", "lisp", "fennel", "clojure", "lua", "janet" } },
-- Conjure, lisp is magical
{
"Olical/conjure",
- ft = {"scheme", "lisp", "fennel", "clojure", "lua"},
+ ft = { "scheme", "scm", "lisp", "fennel", "clojure", "lua", "janet" },
config = function()
vim.g["conjure#client#scheme#stdio#command"] = "gxi"
vim.g["conjure#client#scheme#stdio#prompt_pattern"] = "%d*> $?"
- end
- }, {"p1xelHer0/gerbil.nvim", ft = "scheme"}, -- Fennel, Luasthp
- {"jaawerth/fennel.vim", lazy = true, ft = "fennel"},
- {"rktjmp/hotpot.nvim", lazy = true, ft = "fennel"},
- {"Olical/nfnl", ft = "fennel"}, -- Rust stuff
- "pest-parser/pest.vim", {
+ end,
+ dependencies = { "PaterJason/cmp-conjure" }
+ },
+ { "PaterJason/cmp-conjure", lazy = true },
+ { "p1xelHer0/gerbil.nvim", ft = "scheme" }, -- Fennel, Luasthp
+ { "jaawerth/fennel.vim", lazy = true, ft = "fennel" },
+ { "rktjmp/hotpot.nvim", lazy = true, ft = "fennel" },
+ { "Olical/nfnl", ft = "fennel" }, -- Rust stuff
+ {
"simrat39/rust-tools.nvim",
- ft = {"rust"},
+ ft = { "rust" },
config = function()
local rt = require("rust-tools")
rt.setup({
@@ 107,41 290,35 @@ require("lazy").setup({
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>",
- rt.hover_actions.hover_actions,
- {buffer = bufnr})
+ rt.hover_actions.hover_actions,
+ { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a",
- rt.code_action_group.code_action_group,
- {buffer = bufnr})
+ rt.code_action_group.code_action_group,
+ { buffer = bufnr })
end
}
})
end,
- dependencies = {"nvim-lua/plenary.nvim"}
- }, {"mfussenegger/nvim-dap", lazy = true, ft = {"c", "rust"}}, {
+ dependencies = { "nvim-lua/plenary.nvim" }
+ },
+ { "mfussenegger/nvim-dap", lazy = true, ft = { "c", "rust" } },
+ {
"saecki/crates.nvim",
tag = "v0.4.0",
- dependencies = {"nvim-lua/plenary.nvim"},
+ dependencies = { "nvim-lua/plenary.nvim" },
config = function() require("crates").setup() end,
- ft = {"rust"}
- }, -- RISC-V Assembly syntax highlighting
- {"kylelaker/riscv.vim", ft = "riscv"}, -- Hare Stuff
+ ft = { "rust" }
+ }, -- RISC-V Assembly syntax highlighting
+ { "kylelaker/riscv.vim", ft = "riscv" }, -- Hare Stuff
-- Haredoc
- {url = "https://git.sr.ht/~torresjrjr/vim-haredoc", ft = {"hare"}},
- -- Hare.vim
- {url = "https://git.sr.ht/~sircmpwn/hare.vim"}, -- TCL
- {"lewis6991/tree-sitter-tcl", build = "make"}, -- LF
- {"ptzz/lf.vim", cmd = {"Lf"}, dependencies = {"voldikss/vim-floaterm"}},
- -- Copilot
- -- use {"github/copilot.vim", lazy = true, cmd = {"Copilot"}}
- -- Mason
- {
- "williamboman/mason.nvim",
- init = function() vim.cmd([[":MasonUpdate"]]) end,
- dependencies = {
- "williamboman/mason-lspconfig.nvim", "mfussenegger/nvim-dap",
- "jose-elias-alvarez/null-ls.nvim"
- },
- config = function() require("mason").setup() end
- }
+ {
+ url = "https://git.sr.ht/~torresjrjr/vim-haredoc",
+ ft = { "hare" },
+ branch = "dev"
+ }, -- Hare.vim
+ { url = "https://git.sr.ht/~sircmpwn/hare.vim", ft = { "hare" } }, -- TCL
+ { "lewis6991/tree-sitter-tcl", build = "make" }, -- LF
+ { "ptzz/lf.vim", cmd = { "Lf" }, dependencies = { "voldikss/vim-floaterm" } },
+ "imsnif/kdl.vim"
}, nil)