Compare commits

...

No commits in common. "master" and "lazy" have entirely different histories.
master ... lazy

34 changed files with 292 additions and 997 deletions

View File

@ -1,6 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"Lua.workspace.library": [
"${3rd}/luassert/library"
]
}

View File

@ -1,5 +1,5 @@
indent_type = "Tabs"
indent_type = 'Tabs'
indent_width = 4
quote_style = "AutoPreferSingle"
call_parentheses = "Always"
quote_style = 'AutoPreferSingle'
call_parentheses = 'Always'
column_width = 150

View File

@ -1,11 +0,0 @@
; extends
(assignment
left: (identifier) @_id (#match? @_id "sql")
right: (string) @sql
)
(assignment
left: (identifier) @_id (#match? @_id "SQL")
right: (string) @sql
)

View File

@ -1,94 +0,0 @@
local M = {}
-- From plugins.lua
-- LSP EZ Installer
-- use {
-- 'williamboman/nvim-lsp-installer',
-- after = { 'cmp-nvim-lsp', 'nvim-lspconfig' },
-- event = 'BufRead',
-- config = function() require'configs.lsp-installer'.config() end
-- }
function M.config()
local status_lsp_installer_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
if not status_lsp_installer_ok then
return
end
-- Highlight under current selection
local function lsp_highlight_document(client)
if client.resolved_capabilities.document_highlight then
vim.api.nvim_exec(
[[
augroup lsp_document_highlight
autocmd! * <buffer>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]],
false
)
end
end
local function lsp_keymaps(bufnr)
local opts = { noremap = true, silent = true }
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float({ source = false, prefix = function(d, i, ttl) return string.rep(' ', #tostring(ttl) - #tostring(i)) .. tostring(i) .. ': ', nil end })<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ll", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting_sync()<CR>", opts)
--vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
end
local on_attach = function(client, bufnr)
if client.name == "tsserver" then
client.resolved_capabilities.document_formatting = false
end
if client.name == "jsonls" then
client.resolved_capabilities.document_formatting = false
end
if client.name == "html" then
client.resolved_capabilities.document_formatting = false
end
if client.name == "sumneko_lua" then
client.resolved_capabilities.document_formatting = false
end
lsp_keymaps(bufnr)
lsp_highlight_document(client)
end
local client_capabilities = vim.lsp.protocol.make_client_capabilities()
-- Add cmp_nvim_lsp capabilities
local status_cmp_nvim_lsp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not status_cmp_nvim_lsp_ok then
return
end
local capabilities = cmp_nvim_lsp.update_capabilities(client_capabilities)
lsp_installer.on_server_ready(function(server)
local opts = server:get_default_options()
opts.on_attach = on_attach
opts.capabilities = capabilities
opts.settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
server:setup(opts)
end)
end
return M

View File

@ -1,6 +1,6 @@
require("plugins")
require("settings")
require("keybinds")
require("commands")
require("cmds")
require("highlights")
require('settings')
require('plugins')
require('keybinds')
require('commands')
require('cmds')
require('highlights')

33
lazy-lock.json Normal file
View File

@ -0,0 +1,33 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
"bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"formatter.nvim": { "branch": "master", "commit": "ad246d34ce7a32f752071ed81b09b94e6b127fad" },
"git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" },
"gitsigns.nvim": { "branch": "main", "commit": "078041e9d060a386b0c9d3a8c7a7b019a35d3fb0" },
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
"lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" },
"lspsaga.nvim": { "branch": "main", "commit": "5faeec9f2508d2d49a66c0ac0d191096b4e3fa81" },
"lualine.nvim": { "branch": "master", "commit": "af4c3cf17206810880d2a93562e0a4c0d901c684" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "742db4e60c74e5fbcc596aaf9e7575e1342dfd09" },
"nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
"nvim-autopairs": { "branch": "master", "commit": "797260ff31e8bdd9db0f0c352659a35aba335b0b" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-lint": { "branch": "master", "commit": "03b1fc593638098a35de26d768d5f43b0fe57041" },
"nvim-lspconfig": { "branch": "master", "commit": "eb012f03bb3b4aca9e875d146008b923d0e07e65" },
"nvim-treesitter": { "branch": "master", "commit": "03f650705c0c10f97b214ca4ecca3c25ff9bee7d" },
"nvim-treesitter-context": { "branch": "master", "commit": "2484f58384be24da375558c88402f2998193eff6" },
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
"nvim-web-devicons": { "branch": "master", "commit": "cb0c967c9723a76ccb1be0cc3a9a10e577d2f6ec" },
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
"telescope.nvim": { "branch": "master", "commit": "3b8399c27380d09c44f55c8fbeff0bd7a4ed3f8d" },
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
"vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" },
"vim-lastplace": { "branch": "master", "commit": "a715d602745cdb1c35cfe73c50d3dd266eb5a349" }
}

View File

@ -1,21 +0,0 @@
-- Make it easier to run black
vim.api.nvim_create_user_command('Black', 'call Black()', {})
-- Insert PDB breakpoint
vim.api.nvim_create_user_command('PDB', 'norm obreakpoint() # michael', {})
vim.api.nvim_create_user_command('BP', 'norm obreakpoint() # michael', {})
-- Copy Relative File Path to Clipboard
vim.api.nvim_create_user_command('C', 'let @+ = expand("%:~:.")', {})
local function gitblame_toggle_summary()
local normal = '<author> • <date>'
local with_summary = '<summary> • <author> • <date>'
if vim.g.gitblame_message_template == normal then
vim.g.gitblame_message_template = with_summary
else
vim.g.gitblame_message_template = normal
end
end
vim.api.nvim_create_user_command('GitBlameToggleSummary', gitblame_toggle_summary, {})

View File

@ -1,11 +1,5 @@
local M = {}
function M.config()
local status_ok, alpha = pcall(require, 'alpha')
if not status_ok then
return
end
local function config()
local alpha = require('alpha')
local dashboard = require('alpha.themes.dashboard')
dashboard.section.header.val = { 'NeoVim' }
@ -21,4 +15,4 @@ function M.config()
alpha.setup(dashboard.config)
end
return M
return config

View File

@ -1,10 +1,5 @@
local M = {}
function M.config()
local status_ok, npairs = pcall(require, 'nvim-autopairs')
if not status_ok then
return
end
local function config()
local npairs = require('nvim-autopairs')
npairs.setup({
check_ts = true,
@ -36,4 +31,4 @@ function M.config()
-- cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })
end
return M
return config

View File

@ -1,11 +1,5 @@
local M = {}
function M.config()
local status_ok, bufferline = pcall(require, 'bufferline')
if not status_ok then
return
end
local function config()
local bufferline = require('bufferline')
bufferline.setup({
options = {
close_command = 'Bdelete! %d', -- use vim-bbye
@ -32,4 +26,4 @@ function M.config()
})
end
return M
return config

View File

@ -1,6 +1,4 @@
local M = {}
function M.config()
local function config()
local cmp_status_ok, cmp = pcall(require, 'cmp')
if not cmp_status_ok then
return
@ -129,4 +127,4 @@ function M.config()
})
end
return M
return config

View File

@ -1,6 +1,4 @@
local M = {}
function M.config()
local function config()
local present, colorizer = pcall(require, 'colorizer')
if not present then
return
@ -22,4 +20,4 @@ function M.config()
)
end
return M
return config

