1
0
Fork 0

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.
This commit is contained in:
Jeremy Kaplan 2022-12-30 21:57:24 -08:00
commit 71d8737447
17 changed files with 1045 additions and 491 deletions

View file

@ -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"

View file

@ -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/

View file

@ -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

View file

@ -1 +0,0 @@
../vim/colors

1
neovim/colors/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
jdkaplan-temp.lua

View file

@ -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)

View file

@ -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)

1
neovim/colors/jdkaplan.vim Symbolic link
View file

@ -0,0 +1 @@
../../vim/colors/jdkaplan.vim

View file

@ -1 +0,0 @@
Plug '/usr/local/opt/fzf'

View file

@ -1 +0,0 @@
setlocal shiftwidth=2

574
neovim/init.lua Normal file
View file

@ -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 = {
{ "<C-G><C-F>", "<Plug>(UnicodeFuzzy)<cr>", 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", "<Plug>(EasyAlign)")
vim.keymap.set("n", "ga", "<Plug>(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", "<leader>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 = ' <author> <author_time:%Y-%m-%d> <summary>',
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 = {
{ "<leader>t", ":NERDTreeToggle<cr>" },
{ "<leader>a", ":NERDTreeFind<cr>" },
},
},
{
"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', '<Space>f', find_files)
vim.keymap.set('n', '<Space>g', builtin.live_grep)
vim.keymap.set('n', '<Space>b', builtin.buffers)
vim.keymap.set('n', '<Space>*', builtin.grep_string)
vim.keymap.set('n', '<Space>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 = {
{ "<leader>m", "<cmd>AerialToggle<cr>" },
{ "<leader>n", "<cmd>AerialNavToggle<cr>" },
},
},
"tpope/vim-abolish",
"tpope/vim-commentary",
"tpope/vim-endwise",
{
"tpope/vim-fugitive",
init = function()
vim.keymap.set("", "<Space>G", ":Git<Space>")
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("", ";G", ":Git<Space>")
end,
},
"tpope/vim-repeat",
{
"wellle/context.vim",
lazy = false,
init = function()
vim.g.context_enabled = 0
vim.keymap.set("", "<leader>cc", ":ContextToggleWindow<CR>", { silent = true })
vim.keymap.set("", "<leader>cp", ":ContextPeek<CR>", { 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 = {
{ "<Leader>gh", "V:OpenInGHFile<CR>", mode = {"n"} },
{ "<Leader>gh", ":OpenInGHFile<CR>", 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("", "<Space>wh", ":wincmd h<CR>")
vim.keymap.set("", "<Space>wj", ":wincmd j<CR>")
vim.keymap.set("", "<Space>wk", ":wincmd k<CR>")
vim.keymap.set("", "<Space>wl", ":wincmd l<CR>")
vim.keymap.set("", '<Space>w"', ":split<CR>")
vim.keymap.set("", '<Space>w%', ":vsplit<CR>")
vim.keymap.set("", '<Space>w0', ":close<CR>")
vim.keymap.set("", '<Space>w1', ":only<CR>")
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("", ";h", ":wincmd h<CR>")
vim.keymap.set("", ";j", ":wincmd j<CR>")
vim.keymap.set("", ";k", ":wincmd k<CR>")
vim.keymap.set("", ";l", ":wincmd l<CR>")
vim.keymap.set("", ';"', ":split<CR>")
vim.keymap.set("", ';%', ":vsplit<CR>")
vim.keymap.set("", ';0', ":close<CR>")
vim.keymap.set("", ';1', ":only<CR>")
vim.keymap.set("", '<Leader>w', ":w<CR>")
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("", ';w', ":w<CR>")
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("", ';;', ";")
vim.keymap.set("", "<Space><Space>", ":nohlsearch<CR>")
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("", ";<Space>", ":nohlsearch<CR>")
vim.keymap.set("n", "<Space>cc", ':let @+=expand("%")<CR>')
vim.keymap.set("n", "<Space>cl", ':let @+=join([expand("%"), line(".")], ":")<CR>')
vim.keymap.set("n", "<Space>cp", ':let @+=expand("%:p")<CR>')
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("n", ";cc", ':let @+=expand("%")<CR>')
vim.keymap.set("n", ";cl", ':let @+=join([expand("%"), line(".")], ":")<CR>')
vim.keymap.set("n", ";cp", ':let @+=expand("%:p")<CR>')
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", "<C-l>", 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 <C-x><C-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<Leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<Leader>R', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<Leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('v', '<Leader>ca', '<cmd>lua vim.lsp.buf.range_code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<Leader>d', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
buf_set_keymap('n', '<Leader>j', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<Leader>k', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', '<Leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
vim.api.nvim_command [[autocmd BufWritePre <buffer> 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/<filetype>.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({
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<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" },
},
}

View file

@ -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 <silent> k gk
noremap <silent> j gj
map ; :
noremap ;; ;
map <silent> ;<Space> :nohlsearch<CR>
map <silent> ;h :wincmd h<CR>
map <silent> ;j :wincmd j<CR>
map <silent> ;k :wincmd k<CR>
map <silent> ;l :wincmd l<CR>
map <silent> ;" :split<CR>
map <silent> ;% :vsplit<CR>
map <silent> ;0 :close<CR>
map <silent> ;1 :only<CR>
map <silent> ;w :w<CR>
map <silent> ;q :q<CR>
map <silent> ;x :x<CR>
map ;G :Git<Space>
set wildignore+=*.swp,*~
map <silent> ;b :Buffers<CR>
map <silent> ;f :call fzf#run({'source': 'fd --hidden --type f', 'sink': 'e', 'options': '--multi'})<CR>
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 <silent> ;g :call fzf#run({
\ 'source': 'rg --vimgrep --no-heading --smart-case --hidden --regexp '.shellescape(input('Pattern: ')),
\ 'sink': function('RgHandler'),
\ 'options': '--multi',
\})<CR>
map <silent> ;* :call fzf#run({
\ 'source': 'rg --vimgrep --no-heading --smart-case --hidden --regexp '.shellescape(expand('<cword>')),
\ 'sink': function('RgHandler'),
\ 'options': '--multi',
\})<CR>
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 <silent> ;n <Plug>(ale_next_wrap)
nmap <silent> ;N <Plug>(ale_previous_wrap)
nmap <silent> <Leader>e :lclose<CR>
nmap <silent> <Leader>E :lopen<CR>
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 <silent> <leader>t :NERDTreeToggle<CR>
noremap <silent> <leader>a :NERDTreeFind<CR>
noremap <leader>m :NERDTreeFind<Space>
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 <silent> <leader>b :BuffergatorToggle<CR>
let g:rooter_manual_only = 1
let g:rooter_patterns = ['.root', '.git', '.git/']
noremap <silent> <leader>cd :execute 'cd' fnameescape(FindRootDirectory())<CR>:pwd<CR>
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 <silent> <leader>g :GitGutterToggle<CR>
nmap <silent> ]h <Plug>(GitGutterNextHunk)
nmap <silent> [h <Plug>(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=<!--%s-->
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 <silent> <leader>' :call ledger#transaction_state_toggle(line('.'), ' !*')<CR>
nmap ;cc :let @+=expand("%")<CR>
nmap ;cl :let @+=join([expand("%"), line(".")], ":")<CR>
nmap ;cg :let @+=join([expand("%"), line(".")], "#L")<CR>
nmap ;cp :let @+=expand("%:p")<CR>
" For some reason, (neo)vim sees <C-/> as <C-_>, so bind that instead.
autocmd FileType html inoremap <C-_> </<C-X><C-O>
let g:Unicode_no_default_mappings = 1
imap <C-G><C-F> <Plug>(UnicodeFuzzy)
" https://vim.fandom.com/wiki/Search_for_visually_selected_text
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
" 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 <C-l> :ResetScreen<CR>
let g:vim_markdown_folding_disabled = 1
let g:context_enabled = 0
map <silent> <leader>cc :ContextToggleWindow<CR>
map <silent> <leader>cp :ContextPeek<CR>
set completeopt=menu,menuone,noselect
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
lua <<LSPCONFIG
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local nvim_lsp = require('lspconfig')
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 <C-x><C-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<Leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<Leader>R', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<Leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('v', '<Leader>ca', '<cmd>lua vim.lsp.buf.range_code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<Leader>d', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
buf_set_keymap('n', '<Leader>j', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<Leader>k', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', '<Leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
buf_set_keymap('n', '<Leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
vim.api.nvim_command [[autocmd BufWritePre <buffer> 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/<filetype>.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({
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<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" },
},
}
LSPCONFIG

37
neovim/lazy-lock.json Normal file
View file

@ -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" }
}

View file

@ -1 +0,0 @@
Plug 'junegunn/fzf'

View file

@ -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

View file

@ -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

View file

@ -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"