From 71d873744760084ce7f568b986425fc98a70cd52 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Fri, 30 Dec 2022 21:57:24 -0800 Subject: [PATCH] neovim: Convert all config to Lua I've been using this with only minimal changes for a few weeks now, so this seems like a good place to checkpoint it. --- bin/set-colors | 2 + darwin.conf.yaml | 1 - linux.conf.yaml | 1 - neovim/colors | 1 - neovim/colors/.gitignore | 1 + neovim/colors/jdkaplan-cool.lua | 14 + neovim/colors/jdkaplan-warm.lua | 14 + neovim/colors/jdkaplan.vim | 1 + neovim/darwin-plugins.vim | 1 - neovim/ftplugin/yaml.vim | 1 - neovim/init.lua | 574 +++++++++++++++++++++++++++++ neovim/init.vim | 482 ------------------------ neovim/lazy-lock.json | 37 ++ neovim/linux-plugins.vim | 1 - neovim/lua/jdkaplan/cool_theme.lua | 201 ++++++++++ neovim/lua/jdkaplan/warm_theme.lua | 201 ++++++++++ neovim/postinstall | 3 - 17 files changed, 1045 insertions(+), 491 deletions(-) delete mode 120000 neovim/colors create mode 100644 neovim/colors/.gitignore create mode 100644 neovim/colors/jdkaplan-cool.lua create mode 100644 neovim/colors/jdkaplan-warm.lua create mode 120000 neovim/colors/jdkaplan.vim delete mode 100644 neovim/darwin-plugins.vim delete mode 100644 neovim/ftplugin/yaml.vim create mode 100644 neovim/init.lua delete mode 100644 neovim/init.vim create mode 100644 neovim/lazy-lock.json delete mode 100644 neovim/linux-plugins.vim create mode 100644 neovim/lua/jdkaplan/cool_theme.lua create mode 100644 neovim/lua/jdkaplan/warm_theme.lua diff --git a/bin/set-colors b/bin/set-colors index 4ef0f97..b095ba5 100755 --- a/bin/set-colors +++ b/bin/set-colors @@ -13,6 +13,7 @@ install_dark() { ln -sf "${DOTFILES}/bat/config-dark" "${DOTFILES}/bat/config" ln -sf "${DOTFILES}/task/jdkaplan-dark.theme" "${DOTFILES}/task/color.theme" ln -sf "${DOTFILES}/vim/colors/jdkaplan-dark.vim" "${DOTFILES}/vim/colors/jdkaplan.vim" + ln -sf "${DOTFILES}/neovim/colors/jdkaplan-cool.lua" "${DOTFILES}/neovim/colors/jdkaplan-temp.lua" if [ "${OSTYPE}" == 'Linux' ]; then ln -sf "${DOTFILES}/xsettingsd/xsettingsd-dark.conf" "${DOTFILES}/xsettingsd/xsettingsd.conf" @@ -28,6 +29,7 @@ install_light() { ln -sf "${DOTFILES}/bat/config-light" "${DOTFILES}/bat/config" ln -sf "${DOTFILES}/task/jdkaplan-light.theme" "${DOTFILES}/task/color.theme" ln -sf "${DOTFILES}/vim/colors/jdkaplan-light.vim" "${DOTFILES}/vim/colors/jdkaplan.vim" + ln -sf "${DOTFILES}/neovim/colors/jdkaplan-warm.lua" "${DOTFILES}/neovim/colors/jdkaplan-temp.lua" if [ "${OSTYPE}" == 'Linux' ]; then ln -sf "${DOTFILES}/xsettingsd/xsettingsd-light.conf" "${DOTFILES}/xsettingsd/xsettingsd.conf" diff --git a/darwin.conf.yaml b/darwin.conf.yaml index ab1bba9..809ec20 100644 --- a/darwin.conf.yaml +++ b/darwin.conf.yaml @@ -8,7 +8,6 @@ - link: ./alacritty/os.yml: alacritty/darwin.yml ./git/config-os: git/config-darwin - ./neovim/os-plugins.vim: neovim/darwin-plugins.vim ./zsh/os.zshrc: zsh/darwin.zshrc ~/.config/karabiner: karabiner/ ~/.config/tridactyl: tridactyl/ diff --git a/linux.conf.yaml b/linux.conf.yaml index bebcd98..ec56cdf 100644 --- a/linux.conf.yaml +++ b/linux.conf.yaml @@ -1,4 +1,3 @@ - link: ./alacritty/os.yml: alacritty/linux.yml - ./neovim/os-plugins.vim: neovim/linux-plugins.vim ./zsh/os.zshrc: zsh/linux.zshrc diff --git a/neovim/colors b/neovim/colors deleted file mode 120000 index 1e95c42..0000000 --- a/neovim/colors +++ /dev/null @@ -1 +0,0 @@ -../vim/colors \ No newline at end of file diff --git a/neovim/colors/.gitignore b/neovim/colors/.gitignore new file mode 100644 index 0000000..fab1f8c --- /dev/null +++ b/neovim/colors/.gitignore @@ -0,0 +1 @@ +jdkaplan-temp.lua diff --git a/neovim/colors/jdkaplan-cool.lua b/neovim/colors/jdkaplan-cool.lua new file mode 100644 index 0000000..9a98e88 --- /dev/null +++ b/neovim/colors/jdkaplan-cool.lua @@ -0,0 +1,14 @@ +vim.opt.background = 'dark' +vim.g.colors_name = 'jdkaplan-cool' + +vim.o.termguicolors = true + +local pkg = 'jdkaplan.cool_theme' + +-- Clear the Lua cache for the theme package to force it to load every time. +package.loaded[pkg] = nil + +local lush = require('lush') +local theme = require(pkg) + +lush(theme) diff --git a/neovim/colors/jdkaplan-warm.lua b/neovim/colors/jdkaplan-warm.lua new file mode 100644 index 0000000..bb31faf --- /dev/null +++ b/neovim/colors/jdkaplan-warm.lua @@ -0,0 +1,14 @@ +vim.opt.background = 'light' +vim.g.colors_name = 'jdkaplan-warm' + +vim.o.termguicolors = true + +local pkg = 'jdkaplan.warm_theme' + +-- Clear the Lua cache for the theme package to force it to load every time. +package.loaded[pkg] = nil + +local lush = require('lush') +local theme = require(pkg) + +lush(theme) diff --git a/neovim/colors/jdkaplan.vim b/neovim/colors/jdkaplan.vim new file mode 120000 index 0000000..490732e --- /dev/null +++ b/neovim/colors/jdkaplan.vim @@ -0,0 +1 @@ +../../vim/colors/jdkaplan.vim \ No newline at end of file diff --git a/neovim/darwin-plugins.vim b/neovim/darwin-plugins.vim deleted file mode 100644 index 14762ab..0000000 --- a/neovim/darwin-plugins.vim +++ /dev/null @@ -1 +0,0 @@ -Plug '/usr/local/opt/fzf' diff --git a/neovim/ftplugin/yaml.vim b/neovim/ftplugin/yaml.vim deleted file mode 100644 index 6f78fab..0000000 --- a/neovim/ftplugin/yaml.vim +++ /dev/null @@ -1 +0,0 @@ -setlocal shiftwidth=2 diff --git a/neovim/init.lua b/neovim/init.lua new file mode 100644 index 0000000..c7123e5 --- /dev/null +++ b/neovim/init.lua @@ -0,0 +1,574 @@ +vim.o.shell = '/bin/sh' +vim.g.python3_host_prog = vim.fn.expand("~/.virtualenvs/neovim3/bin/python") + +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath }) + vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" }) +end +vim.opt.rtp:prepend(lazypath) + +plugins = { + { 'rktjmp/lush.nvim' }, + { + "chrisbra/unicode.vim", + lazy = false, + dependencies = { "junegunn/fzf" }, + keys = { + { "", "(UnicodeFuzzy)", mode = "i" }, + }, + init = function() + vim.g.Unicode_no_default_mappings = 1 + end, + }, + { "hrsh7th/cmp-nvim-lsp", branch = "main" }, + { "hrsh7th/nvim-cmp", branch = "main" }, + { + "junegunn/vim-easy-align", + init = function() + vim.keymap.set("x", "ga", "(EasyAlign)") + vim.keymap.set("n", "ga", "(EasyAlign)") + end, + }, + { "kylechui/nvim-surround", config = true}, + "L3MON4D3/LuaSnip", + { + "lewis6991/gitsigns.nvim", + lazy = false, + init = function() + local gitsigns = require("gitsigns") + + local toggle = function(value) + -- Order matters here! If I toggle signs first (before blame), + -- it seems like the blame gets an extra chance to render while + -- it's being disabled, which leaves a ghost blame around + -- forever. If I toggle blame first, it stays truly off and + -- there aren't any ghost signs (or at least they're not + -- obvious because the sign column goes away). + gitsigns.toggle_current_line_blame(value) + gitsigns.toggle_signs(value) + end + + vim.keymap.set("n", "g", toggle) + vim.keymap.set("n", "]h", gitsigns.next_hunk) + vim.keymap.set("n", "[h", gitsigns.prev_hunk) + end, + config = { + signcolumn = false, + signs = { + add = { hl = 'GitSignsAdd' , text = '+', numhl='GitSignsAddNr' , linehl='GitSignsAddLn' }, + change = { hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn' }, + delete = { hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn' }, + topdelete = { hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn' }, + changedelete = { hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn' }, + untracked = { hl = 'GitSignsAdd' , text = '+', numhl='GitSignsAddNr' , linehl='GitSignsAddLn' }, + }, + current_line_blame_formatter = ' ', + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', + delay = 500, + ignore_whitespace = false, + }, + }, + }, + "MarcWeber/vim-addon-local-vimrc", + { + "MunifTanjim/prettier.nvim", + dependencies = { "jose-elias-alvarez/null-ls.nvim" }, + config = true, + }, + { + "jose-elias-alvarez/null-ls.nvim", + dependencies = { + "neovim/nvim-lspconfig", + "nvim-lua/plenary.nvim", + }, + }, + "neovim/nvim-lspconfig", + { + "ntpeters/vim-better-whitespace", + init = function() + vim.g.better_whitespace_enabled = 1 + vim.g.better_whitespace_filetypes_blacklist = { 'diff' } + vim.g.strip_whitespace_on_save = 1 + vim.g.strip_whitespace_confirm = 0 + vim.g.better_whitespace_operator = '' + end, + }, + { + "preservim/nerdtree", + keys = { + { "t", ":NERDTreeToggle" }, + { "a", ":NERDTreeFind" }, + }, + }, + { + "nvim-telescope/telescope.nvim", + version = '^0.1.0', + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope-fzf-native.nvim", + "MunifTanjim/nui.nvim", + "stevearc/aerial.nvim", + }, + init = function() + local telescope = require('telescope') + telescope.load_extension('fzf') + telescope.load_extension('aerial') + + local builtin = require('telescope.builtin') + + find_files = function(opts) + opts = opts or {} + opts['hidden'] = true + return builtin.find_files(opts) + end + + vim.keymap.set('n', 'f', find_files) + vim.keymap.set('n', 'g', builtin.live_grep) + vim.keymap.set('n', 'b', builtin.buffers) + vim.keymap.set('n', '*', builtin.grep_string) + vim.keymap.set('n', 'o', telescope.extensions.aerial.aerial) + + -- TODO: Delete these ; fake-leader bindings + vim.keymap.set('n', ';f', find_files) + vim.keymap.set('n', ';g', builtin.live_grep) + vim.keymap.set('n', ';b', builtin.buffers) + vim.keymap.set('n', ';*', builtin.grep_string) + end, + opts = { + defaults = { + vimgrep_arguments = { + "rg", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + -- Include hidden files, but continue ignoring the .git directory itself. + "--hidden", + "--iglob", "!.git", + } + }, + pickers = {}, + extensions = { + aerial = {}, + }, + }, + }, + { + "nvim-telescope/telescope-fzf-native.nvim", + build = "make", + }, + { + "nvim-treesitter/nvim-treesitter-textobjects", + dependencies = { "nvim-treesitter/nvim-treesitter" }, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + init = function() + require('nvim-treesitter.configs').setup({ + highlight = { enable = true }, + incremental_selection = { enable = true }, + + textobjects = { + enable = true, + select = { + enable = true, + + lookahead = true, + + include_surrounding_whitespace = true, + + -- TODO: more keymaps + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@comment.outer", + ["ic"] = "@comment.outer", + }, + }, + }, + + ensure_installed = { + "bash", + "css", + "dockerfile", + "dot", + "diff", + "git_config", + "git_rebase", + "gitattributes", + "gitcommit", + "gitignore", + "go", + "gomod", + "gosum", + "gowork", + "html", + "javascript", + "jq", + "json", + "lua", + "markdown", + "markdown_inline", + "proto", + "python", + "ruby", + "rust", + "scss", + "sql", + "toml", + "tsx", + "typescript", + "yaml", + }, + }) + end, + }, + "qpkorr/vim-bufkill", + { + "saadparwaiz1/cmp_luasnip", + dependencies = { "L3MON4D3/LuaSnip" }, + }, + "simrat39/rust-tools.nvim", + { + "stevearc/aerial.nvim", + dependencies = { + "nvim-treesitter/nvim-treesitter", + }, + opts = {}, + keys = { + { "m", "AerialToggle" }, + { "n", "AerialNavToggle" }, + }, + }, + "tpope/vim-abolish", + "tpope/vim-commentary", + "tpope/vim-endwise", + { + "tpope/vim-fugitive", + init = function() + vim.keymap.set("", "G", ":Git") + + -- TODO: Delete these ; fake-leader bindings + vim.keymap.set("", ";G", ":Git") + end, + }, + "tpope/vim-repeat", + { + "wellle/context.vim", + lazy = false, + init = function() + vim.g.context_enabled = 0 + vim.keymap.set("", "cc", ":ContextToggleWindow", { silent = true }) + vim.keymap.set("", "cp", ":ContextPeek", { silent = true }) + end, + }, + { "williamboman/nvim-lsp-installer", branch = "main" }, + { + "windwp/nvim-autopairs", + opts = { + map_cr = true, + enable_check_bracket_line = true, + check_ts = true, + }, + config = function(_plugin, opts) + local npairs = require("nvim-autopairs") + npairs.setup(opts) + + -- Allow tick-quoting in Lisps + npairs.get_rule("'")[1].not_filetypes = { "clojure", "lisp", "scheme" } + end, + }, + { + "almo7aya/openingh.nvim", + keys = { + { "gh", "V:OpenInGHFile", mode = {"n"} }, + { "gh", ":OpenInGHFile", mode = {"v"} }, + }, + }, +} + +require("lazy").setup(plugins) + +theme = "jdkaplan-temp" + +vim.o.number = true +vim.o.hidden = true + +vim.cmd.colorscheme(theme) + +vim.o.expandtab = true +vim.o.tabstop = 4 +vim.o.softtabstop = 4 +vim.o.shiftwidth = 4 +vim.o.smartindent = true +vim.opt.formatoptions = "crqnlj" +vim.o.foldenable = false +vim.o.joinspaces = false + +vim.o.wrap = true +vim.o.linebreak = true +vim.keymap.set("", "j", "gj", { silent = true }) +vim.keymap.set("", "k", "gk", { silent = true }) + +vim.o.list = false +vim.o.wrapmargin = 0 +vim.opt.listchars = { + tab = ">-", + extends = ">", + precedes = "<", + nbsp = "+", + trail = "-", +} + +vim.o.ignorecase = true +vim.o.smartcase = true + +vim.o.cursorline = true + +vim.o.splitbelow = true +vim.o.splitright = true + +vim.o.modelines = 0 +vim.o.lazyredraw = true +vim.o.updatetime = 250 + +vim.opt.shortmess:append("I") + +vim.opt.wildignore:append("*.swp,*~") + +vim.opt.completeopt = "menu,menuone,noselect" + +vim.o.secure = true + +vim.keymap.set("", "wh", ":wincmd h") +vim.keymap.set("", "wj", ":wincmd j") +vim.keymap.set("", "wk", ":wincmd k") +vim.keymap.set("", "wl", ":wincmd l") + +vim.keymap.set("", 'w"', ":split") +vim.keymap.set("", 'w%', ":vsplit") +vim.keymap.set("", 'w0', ":close") +vim.keymap.set("", 'w1', ":only") + +-- TODO: Delete these ; fake-leader bindings +vim.keymap.set("", ";h", ":wincmd h") +vim.keymap.set("", ";j", ":wincmd j") +vim.keymap.set("", ";k", ":wincmd k") +vim.keymap.set("", ";l", ":wincmd l") + +vim.keymap.set("", ';"', ":split") +vim.keymap.set("", ';%', ":vsplit") +vim.keymap.set("", ';0', ":close") +vim.keymap.set("", ';1', ":only") + +vim.keymap.set("", 'w', ":w") + +-- TODO: Delete these ; fake-leader bindings +vim.keymap.set("", ';w', ":w") + +-- TODO: Delete these ; fake-leader bindings +vim.keymap.set("", ';;', ";") + +vim.keymap.set("", "", ":nohlsearch") + +-- TODO: Delete these ; fake-leader bindings +vim.keymap.set("", ";", ":nohlsearch") + +vim.keymap.set("n", "cc", ':let @+=expand("%")') +vim.keymap.set("n", "cl", ':let @+=join([expand("%"), line(".")], ":")') +vim.keymap.set("n", "cp", ':let @+=expand("%:p")') + +-- TODO: Delete these ; fake-leader bindings +vim.keymap.set("n", ";cc", ':let @+=expand("%")') +vim.keymap.set("n", ";cl", ':let @+=join([expand("%"), line(".")], ":")') +vim.keymap.set("n", ";cp", ':let @+=expand("%:p")') + +vim.cmd([[ +command Crosshair :set virtualedit=all cursorcolumn +command NoCrosshair :set virtualedit= nocursorcolumn +]]) + +vim.cmd([[ +autocmd FileType markdown setlocal spell +autocmd FileType text setlocal spell +]]) +vim.opt.spellcapcheck = "" + +-- CTRL-L usually clears and redraws the screen. Might as well use it to reset +-- the colorscheme too! +vim.keymap.set("n", "", function() + vim.cmd.colorscheme(theme) + vim.cmd.redraw() +end) + +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +local nvim_lsp = require('lspconfig') +local null_ls = require("null-ls") + +local on_attach = function(client, bufno) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufno, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufno, ...) end + + -- Enable completion through omnifunc, triggered by + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + local opts = { noremap=true, silent=true } + + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) + buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) + buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'R', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('v', 'ca', 'lua vim.lsp.buf.range_code_action()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'd', 'lua vim.diagnostic.open_float()', opts) + buf_set_keymap('n', 'j', 'lua vim.diagnostic.goto_next()', opts) + buf_set_keymap('n', 'k', 'lua vim.diagnostic.goto_prev()', opts) + buf_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) + + vim.api.nvim_command [[autocmd BufWritePre lua vim.lsp.buf.format()]] +end + +local lsp_installer = require('nvim-lsp-installer') +lsp_installer.setup({}) + +local lsp_settings = { + gopls = {}, + pyright = {}, + rust_analyzer = { + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy", + }, + }, + }, + solargraph = {}, + tsserver = {}, +} + +-- In theory, this can be used for all languages. In practice, I just need this +-- to pretend that gopls will run goimports for me. +function goimports(wait_ms, opts) + local bufnr = opts.bufnr or vim.api.nvim_get_current_buf() + + local params = vim.lsp.util.make_range_params() + params.context = {only = {"source.organizeImports"}} + + local result = vim.lsp.buf_request_sync(bufnr, "textDocument/codeAction", params, wait_ms) + for _, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + vim.lsp.util.apply_workspace_edit(r.edit, "utf-8") + else + vim.lsp.buf.execute_command(r.command) + end + end + end +end + +for _, server in ipairs(lsp_installer.get_installed_servers()) do + -- rust-analyzer will be configured by rust-tools. + if server.name == 'rust_analyzer' then goto continue end + + -- Go needs special logic to run goimports on save. + -- TODO: gopls via null_ls? + if server.name == 'gopls' then + vim.api.nvim_create_autocmd('BufWritePre', { + pattern = '*.go', + callback = function(...) goimports(1000, ...) end, + }) + end + + nvim_lsp[server.name].setup { + on_attach = on_attach, + settings = lsp_settings[server.name], + capabilities = capabilities, + } + + null_ls.setup({ + on_attach = on_attach, + }) + + ::continue:: +end + + +require('rust-tools').setup({ + tools = { + autoSetHints = true, + hover_with_actions = false, + inlay_hints = { + only_current_line = true, + -- Parameter hints are more annoying than useful here. Neovim can't show + -- virtual text in the middle of the line like other editors do. It would + -- mess with grid-based motion anyway. + show_parameter_hints = false, + parameter_hints_prefix = "", + other_hints_prefix = "//", + }, + }, + + server = { + standalone = false, + capabilities = capabilities, + on_attach = on_attach, + settings = lsp_settings.rust_analyzer, + }, +}) + +local luasnip = require 'luasnip' + +-- Put snippets in ./snippets/.snippets +require("luasnip.loaders.from_snipmate").lazy_load() + +local cmp = require 'cmp' +cmp.setup { + completion = { + autocomplete = false, + }, + snippet = { + expand = function(args) luasnip.lsp_expand(args.body) end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = 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' }), + [''] = 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" }, + }, +} diff --git a/neovim/init.vim b/neovim/init.vim deleted file mode 100644 index adfe577..0000000 --- a/neovim/init.vim +++ /dev/null @@ -1,482 +0,0 @@ -let &shell = '/bin/sh' -let g:python3_host_prog = expand('~/.virtualenvs/neovim3/bin/python') -let g:loaded_python_provider = 0 " Disable python2 support for plugins - -call plug#begin('~/.local/share/nvim/plugged') -if filereadable(expand("~/.config/nvim/os-plugins.vim")) - source ~/.config/nvim/os-plugins.vim -endif -Plug 'airblade/vim-gitgutter' -Plug 'airblade/vim-rooter' -Plug 'cespare/vim-toml', { 'branch': 'main' } -Plug 'chrisbra/unicode.vim' -Plug 'dense-analysis/ale' -Plug 'elixir-editors/vim-elixir' -Plug 'fatih/vim-go' -Plug 'Glench/Vim-Jinja2-Syntax' -Plug 'glts/vim-textobj-comment' -Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' } -Plug 'hrsh7th/nvim-cmp', { 'branch': 'main' } -Plug 'ianks/vim-tsx' -Plug 'jeetsukumaran/vim-buffergator' -Plug 'jiangmiao/auto-pairs' -Plug 'jjo/vim-cue' -Plug 'jparise/vim-graphql' -Plug 'junegunn/fzf.vim' -Plug 'junegunn/vim-easy-align' -Plug 'kana/vim-textobj-user' -Plug 'keith/swift.vim' -Plug 'L3MON4D3/LuaSnip' -Plug 'leafgarland/typescript-vim' -Plug 'ledger/vim-ledger' -Plug 'LnL7/vim-nix' -Plug 'MarcWeber/vim-addon-local-vimrc' -Plug 'mxw/vim-jsx' -Plug 'neovim/nvim-lspconfig' -Plug 'ntpeters/vim-better-whitespace' -Plug 'pangloss/vim-javascript' -Plug 'preservim/vim-markdown' -Plug 'qpkorr/vim-bufkill' -Plug 'rust-lang/rust.vim' -Plug 'saadparwaiz1/cmp_luasnip' -Plug 'scrooloose/nerdtree' -Plug 'simrat39/rust-tools.nvim' -Plug 'sirtaj/vim-openscad' -Plug 'tpope/vim-abolish' -Plug 'tpope/vim-bundler' -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-endwise' -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-rails' -Plug 'tpope/vim-repeat' -Plug 'tpope/vim-surround' -Plug 'udalov/kotlin-vim' -Plug 'urbit/hoon.vim' -Plug 'vim-python/python-syntax' -Plug 'vim-ruby/vim-ruby' -Plug 'wellle/context.vim' -Plug 'williamboman/nvim-lsp-installer', { 'branch': 'main' } -call plug#end() - -set number -set hidden - -colorscheme jdkaplan - -set expandtab -set tabstop=4 -set softtabstop=4 -set shiftwidth=4 -set smartindent -set formatoptions=crqnlj -set nofoldenable -set nojoinspaces - -set wrap -set linebreak -set nolist -set textwidth=0 -set wrapmargin=0 -set listchars=tab:>-,extends:>,precedes:<,nbsp:+,trail:- - -set ignorecase -set smartcase - -set cursorline - -set splitbelow -set splitright - -set modelines=0 -set lazyredraw -set updatetime=250 - -set shortmess+=I - -set virtualedit= -noremap k gk -noremap j gj - -map ; : -noremap ;; ; - -map ; :nohlsearch - -map ;h :wincmd h -map ;j :wincmd j -map ;k :wincmd k -map ;l :wincmd l - -map ;" :split -map ;% :vsplit -map ;0 :close -map ;1 :only - -map ;w :w -map ;q :q -map ;x :x - -map ;G :Git - -set wildignore+=*.swp,*~ - -map ;b :Buffers -map ;f :call fzf#run({'source': 'fd --hidden --type f', 'sink': 'e', 'options': '--multi'}) - -function! s:escape(path) - return substitute(a:path, ' ', '\\ ', 'g') -endfunction - -function! RgHandler(line) - let parts = split(a:line, ':') - let [fn, lno] = parts[0 : 1] - execute 'e '. s:escape(fn) - execute lno - normal! zz -endfunction - -map ;g :call fzf#run({ -\ 'source': 'rg --vimgrep --no-heading --smart-case --hidden --regexp '.shellescape(input('Pattern: ')), -\ 'sink': function('RgHandler'), -\ 'options': '--multi', -\}) -map ;* :call fzf#run({ -\ 'source': 'rg --vimgrep --no-heading --smart-case --hidden --regexp '.shellescape(expand('')), -\ 'sink': function('RgHandler'), -\ 'options': '--multi', -\}) - -command ALEOff :let b:ale_fix_on_save = 0 -let g:ale_sign_error = '!' -let g:ale_sign_warning = '?' -let g:ale_echo_msg_format = '[%linter%] %code: %%s' -let g:ale_fix_on_save = 1 -" Clear the default --enable-all because I disagree with too many linters. -let g:ale_go_golangci_lint_options='' -" Lint the whole package to reduce noise in dead code linters. -let g:ale_go_golangci_lint_package=1 -let g:ale_linters_explicit = 1 -let g:ale_linters = { -\ 'arduino': [ -\ 'clang-tidy', -\ ], -\ 'bash': [ -\ 'shellcheck', -\ ], -\ 'css': [ -\ 'stylelint', -\ ], -\ 'go': [ -\ 'golangci-lint', -\ ], -\ 'javascript': [ -\ 'eslint', -\ ], -\ 'proto': [ -\ 'protolint', -\ ], -\ 'python': [ -\ 'flake8', -\ 'mypy', -\ ], -\ 'ruby': [ -\ 'rubocop', -\ 'sorbet', -\ ], -\ 'sh': [ -\ 'shellcheck', -\ ], -\ 'typescript': [ -\ 'eslint', -\ ], -\ 'zsh': [ -\ 'shellcheck', -\ ], -\} -let g:ale_fixers = { -\ 'arduino': [ -\ 'clang-format', -\ ], -\ 'css': [ -\ 'prettier', -\ ], -\ 'elixir': [ -\ 'mix_format', -\ ], -\ 'html': [ -\ 'prettier', -\ ], -\ 'javascript': [ -\ 'eslint', -\ 'prettier', -\ ], -\ 'python': [ -\ 'black', -\ ], -\ 'ruby': [ -\ 'rubocop', -\ ], -\ 'scss': [ -\ 'prettier', -\ ], -\ 'typescript': [ -\ 'prettier', -\ ], -\} -nmap ;n (ale_next_wrap) -nmap ;N (ale_previous_wrap) -nmap e :lclose -nmap E :lopen - -let g:better_whitespace_enabled=1 -let g:better_whitespace_filetypes_blacklist=['diff'] -let g:strip_whitespace_on_save=1 -let g:strip_whitespace_confirm=0 -let g:better_whitespace_operator='' - -map t :NERDTreeToggle -noremap a :NERDTreeFind -noremap m :NERDTreeFind - -let g:python_highlight_all = 1 - -" Disable vim-go's gd mapping now that nvim-lspconfig uses it. -let g:go_def_mapping_enabled = 0 -let g:go_fmt_command = "gopls" -let g:go_highlight_build_constraints = 1 -let g:go_highlight_interfaces = 1 -let g:go_highlight_functions = 1 -let g:go_highlight_methods = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_structs = 1 -let g:go_highlight_types = 1 - -let g:buffergator_viewport_split_policy = 'B' -let g:buffergator_autoupdate = 1 -let g:buffergator_sort_regime = 'filepath' -let g:buffergator_display_regime = 'bufname' -let g:buffergator_show_full_directory_path = 0 -let g:buffergator_suppress_keymaps = 1 -let g:buffergator_autodismiss_on_select = 0 -map b :BuffergatorToggle - -let g:rooter_manual_only = 1 -let g:rooter_patterns = ['.root', '.git', '.git/'] -noremap cd :execute 'cd' fnameescape(FindRootDirectory()):pwd - -let g:AutoPairsMultilineClose = 0 -let g:AutoPairsShortcutBackInsert = '' -let g:AutoPairsShortcutToggle = '' - -let g:javascript_plugin_flow = 1 -let g:ale_javascript_flow_use_respect_pragma = 0 - -let g:jsx_ext_required = 1 - -let g:gitgutter_enabled = 0 -let g:gitgutter_map_keys = 0 -map g :GitGutterToggle -nmap ]h (GitGutterNextHunk) -nmap [h (GitGutterPrevHunk) - -command Crosshair :set virtualedit=all cursorcolumn -command NoCrosshair :set virtualedit= nocursorcolumn - -autocmd FileType css setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType eruby setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType html setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType javascript.jsx setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType javascript setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType jinja.html setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType jinja setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType json setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType proto setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType ruby setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType scss setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType typescript.tsx setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType typescript setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType xml setlocal ts=2 sts=2 sw=2 expandtab -autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab - -autocmd FileType markdown setlocal commentstring= -autocmd FileType hoon setlocal commentstring=::%s -autocmd FileType hurl setlocal commentstring=#%s - -set secure - -autocmd FileType markdown setlocal spell -autocmd FileType text setlocal spell -set spellcapcheck= - -autocmd BufNewFile,BufRead *.arb set filetype=ruby -autocmd BufNewFile,BufRead *.html.erb set filetype=eruby.html -autocmd BufNewFile,BufRead *.hurl set filetype=hurl - -autocmd FileType ledger nmap ' :call ledger#transaction_state_toggle(line('.'), ' !*') - -nmap ;cc :let @+=expand("%") -nmap ;cl :let @+=join([expand("%"), line(".")], ":") -nmap ;cg :let @+=join([expand("%"), line(".")], "#L") -nmap ;cp :let @+=expand("%:p") - -" For some reason, (neo)vim sees as , so bind that instead. -autocmd FileType html inoremap - -let g:Unicode_no_default_mappings = 1 -imap (UnicodeFuzzy) - -" https://vim.fandom.com/wiki/Search_for_visually_selected_text -vnoremap // y/\V=escape(@",'/\') - -" CTRL-L usually clears and redraws the screen. Might as well use it to reset -" the colorscheme too! -fun s:ResetScreen() - colorscheme jdkaplan - redraw -endfun -command ResetScreen call s:ResetScreen() -nnoremap :ResetScreen - -let g:vim_markdown_folding_disabled = 1 - -let g:context_enabled = 0 -map cc :ContextToggleWindow -map cp :ContextPeek - -set completeopt=menu,menuone,noselect - -xmap ga (EasyAlign) -nmap ga (EasyAlign) - -lua < - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local opts = { noremap=true, silent=true } - - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) - buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap('n', 'R', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - buf_set_keymap('v', 'ca', 'lua vim.lsp.buf.range_code_action()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'd', 'lua vim.diagnostic.open_float()', opts) - buf_set_keymap('n', 'j', 'lua vim.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'k', 'lua vim.diagnostic.goto_prev()', opts) - buf_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) - buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) - - vim.api.nvim_command [[autocmd BufWritePre lua vim.lsp.buf.format()]] -end - -local lsp_installer = require('nvim-lsp-installer') -lsp_installer.setup({}) - -local lsp_settings = { - gopls = {}, - pyright = {}, - rust_analyzer = { - ["rust-analyzer"] = { - checkOnSave = { - command = "clippy", - }, - }, - }, - solargraph = {}, - tsserver = {}, -} - -for _, server in ipairs(lsp_installer.get_installed_servers()) do - -- rust-analyzer will be configured by rust-tools. - if server.name == 'rust_analyzer' then goto continue end - - nvim_lsp[server.name].setup { - on_attach = on_attach, - settings = lsp_settings[server.name], - capabilities = capabilities, - } - ::continue:: -end - -require('rust-tools').setup({ - tools = { - autoSetHints = true, - hover_with_actions = false, - inlay_hints = { - only_current_line = true, - -- Parameter hints are more annoying than useful here. Neovim can't show - -- virtual text in the middle of the line like other editors do. It would - -- mess with grid-based motion anyway. - show_parameter_hints = false, - parameter_hints_prefix = "", - other_hints_prefix = "//", - }, - }, - - server = { - standalone = false, - capabilities = capabilities, - on_attach = on_attach, - settings = lsp_settings.rust_analyzer, - }, -}) - -local luasnip = require 'luasnip' - --- Put snippets in ./snippets/.snippets -require("luasnip.loaders.from_snipmate").lazy_load() - -local cmp = require 'cmp' -cmp.setup { - completion = { - autocomplete = false, - }, - snippet = { - expand = function(args) luasnip.lsp_expand(args.body) end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = 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' }), - [''] = 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" }, - }, -} -LSPCONFIG diff --git a/neovim/lazy-lock.json b/neovim/lazy-lock.json new file mode 100644 index 0000000..749739b --- /dev/null +++ b/neovim/lazy-lock.json @@ -0,0 +1,37 @@ +{ + "LuaSnip": { "branch": "master", "commit": "b4bc24c4925aeb05fd47d2ee9b24b7f73f5d7e32" }, + "aerial.nvim": { "branch": "master", "commit": "d8f2699f7ae0e5eb62424d7b2ad80ce30179ee92" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "context.vim": { "branch": "master", "commit": "c06541451aa94957c1c07a9f8a7130ad97d83a65" }, + "fzf": { "branch": "master", "commit": "94999101e358385f3ca67a6ec9512f549196b802" }, + "gitsigns.nvim": { "branch": "main", "commit": "814158f6c4b1724c039fcefe79b0be72c9131c2d" }, + "lazy.nvim": { "branch": "main", "commit": "aba872ec78ffe7f7367764ab0fff6f0170421fde" }, + "lush.nvim": { "branch": "main", "commit": "fb148c0082488ba048f681792c4044e3229fd1a6" }, + "nerdtree": { "branch": "master", "commit": "fc85a6f07c2cd694be93496ffad75be126240068" }, + "nui.nvim": { "branch": "main", "commit": "698e75814cd7c56b0dd8af4936bcef2d13807f3c" }, + "null-ls.nvim": { "branch": "main", "commit": "08bb00c7c2cd58c72e02cf54e4b9cbfe14b03e09" }, + "nvim-autopairs": { "branch": "master", "commit": "7747bbae60074acf0b9e3a4c13950be7a2dff444" }, + "nvim-cmp": { "branch": "main", "commit": "d153771162bd9795d9f7142df5c674b61066a585" }, + "nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" }, + "nvim-lspconfig": { "branch": "master", "commit": "df58d91c9351a9dc5be6cf8d54f49ab0d9a64e73" }, + "nvim-surround": { "branch": "main", "commit": "219bd66585aa467b1c90fd01b54a2a423aaed4ab" }, + "nvim-treesitter": { "branch": "master", "commit": "680807fa6a482c639119098bc48ca3831c66db13" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "35a60f093fa15a303874975f963428a5cd24e4a0" }, + "openingh.nvim": { "branch": "main", "commit": "374c081409dc238018cd986410f16190d8f9f680" }, + "plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, + "prettier.nvim": { "branch": "main", "commit": "08f7f08fae57fd970c7470d883c9127f172bd9e6" }, + "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, + "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, + "unicode.vim": { "branch": "master", "commit": "c8aa12b1e2e1b6254885b12bdb239ce6c885fdb1" }, + "vim-abolish": { "branch": "master", "commit": "cb3dcb220262777082f63972298d57ef9e9455ec" }, + "vim-addon-local-vimrc": { "branch": "master", "commit": "28514f4aedba1fd824fad8ccbd65fb41bb8057f0" }, + "vim-better-whitespace": { "branch": "master", "commit": "1b22dc57a2751c7afbc6025a7da39b7c22db635d" }, + "vim-bufkill": { "branch": "master", "commit": "3113181d0c1bfb8719f3ddcd2e2f35a8d763d1e5" }, + "vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" }, + "vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" }, + "vim-endwise": { "branch": "master", "commit": "e714ac3bcfd5a90038de49c3254eded7c70ae3c3" }, + "vim-fugitive": { "branch": "master", "commit": "5f0d280b517cacb16f59316659966c7ca5e2bea2" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" } +} \ No newline at end of file diff --git a/neovim/linux-plugins.vim b/neovim/linux-plugins.vim deleted file mode 100644 index 2f099e8..0000000 --- a/neovim/linux-plugins.vim +++ /dev/null @@ -1 +0,0 @@ -Plug 'junegunn/fzf' diff --git a/neovim/lua/jdkaplan/cool_theme.lua b/neovim/lua/jdkaplan/cool_theme.lua new file mode 100644 index 0000000..ce858cf --- /dev/null +++ b/neovim/lua/jdkaplan/cool_theme.lua @@ -0,0 +1,201 @@ +local lush = require('lush') +local hsl = lush.hsl + +local theme = lush(function(injected_functions) + -- Required alias for treesitter groups. + -- https://github.com/rktjmp/lush.nvim/issues/109 + local sym = injected_functions.sym + + return { + ColorColumn { bg = '#5F0000' }, -- Columns set with 'colorcolumn' + Conceal {}, -- Placeholder characters substituted for concealed text (see 'conceallevel') + Cursor { reverse = true }, -- Character under the cursor + lCursor {}, -- Character under the cursor when |language-mapping| is used (see 'guicursor') + CursorIM {}, -- Like Cursor, but used when in IME mode |CursorIM| + CursorLine { bg = '#000000' }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. + CursorColumn { CursorLine }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + Directory { fg = '#007CFF'}, -- Directory names (and other special names in listings) + DiffAdd { bg = '#005F00' }, -- Diff mode: Added line |diff.txt| + DiffChange { bg = '#00005F' }, -- Diff mode: Changed line |diff.txt| + DiffDelete { bg = '#5f0000' }, -- Diff mode: Deleted line |diff.txt| + DiffText { bg = '#5F00D7', bold = true }, -- Diff mode: Changed text within a changed line |diff.txt| + TermCursor { Cursor }, -- Cursor in a focused terminal + TermCursorNC {}, -- Cursor in an unfocused terminal + ErrorMsg { fg = '#D70000' }, -- Error messages on the command line + VertSplit { fg = '#4E4E4E' }, -- Column separating vertically split windows + Folded { fg = '#F0C674', bg = '#282A2E'}, -- Line used for closed folds + FoldColumn { fg = '#8ABEB7', bg = '#6C6C6C' }, -- 'foldcolumn' + SignColumn { FoldColumn }, -- Column where |signs| are displayed + LineNr { fg = '#a7a7a7' }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + CursorLineNr { fg = '#FFD787' }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + MatchParen { fg = '#FF875F' }, -- Character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| + ModeMsg { bold = true }, -- 'showmode' message (e.g., "-- INSERT -- ") + MsgArea {}, -- Area for messages and cmdline + MoreMsg { bold = true }, -- |more-prompt| + NonText { fg = '#87AFD7', bg = '#444444' }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. + EndOfBuffer { NonText }, -- Filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + Normal { fg = "#ffffff" }, -- Normal text + NormalFloat { bg = "#111111" }, -- Normal text in floating windows. + NormalNC {}, -- normal text in non-current windows + Pmenu { bg = "#111111" }, -- Popup menu: Normal item. + PmenuSel { bg = "#000000" }, -- Popup menu: Selected item. + PmenuSbar { bg = "#000000" }, -- Popup menu: Scrollbar. + PmenuThumb { bg = "#ffffff" }, -- Popup menu: Thumb of the scrollbar. + Question { fg = '#87FFAF' }, -- |hit-enter| prompt and yes/no questions + IncSearch { reverse = true }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + Search { fg = '#000000', bg = '#D7AF00' }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + QuickFixLine { Search }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + Substitute { Search }, -- |:substitute| replacement text highlighting + SpecialKey { fg = '#84D45F' }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| + SpellBad { underline = true }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. + SpellCap { SpellBad }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. + SpellLocal { SpellBad }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + SpellRare { SpellBad }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + StatusLine { fg = '#FFFFFF', bg = '#444444' }, -- Status line of current window + StatusLineNC { fg = '#6D7073', bg = '#303030' }, -- Status lines of not-current windows. Note: If this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + MsgSeparator { StatusLine }, -- Separator for scrolled messages, `msgsep` flag of 'display' + TabLine {}, -- Tab pages line, not active tab page label + TabLineFill {}, -- Tab pages line, where there are no labels + TabLineSel {}, -- Tab pages line, active tab page label + Title {}, -- Titles for output from ":set all", ":autocmd" etc. + Visual { bg = '#3A3A3A' }, -- Visual mode selection + VisualNOS {}, -- Visual mode selection when vim is "Not Owning the Selection". + WarningMsg { fg = '#FFD700' }, -- Warning messages + Whitespace { fg = '#4E4E4E' }, -- "nbsp", "space", "tab" and "trail" in 'listchars' + Winseparator { VertSplit }, -- Separator between window splits. Inherts from |hl-VertSplit| by default, which it will replace eventually. + WildMenu { fg = '#282A2E', bg = '#F0C674' }, -- Current match in 'wildmenu' completion + + Comment { fg = '#AFAFAF' }, -- Any comment + + Constant { fg = '#AF87FF' }, -- (*) Any constant + String { fg = '#D7AF00' }, -- A string constant: "this is a string" + Character { Constant }, -- A character constant: 'c', '\n' + Number { fg = '#FF8700' }, -- A number constant: 234, 0xff + Boolean { Constant }, -- A boolean constant: TRUE, false + Float { Number }, -- A floating point constant: 2.3e10 + + Identifier { Normal }, -- (*) Any variable name + Function { fg = '#00D7FF' }, -- Function name (also: methods for classes) + + Statement { fg = '#5FD75F' }, -- (*) Any statement + Conditional { Statement }, -- if, then, else, endif, switch, etc. + Repeat { Statement }, -- for, do, while, etc. + Label { Statement }, -- case, default, etc. + Operator { Statement }, -- "sizeof", "+", "*", etc. + Keyword { Statement }, -- any other keyword + Exception { Statement }, -- try, catch, throw + + PreProc { Statement }, -- (*) Generic Preprocessor + Include { Statement }, -- Preprocessor #include + Define { Statement }, -- Preprocessor #define + Macro { Statement }, -- Same as Define + PreCondit { Statement }, -- Preprocessor #if, #else, #endif, etc. + + Type { fg = '#D7D700' }, -- (*) int, long, char, etc. + StorageClass { Type }, -- static, register, volatile, etc. + Structure { Type }, -- struct, union, enum, etc. + Typedef { Type }, -- A typedef + + Special { fg = '#FFFFFF' }, -- (*) Any special symbol + SpecialChar { Special }, -- Special character in a constant + Tag { Special }, -- You can use CTRL-] on this + Delimiter { Special }, -- Character that needs attention + SpecialComment { Special }, -- Special things inside a comment (e.g. '\n') + Debug { Special }, -- Debugging statements + + Underlined { gui = "underline" }, -- Text that stands out, HTML links + Ignore { fg = '#000000' }, -- Left blank, hidden |hl-Ignore| (NOTE: May be invisible here in template) + Error { fg = '#EEEEEE', bg = '#AF0000' }, -- Any erroneous construct + Todo { fg = '#D70000' }, -- Anything that needs extra attention; mostly the keywords TODO FIXME and XXX + + LspReferenceText {} , -- Used for highlighting "text" references + LspReferenceRead {} , -- Used for highlighting "read" references + LspReferenceWrite {} , -- Used for highlighting "write" references + LspCodeLens {} , -- Used to color the virtual text of the codelens. See |nvim_buf_set_extmark()|. + LspCodeLensSeparator {} , -- Used to color the seperator between two or more code lens. + LspSignatureActiveParameter { bold = true } , -- Used to highlight the active parameter in the signature help. See |vim.lsp.handlers.signature_help()|. + + DiagnosticError {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticWarn {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticInfo {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticHint {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticVirtualTextError { fg = '#A54242' } , -- Used for "Error" diagnostic virtual text. + DiagnosticVirtualTextWarn { fg = '#DE935F' } , -- Used for "Warn" diagnostic virtual text. + DiagnosticVirtualTextInfo { fg = '#5F819D' } , -- Used for "Info" diagnostic virtual text. + DiagnosticVirtualTextHint { fg = '#777777' } , -- Used for "Hint" diagnostic virtual text. + DiagnosticUnderlineError { underline = true } , -- Used to underline "Error" diagnostics. + DiagnosticUnderlineWarn { underline = true } , -- Used to underline "Warn" diagnostics. + DiagnosticUnderlineInfo { underline = true } , -- Used to underline "Info" diagnostics. + DiagnosticUnderlineHint { underline = true } , -- Used to underline "Hint" diagnostics. + DiagnosticFloatingError { DiagnosticVirtualTextError } , -- Used to color "Error" diagnostic messages in diagnostics float. See |vim.diagnostic.open_float()| + DiagnosticFloatingWarn { DiagnosticVirtualTextWarn } , -- Used to color "Warn" diagnostic messages in diagnostics float. + DiagnosticFloatingInfo { DiagnosticVirtualTextInfo } , -- Used to color "Info" diagnostic messages in diagnostics float. + DiagnosticFloatingHint { DiagnosticVirtualTextHint } , -- Used to color "Hint" diagnostic messages in diagnostics float. + DiagnosticSignError { DiagnosticVirtualTextError } , -- Used for "Error" signs in sign column. + DiagnosticSignWarn { DiagnosticVirtualTextWarn } , -- Used for "Warn" signs in sign column. + DiagnosticSignInfo { DiagnosticVirtualTextInfo } , -- Used for "Info" signs in sign column. + DiagnosticSignHint { DiagnosticVirtualTextHint } , -- Used for "Hint" signs in sign column. + + -- lewis6991/gitsigns.nvim + GitSignsAdd { bg = '#328e30', fg = '#FFFFFF' }, + GitSignsChange { bg = '#295493', fg = '#FFFFFF' }, + GitSignsDelete { bg = '#af3140', fg = '#FFFFFF' }, + GitSignsCurrentLineBlame { CursorLine, fg = '#81aeea' }, + + -- For :Lushify to work, the groups have to be spelled as `sym` called + -- on a string literal. + + -- These match the default highlight groups from regex highlighting. + sym"@text.literal" { Comment }, + sym"@text.reference" { Identifier }, + sym"@text.title" { Title }, + sym"@text.uri" { Underlined }, + sym"@text.underline" { Underlined }, + sym"@text.todo" { Todo }, + sym"@comment" { Comment }, + sym"@punctuation" { Delimiter }, + sym"@constant" { Constant }, + sym"@constant.builtin" { Constant }, + sym"@constant.macro" { Define }, + sym"@define" { Define }, + sym"@macro" { Macro }, + sym"@string" { String }, + sym"@string.escape" { SpecialChar }, + sym"@string.special" { SpecialChar }, + sym"@character" { Character }, + sym"@character.special" { SpecialChar }, + sym"@number" { Number }, + sym"@boolean" { Boolean }, + sym"@float" { Float }, + sym"@function" { Function }, + sym"@function.builtin" { Function }, + sym"@function.macro" { Macro }, + sym"@parameter" { Identifier }, + sym"@method" { Function }, + sym"@field" { Identifier }, + sym"@property" { Identifier }, + sym"@constructor" { Special }, + sym"@conditional" { Conditional }, + sym"@repeat" { Repeat }, + sym"@label" { Label }, + sym"@operator" { Operator }, + sym"@keyword" { Keyword }, + sym"@exception" { Exception }, + sym"@variable" { Identifier }, + sym"@type" { Type }, + sym"@type.definition" { Typedef }, + sym"@storageclass" { StorageClass }, + sym"@structure" { Structure }, + sym"@namespace" { Identifier }, + sym"@include" { Include }, + sym"@preproc" { PreProc }, + sym"@debug" { Debug }, + + -- These differ from regex highlighting. Sometimes this is an override, + -- and sometimes the equivalent base highlight group doesn't exist. + sym"@tag" { Keyword }, + sym"@tag.attribute" { Type }, + } +end) + +return theme diff --git a/neovim/lua/jdkaplan/warm_theme.lua b/neovim/lua/jdkaplan/warm_theme.lua new file mode 100644 index 0000000..cd81c47 --- /dev/null +++ b/neovim/lua/jdkaplan/warm_theme.lua @@ -0,0 +1,201 @@ +local lush = require('lush') +local hsl = lush.hsl + +local theme = lush(function(injected_functions) + -- Required alias for treesitter groups. + -- https://github.com/rktjmp/lush.nvim/issues/109 + local sym = injected_functions.sym + + return { + ColorColumn { bg = '#5F0000' }, -- Columns set with 'colorcolumn' + Conceal {}, -- Placeholder characters substituted for concealed text (see 'conceallevel') + Cursor { reverse = true }, -- Character under the cursor + lCursor {}, -- Character under the cursor when |language-mapping| is used (see 'guicursor') + CursorIM {}, -- Like Cursor, but used when in IME mode |CursorIM| + CursorLine { bg = '#E6E6E6' }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set. + CursorColumn { CursorLine }, -- Screen-column at the cursor, when 'cursorcolumn' is set. + Directory { fg = '#1B15FD' }, -- Directory names (and other special names in listings) + DiffAdd { bg = '#e5ffe5' }, -- Diff mode: Added line |diff.txt| + DiffChange { bg = '#d8e7ff' }, -- Diff mode: Changed line |diff.txt| + DiffDelete { bg = '#ffe5e8' }, -- Diff mode: Deleted line |diff.txt| + DiffText { bg = '#b2cfff', bold = true }, -- Diff mode: Changed text within a changed line |diff.txt| + TermCursor { Cursor }, -- Cursor in a focused terminal + TermCursorNC {}, -- Cursor in an unfocused terminal + ErrorMsg {}, -- Error messages on the command line + VertSplit { fg = '#C6C6C6' }, -- Column separating vertically split windows + Folded {}, -- Line used for closed folds + FoldColumn { fg = '#337ADA', bg = '#C6C6C6' }, -- 'foldcolumn' + SignColumn { fg = '#000000', bg = '#C6C6C6' }, -- Column where |signs| are displayed + LineNr { fg = '#a6a6a6' }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + CursorLineNr { fg = '#1B15FD' }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + MatchParen { fg = '#FF5F00' }, -- Character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| + ModeMsg { bold = true }, -- 'showmode' message (e.g., "-- INSERT -- ") + MsgArea {}, -- Area for messages and cmdline + MoreMsg { bold = true }, -- |more-prompt| + NonText { fg = '#8EB1D5', bg = '#C6C6C6' }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. + EndOfBuffer { NonText }, -- Filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + Normal { fg = "#000000" }, -- Normal text + NormalFloat { bg = "#eeeeee" }, -- Normal text in floating windows. + NormalNC {}, -- normal text in non-current windows + Pmenu { bg = "#eeeeee" }, -- Popup menu: Normal item. + PmenuSel { bg = "#cccccc" }, -- Popup menu: Selected item. + PmenuSbar { bg = "#aaaaaa" }, -- Popup menu: Scrollbar. + PmenuThumb { bg = "#000000" }, -- Popup menu: Thumb of the scrollbar. + Question { fg = '#005F00' }, -- |hit-enter| prompt and yes/no questions + IncSearch { reverse = true }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + Search { fg = '#000000', bg = '#D7AF00' }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + QuickFixLine { Search }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there. + Substitute { Search }, -- |:substitute| replacement text highlighting + SpecialKey { fg = '#84D45F' }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace| + SpellBad { underline = true }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise. + SpellCap { SpellBad }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise. + SpellLocal { SpellBad }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise. + SpellRare { SpellBad }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise. + StatusLine { fg = '#000000', bg = '#C6C6C6' }, -- Status line of current window + StatusLineNC { fg = '#808080', bg = '#C6C6C6' }, -- Status lines of not-current windows. Note: If this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window. + MsgSeparator { StatusLine }, -- Separator for scrolled messages, `msgsep` flag of 'display' + TabLine {}, -- Tab pages line, not active tab page label + TabLineFill {}, -- Tab pages line, where there are no labels + TabLineSel {}, -- Tab pages line, active tab page label + Title {}, -- Titles for output from ":set all", ":autocmd" etc. + Visual { reverse = true }, -- Visual mode selection + VisualNOS {}, -- Visual mode selection when vim is "Not Owning the Selection". + WarningMsg { fg = '#FFD700' }, -- Warning messages + Whitespace { fg = '#808080' }, -- "nbsp", "space", "tab" and "trail" in 'listchars' + Winseparator { VertSplit }, -- Separator between window splits. Inherts from |hl-VertSplit| by default, which it will replace eventually. + WildMenu { fg = '#282A2E', bg = '#F0C674' }, -- Current match in 'wildmenu' completion + + Comment { fg = '#666666' }, -- Any comment + + Constant { fg = '#876FFF' }, -- (*) Any constant + String { fg = '#005F00' }, -- A string constant: "this is a string" + Character { Constant }, -- A character constant: 'c', '\n' + Number { fg = '#876FFF' }, -- A number constant: 234, 0xff + Boolean { Constant }, -- A boolean constant: TRUE, false + Float { Number }, -- A floating point constant: 2.3e10 + + Identifier { Normal }, -- (*) Any variable name + Function { fg = '#D75F00' }, -- Function name (also: methods for classes) + + Statement { fg = '#880000' }, -- (*) Any statement + Conditional { Statement }, -- if, then, else, endif, switch, etc. + Repeat { Statement }, -- for, do, while, etc. + Label { Statement }, -- case, default, etc. + Operator { Statement }, -- "sizeof", "+", "*", etc. + Keyword { Statement }, -- any other keyword + Exception { Statement }, -- try, catch, throw + + PreProc { Statement }, -- (*) Generic Preprocessor + Include { Statement }, -- Preprocessor #include + Define { Statement }, -- Preprocessor #define + Macro { Statement }, -- Same as Define + PreCondit { Statement }, -- Preprocessor #if, #else, #endif, etc. + + Type { fg = '#8700D7' }, -- (*) int, long, char, etc. + StorageClass { Type }, -- static, register, volatile, etc. + Structure { Type }, -- struct, union, enum, etc. + Typedef { Type }, -- A typedef + + Special { fg = '#000000' }, -- (*) Any special symbol + SpecialChar { Special }, -- Special character in a constant + Tag { Special }, -- You can use CTRL-] on this + Delimiter { Special }, -- Character that needs attention + SpecialComment { Special }, -- Special things inside a comment (e.g. '\n') + Debug { Special }, -- Debugging statements + + Underlined { gui = "underline" }, -- Text that stands out, HTML links + Ignore { fg = '#E4E4E4' }, -- Left blank, hidden |hl-Ignore| (NOTE: May be invisible here in template) + Error { fg = '#000000', bg = '#FF5F00' }, -- Any erroneous construct + Todo { fg = '#FF0000' }, -- Anything that needs extra attention; mostly the keywords TODO FIXME and XXX + + LspReferenceText {} , -- Used for highlighting "text" references + LspReferenceRead {} , -- Used for highlighting "read" references + LspReferenceWrite {} , -- Used for highlighting "write" references + LspCodeLens {} , -- Used to color the virtual text of the codelens. See |nvim_buf_set_extmark()|. + LspCodeLensSeparator {} , -- Used to color the seperator between two or more code lens. + LspSignatureActiveParameter { bold = true } , -- Used to highlight the active parameter in the signature help. See |vim.lsp.handlers.signature_help()|. + + DiagnosticError {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticWarn {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticInfo {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticHint {} , -- Used as the base highlight group. Other Diagnostic highlights link to this by default (except Underline) + DiagnosticVirtualTextError { fg = '#F32840'} , -- Used for "Error" diagnostic virtual text. + DiagnosticVirtualTextWarn { fg = '#F06D14'} , -- Used for "Warn" diagnostic virtual text. + DiagnosticVirtualTextInfo { fg = '#4E85DA'} , -- Used for "Info" diagnostic virtual text. + DiagnosticVirtualTextHint { fg = '#015F00'} , -- Used for "Hint" diagnostic virtual text. + DiagnosticUnderlineError { underline = true } , -- Used to underline "Error" diagnostics. + DiagnosticUnderlineWarn { underline = true } , -- Used to underline "Warn" diagnostics. + DiagnosticUnderlineInfo { underline = true } , -- Used to underline "Info" diagnostics. + DiagnosticUnderlineHint { underline = true } , -- Used to underline "Hint" diagnostics. + DiagnosticFloatingError { DiagnosticVirtualTextError } , -- Used to color "Error" diagnostic messages in diagnostics float. See |vim.diagnostic.open_float()| + DiagnosticFloatingWarn { DiagnosticVirtualTextWarn } , -- Used to color "Warn" diagnostic messages in diagnostics float. + DiagnosticFloatingInfo { DiagnosticVirtualTextInfo } , -- Used to color "Info" diagnostic messages in diagnostics float. + DiagnosticFloatingHint { DiagnosticVirtualTextHint } , -- Used to color "Hint" diagnostic messages in diagnostics float. + DiagnosticSignError { DiagnosticVirtualTextError } , -- Used for "Error" signs in sign column. + DiagnosticSignWarn { DiagnosticVirtualTextWarn } , -- Used for "Warn" signs in sign column. + DiagnosticSignInfo { DiagnosticVirtualTextInfo } , -- Used for "Info" signs in sign column. + DiagnosticSignHint { DiagnosticVirtualTextHint } , -- Used for "Hint" signs in sign column. + + -- lewis6991/gitsigns.nvim + GitSignsAdd { bg = '#90d68f', fg = '#FFFFFF' }, + GitSignsChange { bg = '#80abed', fg = '#FFFFFF' }, + GitSignsDelete { bg = '#f9acb5', fg = '#FFFFFF' }, + GitSignsCurrentLineBlame { CursorLine, fg = '#337ADA' }, + + -- For :Lushify to work, the groups have to be spelled as `sym` called + -- on a string literal. + + -- These match the default highlight groups from regex highlighting. + sym"@text.literal" { Comment }, + sym"@text.reference" { Identifier }, + sym"@text.title" { Title }, + sym"@text.uri" { Underlined }, + sym"@text.underline" { Underlined }, + sym"@text.todo" { Todo }, + sym"@comment" { Comment }, + sym"@punctuation" { Delimiter }, + sym"@constant" { Constant }, + sym"@constant.builtin" { Constant }, + sym"@constant.macro" { Define }, + sym"@define" { Define }, + sym"@macro" { Macro }, + sym"@string" { String }, + sym"@string.escape" { SpecialChar }, + sym"@string.special" { SpecialChar }, + sym"@character" { Character }, + sym"@character.special" { SpecialChar }, + sym"@number" { Number }, + sym"@boolean" { Boolean }, + sym"@float" { Float }, + sym"@function" { Function }, + sym"@function.builtin" { Function }, + sym"@function.macro" { Macro }, + sym"@parameter" { Identifier }, + sym"@method" { Function }, + sym"@field" { Identifier }, + sym"@property" { Identifier }, + sym"@constructor" { Special }, + sym"@conditional" { Conditional }, + sym"@repeat" { Repeat }, + sym"@label" { Label }, + sym"@operator" { Operator }, + sym"@keyword" { Keyword }, + sym"@exception" { Exception }, + sym"@variable" { Identifier }, + sym"@type" { Type }, + sym"@type.definition" { Typedef }, + sym"@storageclass" { StorageClass }, + sym"@structure" { Structure }, + sym"@namespace" { Identifier }, + sym"@include" { Include }, + sym"@preproc" { PreProc }, + sym"@debug" { Debug }, + + -- These differ from regex highlighting. Sometimes this is an override, + -- and sometimes the equivalent base highlight group doesn't exist. + sym"@tag" { Keyword }, + sym"@tag.attribute" { Type }, + } +end) + +return theme diff --git a/neovim/postinstall b/neovim/postinstall index c7766d5..6e15a37 100755 --- a/neovim/postinstall +++ b/neovim/postinstall @@ -4,6 +4,3 @@ set -exuo pipefail [ -d ~/.virtualenvs/neovim3 ] || python3 -m venv ~/.virtualenvs/neovim3 ~/.virtualenvs/neovim3/bin/python -c 'import pynvim' || ~/.virtualenvs/neovim3/bin/pip install pynvim - -# https://github.com/junegunn/vim-plug/wiki/tips#install-plugins-on-the-command-line -nvim -es -u ~/.config/nvim/init.vim -i NONE -c "PlugInstall" -c "qa"