View File

@ -1,6 +1,4 @@
local M = {}
function M.config()
local function config()
local status_ok, comment = pcall(require, 'Comment')
if not status_ok then
return
@ -20,4 +18,4 @@ function M.config()
})
end
return M
return config

37
lua/configs/formatter.lua Normal file
View File

@ -0,0 +1,37 @@
local function config()
local formatter = require('formatter')
local prettierd = require('formatter.defaults.prettierd')
local fmt_lua = require('formatter.filetypes.lua')
local fmt_json = require('formatter.filetypes.json')
local fmt_python = require('formatter.filetypes.python')
formatter.setup({
filetype = {
-- sudo pacman -S stylua
-- https://github.com/JohnnyMorganz/StyLua/releases
lua = { fmt_lua.stylua },
-- pip install isort black
-- TODO: ruff format, depending on the project
python = {
fmt_python.isort,
fmt_python.black,
},
-- sudo npm i -g fixjson
json = { fmt_json.fixjson },
-- npm i prettierd
typescript = { prettierd },
typescriptreact = { prettierd },
scss = { prettierd },
},
})
-- format on write
vim.api.nvim_create_augroup('__formatter__', { clear = true })
vim.api.nvim_create_autocmd('BufWritePost', {
group = '__formatter__',
command = ':FormatWrite',
})
end
return config

View File

@ -1,9 +1,7 @@
local M = {}
function M.config()
local function config()
vim.g.gitblame_display_virtual_text = 0
vim.g.gitblame_message_template = '<author> • <date>'
vim.g.gitblame_date_format = '%r'
end
return M
return config

View File

@ -1,63 +1,15 @@
local M = {}
function M.config()
local status_ok, gitsigns = pcall(require, 'gitsigns')
if not status_ok then
return
end
local function config()
local gitsigns = require('gitsigns')
gitsigns.setup({
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',
},
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true,
add = { text = '' },
change = { text = '' },
delete = { text = '' },
topdelete = { text = '' },
changedelete = { text = '' },
},
attach_to_untracked = true,
current_line_blame = false,
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol',
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter_opts = {
relative_time = false,
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil,
max_file_length = 40000,
preview_config = {
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1,
},
yadm = {
enable = false,
},
})
end
return M
return config

View File

@ -1,191 +0,0 @@
local M = {}
function M.config()
local status_ok, icons = pcall(require, 'nvim-web-devicons')
if not status_ok then
return
end
local colors = {
c = '#519aba',
css = '#61afef',
deb = '#a1b7ee',
docker = '#384d54',
html = '#de8c92',
js = '#ebcb8b',
kt = '#7bc99c',
lock = '#c4c720',
lua = '#51a0cf',
mp3 = '#d39ede',
mp4 = '#9ea3de',
out = '#abb2bf',
py = '#a3b8ef',
robot = '#abb2bf',
toml = '#39bf39',
ts = '#519aba',
ttf = '#abb2bf',
rb = '#ff75a0',
rpm = '#fca2aa',
woff = '#abb2bf',
woff2 = '#abb2bf',
zip = '#f9d71c',
jsx = '#519ab8',
vue = '#7bc99c',
rs = '#dea584',
png = '#c882e7',
jpeg = '#c882e7',
jpg = '#c882e7',
}
icons.setup({
override = {
c = {
icon = '',
color = colors.c,
name = 'c',
},
css = {
icon = '',
color = colors.css,
name = 'css',
},
deb = {
icon = '',
color = colors.deb,
name = 'deb',
},
Dockerfile = {
icon = '',
color = colors.docker,
name = 'Dockerfile',
},
html = {
icon = '',
color = colors.html,
name = 'html',
},
js = {
icon = '',
color = colors.js,
name = 'js',
},
kt = {
icon = '󱈙',
color = colors.kt,
name = 'kt',
},
lock = {
icon = '',
color = colors.lock,
name = 'lock',
},
lua = {
icon = '',
color = colors.lua,
name = 'lua',
},
mp3 = {
icon = '',
color = colors.mp3,
name = 'mp3',
},
mp4 = {
icon = '',
color = colors.mp4,
name = 'mp4',
},
out = {
icon = '',
color = colors.out,
name = 'out',
},
py = {
icon = '',
color = colors.py,
name = 'py',
},
['robots.txt'] = {
icon = '',
color = colors.robot,
name = 'robots',
},
toml = {
icon = '',
color = colors.toml,
name = 'toml',
},
ts = {
icon = '',
color = colors.ts,
name = 'ts',
},
ttf = {
icon = '',
color = colors.ttf,
name = 'TrueTypeFont',
},
rb = {
icon = '',
color = colors.rb,
name = 'rb',
},
rpm = {
icon = '',
color = colors.rpm,
name = 'rpm',
},
vue = {
icon = '',
color = colors.vue,
name = 'vue',
},
woff = {
icon = '',
color = colors.woff,
name = 'WebOpenFontFormat',
},
woff2 = {
icon = '',
color = colors.woff2,
name = 'WebOpenFontFormat2',
},
xz = {
icon = '',
color = colors.zip,
name = 'xz',
},
zip = {
icon = '',
color = colors.zip,
name = 'zip',
},
jsx = {
icon = '',
color = colors.jsx,
name = 'jsx',
},
rust = {
icon = '',
color = colors.rs,
name = 'rs',
},
jpg = {
icon = '',
color = colors.jpg,
name = 'jpg',
},
png = {
icon = '',
color = colors.png,
name = 'png',
},
jpeg = {
icon = '',
color = colors.jpeg,
name = 'jpeg',
},
},
})
end
return M

View File

@ -1,10 +1,5 @@
local M = {}
function M.config()
local present, illuminate = pcall(require, 'illuminate')
if not present then
return
end
local function config()
local illuminate = require('illuminate')
illuminate.configure({
providers = {
@ -21,4 +16,4 @@ function M.config()
})
end
return M
return config

View File

@ -1,19 +1,13 @@
local M = {}
function M.config()
local status_ok, indent_blankline = pcall(require, 'ibl')
if not status_ok then
return
end
local function config()
local indent_blankline = require('ibl')
indent_blankline.setup({
indent = {
char = '',
},
scope = {
enabled = false,
}
},
})
end
return M
return config

16
lua/configs/linter.lua Normal file
View File

@ -0,0 +1,16 @@
local function config()
local lint = require('lint')
-- TODO: make sure these work given old setup
-- detected root of project based on .eslintrc file
-- sudo pacman -S eslint_d
-- sudo npm install -g eslint_d
lint.linters_by_ft = {
javascript = { 'eslint_d' },
typescript = { 'eslint_d' },
typescriptreact = { 'eslint_d' },
}
-- TODO: lint on write autocommand
end
return config

View File

@ -1,6 +1,4 @@
local M = {}
function M.config()
local function config()
local signs = {
{ name = 'DiagnosticSignError', text = '' },
{ name = 'DiagnosticSignWarn', text = '' },
@ -12,7 +10,7 @@ function M.config()
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = '' })
end
local config = {
vim.diagnostic.config({
virtual_text = false,
signs = {
active = signs,
@ -28,9 +26,7 @@ function M.config()
header = '',
prefix = '',
},
}
vim.diagnostic.config(config)
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
border = 'rounded',
@ -44,10 +40,7 @@ function M.config()
virtual_text = false,
})
local status_ok, lspconfig = pcall(require, 'lspconfig')
if not status_ok then
return
end
local lspconfig = require('lspconfig')
local function lsp_keymaps(bufnr)
local opts = { noremap = true, silent = true }
@ -138,9 +131,10 @@ function M.config()
on_attach = on_attach,
})
-- rustup
lspconfig.rust_analyzer.setup({
on_attach = on_attach,
})
end
return M
return config

View File

@ -1,11 +1,5 @@
local M = {}
function M.config()
local status_ok, lspsaga = pcall(require, 'lspsaga')
if not status_ok then
return
end
local function config()
local lspsaga = require('lspsaga')
lspsaga.setup({
debug = false,
use_saga_diagnostic_sign = false,
@ -50,4 +44,4 @@ function M.config()
})
end
return M
return config

View File

@ -1,15 +1,6 @@
local M = {}
function M.config()
local status_lualine_ok, lualine = pcall(require, 'lualine')
if not status_lualine_ok then
return
end
local status_gitblame_ok, gitblame = pcall(require, 'gitblame')
if not status_gitblame_ok then
return
end
local function config()
local lualine = require('lualine')
local gitblame = require('gitblame')
local scolors = {
fg = '#adb0b9',
@ -49,9 +40,9 @@ function M.config()
end,
}
local config = {
local opts = {
options = {
disabled_filetypes = { 'NvimTree', 'dashboard', 'Outline' },
disabled_filetypes = { 'neo-tree', 'dashboard' },
component_separators = '',
section_separators = '',
theme = {
@ -123,9 +114,9 @@ function M.config()
padding = { left = 0, right = 1 },
},
{ -- git branch
"branch",
icon = "",
color = { fg = scolors.branch, gui = "bold" },
'branch',
icon = '',
color = { fg = scolors.branch, gui = 'bold' },
padding = { left = 1, right = 1 },
},
{ -- location in file (line:col)
@ -173,7 +164,7 @@ function M.config()
},
}
lualine.setup(config)
lualine.setup(opts)
end
return M
return config

27
lua/configs/neotree.lua Normal file
View File

@ -0,0 +1,27 @@
local function config()
local neotree = require('neo-tree')
neotree.setup({
enable_diagnostics = false,
filesystem = {
filtered_items = {
hide_gitignored = false,
always_show = {
'.github',
},
never_show = { -- hide_by_name
'__pycache__',
},
},
follow_current_file = {
enabled = true,
},
},
window = {
mappings = {
['/'] = 'none', -- disable fuzzy finder
},
},
})
end
return config

View File

@ -1,111 +0,0 @@
local M = {}
function M.config()
local status_ok, null_ls = pcall(require, 'null-ls')
if not status_ok then
return
end
local augroup = vim.api.nvim_create_augroup('LspFormatting', {})
null_ls.setup({
debug = false,
sources = {
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
-- Lua
-- sudo pacman -S stylua
-- https://github.com/JohnnyMorganz/StyLua/releases
null_ls.builtins.formatting.stylua,
-- Python
-- pip install black
null_ls.builtins.formatting.black,
-- pip install isort
null_ls.builtins.formatting.isort,
-- JavaScript / TypeScript
-- sudo pacman -S prettierd
-- sudo npm install -g @fsouza/prettierd
null_ls.builtins.formatting.prettierd.with({
disabled_filetypes = { 'html', 'markdown' },
condition = function()
-- https://github.com/jose-elias-alvarez/null-ls.nvim/discussions/1269
return require('null-ls.utils').root_pattern(
'.prettierrc',
'.prettierrc.json',
'.prettierrc.yml',
'.prettierrc.yaml',
'.prettierrc.json5',
'.prettierrc.js',
'.prettierrc.cjs',
'.prettier.config.js',
'.prettier.config.cjs',
'.prettierrc.toml'
)(vim.api.nvim_buf_get_name(0)) ~= nil
end,
}),
-- sudo pacman -S eslint_d
-- sudo npm install -g eslint_d
null_ls.builtins.diagnostics.eslint_d.with({
diagnostic_config = {
virtual_text = false,
severity_sort = true,
},
root_pattern = function()
return require('null-ls.utils').root_pattern(
-- file names copied from
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/lua/null-ls/builtins/diagnostics/eslint.lua
'eslint.config.js',
'.eslintrc',
'.eslintrc.js',
'.eslintrc.cjs',
'.eslintrc.yaml',
'.eslintrc.yml',
'.eslintrc.json'
)(vim.api.nvim_buf_get_name(0))
end,
condition = function()
return require('null-ls.utils').root_pattern(
-- file names copied from
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/lua/null-ls/builtins/diagnostics/eslint.lua
'eslint.config.js',
'.eslintrc',
'.eslintrc.js',
'.eslintrc.cjs',
'.eslintrc.yaml',
'.eslintrc.yml',
'.eslintrc.json'
)(vim.api.nvim_buf_get_name(0)) ~= nil
end,
}),
},
on_attach = function(client, bufnr)
-- disable null-ls completion hints
client.server_capabilities.completionProvider = false
if client.supports_method('textDocument/formatting') then
-- Format before save *only* in invsys
local cwd = vim.fn.getcwd()
-- substr the cwd starting at the last "/" character
local cwd_name = string.sub(cwd, -cwd:reverse():find('/') + 1)
if cwd_name == 'invsys' or cwd_name == 'invsys-b' then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd('BufWritePre', {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end
end,
})
end
return M

View File

@ -1,78 +0,0 @@
local M = {}
function M.config()
local status_ok, nvimtree = pcall(require, 'nvim-tree')
if not status_ok then
return
end
nvimtree.setup({
filters = {
dotfiles = false,
custom = {
'^\\.git$',
'^\\.mypy_cache$',
'^\\.test_cache$',
'^\\.coverage$',
'^node_modules$',
},
},
view = {
width = 40,
side = 'left',
number = false,
relativenumber = false,
signcolumn = 'yes',
},
renderer = {
root_folder_label = false,
indent_markers = {
enable = false,
icons = {
corner = '',
edge = '',
none = ' ',
},
},
icons = {
webdev_colors = true,
glyphs = {
folder = {
symlink_open = '',
},
},
},
},
disable_netrw = true,
hijack_netrw = true,
open_on_tab = false,
actions = {
open_file = {
quit_on_open = false,
window_picker = {
enable = false,
},
},
},
hijack_cursor = true,
update_focused_file = {
enable = true,
},
diagnostics = {
enable = false,
icons = {
hint = '',
info = '',
warning = '',
error = '',
},
},
git = {
enable = true,
ignore = false,
timeout = 500,
},
})
end
return M

View File

@ -1,6 +1,4 @@
local M = {}
function M.config()
local function config()
local status_ok, session_manager = pcall(require, 'session_manager')
if not status_ok then
return
@ -40,4 +38,4 @@ function M.config()
})
end
return M
return config

View File

@ -1,11 +1,5 @@
local M = {}
function M.config()
local status_ok, telescope = pcall(require, 'telescope')
if not status_ok then
return
end
local function config()
local telescope = require('telescope')
local actions = require('telescope.actions')
--telescope.load_extension "fzf"
@ -91,4 +85,4 @@ function M.config()
})
end
return M
return config

View File

@ -1,14 +0,0 @@
local M = {}
function M.config()
local present, treesitter_context_commentstring = pcall(require, 'ts_context_commentstring')
if not present then
return
end
treesitter_context_commentstring.setup({
enable_autocmd = false,
})
end
return M

View File

@ -1,15 +1,10 @@
local M = {}
function M.config()
local present, treesitter_context = pcall(require, 'treesitter-context')
if not present then
return
end
local function config()
local treesitter_context = require('treesitter-context')
-- line number highlight group: TreesitterContextLineNumber
treesitter_context.setup({
enable = false, -- see keybinds.lua to toggle
mode = 'topline',
})
end
return M
return config

View File

@ -1,18 +1,26 @@
local M = {}
function M.config()
local present, treesitter_configs = pcall(require, 'nvim-treesitter.configs')
if not present then
return
end
local function config()
local treesitter_configs = require('nvim-treesitter.configs')
treesitter_configs.setup({
highlight = {
enable = true,
disable = {},
ensure_installed = {
'lua',
'python',
'javascript',
'typescript',
'tsx',
'json',
'yaml',
'sql',
'rust',
'c',
'cpp',
'java',
'make',
'hcl', -- terraform
},
highlight = { enable = true, disable = {} },
indent = { enable = true, disable = { 'html', 'typescript' } },
})
end
return M
return config

View File

@ -34,7 +34,6 @@ map('n', '<S-h>', '<cmd>BufferLineCyclePrev<CR>', opts) -- :bprevious
map('n', ']b', '<cmd>BufferLineMoveNext<CR>', opts)
map('n', '[b', '<cmd>BufferLineMovePrev<CR>', opts)
map('n', '<leader>w', '<cmd>Bdelete<CR>', opts) -- don't close if unsaved
map('n', '<leader>c', '<cmd>Bdelete!<CR>', opts) -- close it no matter what B)
-- Navigate Git Signs
map('n', ']g', '<cmd>Gitsigns next_hunk<CR>', opts)
@ -44,9 +43,11 @@ map('n', '[g', '<cmd>Gitsigns prev_hunk<CR>', opts)
map('n', '<leader>de', '<cmd>lua vim.diagnostic.enable()<cr>', opts)
map('n', '<leader>dd', '<cmd>lua vim.diagnostic.disable()<cr>', opts)
-- NvimTree
map('n', '<leader>e', '<cmd>NvimTreeToggle<CR>', opts)
map('n', '<leader>o', '<cmd>NvimTreeFocus<CR>', opts)
-- Toggle Context
map('n', '<leader>c', '<cmd>TSContextToggle<CR>', opts)
-- neotree
map('n', '<leader>e', '<cmd>Neotree toggle<CR>', opts)
-- Telescope (See also configs/telescope.lua)
map('n', '<leader>ff', '<cmd>Telescope find_files<CR>', opts)

View File

@ -1,273 +1,95 @@
-- Make sure to install packer via the AUR
-- $ yay -S nvim-packer-git
local packer_status_ok, packer = pcall(require, 'packer')
if not packer_status_ok then
return
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',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- consider lazy.nvim
require('lazy').setup({
-- color scheme
{ dir = '~/builds/darkplus.nvim' },
vim.cmd([[packadd packer.nvim]])
-- buffer line
'moll/vim-bbye', -- close buffers softly
{ 'akinsho/bufferline.nvim', dependencies = 'nvim-tree/nvim-web-devicons', config = require('configs.bufferline') },
-- enable experimental module loader for faster startup time
vim.loader.enable()
-- git
{ 'lewis6991/gitsigns.nvim', config = require('configs.gitsigns') },
{ 'f-person/git-blame.nvim', config = require('configs.gitblame') },
packer.startup({
function(use)
-- git clone --depth 1 https://github.com/wbthomason/packer.nvim \
-- ~/.local/share/nvim/site/pack/packer/start/packer.nvim
-- Packer will try to delete itself otherwise
use('wbthomason/packer.nvim')
-- status line
{ 'nvim-lualine/lualine.nvim', config = require('configs.lualine') },
--
-- General
--
-- General Lua functions
use({ 'nvim-lua/plenary.nvim' })
use({ 'nvim-lua/popup.nvim' })
-- General Assets/Resources
use({
'kyazdani42/nvim-web-devicons',
config = function()
require('configs.icons').config()
end,
})
--
-- Style
--
-- Colorscheme (See autocommands.lua)
-- use({ 'lunarvim/darkplus.nvim', tag = 'fd5f63627d3c9584bd6685200e0e45fe1896d438' })
use({ '~/builds/darkplus.nvim' })
-- Buffer Line
use({ 'moll/vim-bbye' }) -- Close buffers softly
use({
'akinsho/bufferline.nvim',
tag = 'v4.*',
requires = {
{ 'kyazdani42/nvim-web-devicons' },
},
config = function()
require('configs.bufferline').config()
end,
})
-- Git (git-blame must be before lualine)
use({
'lewis6991/gitsigns.nvim',
config = function()
require('configs.gitsigns').config()
end,
})
use({
'f-person/git-blame.nvim',
config = function()
require('configs.git-blame').config()
end,
})
-- Status Line
use({
'nvim-lualine/lualine.nvim',
config = function()
require('configs.lualine').config()
end,
})
-- NvimTree
use({
'kyazdani42/nvim-tree.lua',
requires = {
{ 'kyazdani42/nvim-web-devicons' },
},
config = function()
require('configs.nvim-tree').config()
end,
})
-- Show indentation
use({
'lukas-reineke/indent-blankline.nvim',
config = function()
require('configs.indent-blankline').config()
end,
})
-- Telescope (find files, words, git commits, etc)
use({
'nvim-telescope/telescope.nvim',
config = function()
require('configs.telescope').config()
end,
})
-- use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
-- Sessions
-- use {
-- 'Shatur/neovim-session-manager',
-- commit = '4005dac93f5cd1257792259ef4df6af0e3afc213',
-- config = function() require'configs.session-manager'.config() end
-- }
-- custom build of the above plugin
use({
'~/builds/neovim-session-manager',
config = function()
require('configs.session-manager').config()
end,
})
--
-- Treesitter
--
-- Treesitter
use({
'nvim-treesitter/nvim-treesitter',
-- commit = 'v0.9.0',
run = ':TSUpdate',
config = function()
require('configs.treesitter').config()
end,
})
-- Auto-close tags
use({ 'windwp/nvim-ts-autotag', after = 'nvim-treesitter' })
-- Context-based auto commenting
use({ 'JoosepAlviste/nvim-ts-context-commentstring', after = 'nvim-treesitter' })
-- Show context
use({
'nvim-treesitter/nvim-treesitter-context',
config = function()
require('configs.treesitter-context').config()
end,
})
--
-- LSP
--
-- Built-In LSP Config
use({
'neovim/nvim-lspconfig',
-- event = 'BufRead',
config = function()
require('configs.lspconfig').config()
end,
})
-- TODO: LSP Enhancer
use({
'tami5/lspsaga.nvim',
config = function()
require('configs.lspsaga').config()
end,
})
-- TODO: Symbols Outline
-- use { 'simrat39'/symbols-outline.nvim', cmd = 'SymbolsOutline', setup = function ... }
-- Formatting + Linting
use({
'jose-elias-alvarez/null-ls.nvim',
event = 'BufRead',
config = function()
require('configs.null-ls').config()
end,
})
-- highlight hovered-over text
use({
'RRethy/vim-illuminate',
config = function()
require('configs.illuminate').config()
end,
})
--
-- Autocompletion
--
-- Autocompletion Engine
use({
'hrsh7th/nvim-cmp',
config = function()
require('configs.cmp').config()
end,
})
-- Snippet Engine (for nvim-cmp)
-- TODO: Add snippets? rafamadriz/friendly-snippets is too cow for me and has too many snippets.
-- I'd like to use my own collection exclusively (unless there is a better, less extensive collection)
use({ 'L3MON4D3/LuaSnip' })
-- Autocompletion Sources
use({ 'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp', requires = { 'nvim-cmp' } })
use({ 'hrsh7th/cmp-buffer', after = 'nvim-cmp', requires = { 'nvim-cmp' } })
use({ 'hrsh7th/cmp-path', after = 'nvim-cmp', requires = { 'nvim-cmp' } })
use({ 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp', requires = { 'nvim-cmp' } })
--
-- Quality of Life
--
-- Dashboard
use({
'goolord/alpha-nvim',
requires = { 'kyazdani42/nvim-web-devicons' },
config = function()
require('configs.alpha').config()
end,
})
-- Autopairs
use({
'windwp/nvim-autopairs',
config = function()
require('configs.autopairs').config()
end,
})
-- Commenting
use({
'numToStr/Comment.nvim',
config = function()
require('configs.comment').config()
end,
after = 'nvim-ts-context-commentstring',
})
-- Automatically colorize color strings (#f1b8f1)
use({
'norcalli/nvim-colorizer.lua',
config = function()
require('configs.colorizer').config()
end,
})
-- Remember your last place when opening a file
use({ 'farmergreg/vim-lastplace' })
-- Import sorting for python (:Isort)
use({ 'stsewd/isort.nvim', run = ':UpdateRemotePlugins' })
-- Formatting for python (:call Black())
use({ 'averms/black-nvim', run = ':UpdateRemotePlugins' })
end,
config = {
display = {
open_fn = function()
return require('packer.util').float({ border = 'rounded' })
end,
},
profile = {
enable = true,
threshold = 0.0001,
-- tree
{
'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
config = require('configs.neotree'),
},
-- show indentation
{ 'lukas-reineke/indent-blankline.nvim', config = require('configs.indent-blankline') },
-- telescope (find files, words, etc.)
{ 'nvim-telescope/telescope.nvim', config = require('configs.telescope') },
-- custom build of Shatur/neovim-session-manager for git-branch sessions
{ dir = '~/builds/neovim-session-manager', config = require('configs.session-manager') },
-- treesitter
{ 'nvim-treesitter/nvim-treesitter', config = require('configs.treesitter') },
{ 'windwp/nvim-ts-autotag', dependencies = 'nvim-treesitter/nvim-treesitter' },
{ 'JoosepAlviste/nvim-ts-context-commentstring', dependencies = 'nvim-treesitter/nvim-treesitter' },
{
'nvim-treesitter/nvim-treesitter-context',
dependencies = 'nvim-treesitter/nvim-treesitter',
config = require('configs.treesitter-context'),
},
-- lsp
{ 'neovim/nvim-lspconfig', config = require('configs.lspconfig') },
{ 'tami5/lspsaga.nvim', config = require('configs.lspsaga') },
{ 'mhartington/formatter.nvim', config = require('configs.formatter') },
{ 'mfussenegger/nvim-lint', config = require('configs.linter') },
-- highlight hovered text
{ 'RRethy/vim-illuminate', config = require('configs.illuminate') },
-- autocomplete
{ 'hrsh7th/nvim-cmp', dependencies = 'L3MON4D3/LuaSnip', config = require('configs.cmp') },
{ 'hrsh7th/cmp-buffer', dependencies = 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-path', dependencies = 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lsp', dependencies = 'hrsh7th/nvim-cmp' },
-- dashboard
{ 'goolord/alpha-nvim', dependencies = 'nvim-tree/nvim-web-devicons', config = require('configs.alpha') },
-- autopairs
{ 'windwp/nvim-autopairs', config = require('configs.autopairs') },
-- block comments
{
'numToStr/Comment.nvim',
dependencies = 'JoosepAlviste/nvim-ts-context-commentstring',
config = require('configs.comment'),
},
-- color string colors (#f1b8f1)
{ 'norcalli/nvim-colorizer.lua', config = require('configs.colorizer') },
-- remember last place when opening files
'farmergreg/vim-lastplace',
})

View File

@ -1,5 +0,0 @@
python-lsp-server
pylsp-mypy
pyls-isort
python-lsp-black