refactor(nvim): manage Neovim with Home Manager
This commit is contained in:
parent
83c43d07df
commit
5630466780
42 changed files with 5 additions and 0 deletions
58
config/neovim/after/plugin/colorscheme.lua
Normal file
58
config/neovim/after/plugin/colorscheme.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
if not pcall(require, "colorbuddy") then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
require "colorbuddy".colorscheme "gruvbuddy"
|
||||
require "colorizer".setup {}
|
||||
|
||||
local Group = require("colorbuddy.group").Group
|
||||
local c = require("colorbuddy.color").colors
|
||||
local g = require("colorbuddy.group").groups
|
||||
local s = require("colorbuddy.style").styles
|
||||
|
||||
-- Global
|
||||
-- Group.new("TSComment", c.none)
|
||||
Group.new("TSInclude", nil)
|
||||
Group.new("TSOperator", nil)
|
||||
Group.new("TSPunctBracket", nil)
|
||||
Group.new("TSPunctDelimiter", nil)
|
||||
Group.new("WinSeparator", nil)
|
||||
|
||||
-- Lua
|
||||
Group.new("luaTSConstant", c.blue)
|
||||
Group.new("luaTSField", nil, nil)
|
||||
Group.new("luaTSFuncBuiltin", nil)
|
||||
Group.new("luaTSFunction", nil)
|
||||
Group.new("luaTSKeyword", nil)
|
||||
Group.new("luaTSKeywordFunction", c.violet)
|
||||
Group.new("luaTSKeywordOperator", c.orange)
|
||||
Group.new("luaTSKeywordReturn", nil)
|
||||
Group.new("luaTSParameter", nil)
|
||||
Group.new("luaTSPunctBracket", nil)
|
||||
Group.new("luaTSString", c.blue)
|
||||
Group.new("luaTSVariable", nil)
|
||||
|
||||
-- PHP
|
||||
Group.new("phpTSInclude", nil)
|
||||
Group.new("phpTSKeyword", nil)
|
||||
Group.new("phpTSKeywordFunction", nil)
|
||||
Group.new("phpTSMethod", c.blue)
|
||||
Group.new("phpTSOperator", nil)
|
||||
Group.new("phpTSVariableBuiltin", nil)
|
||||
Group.new("phpTSNamespace", c.blue)
|
||||
|
||||
-- JavaScript
|
||||
Group.new("javascriptTSConstructor", c.blue)
|
||||
Group.new("javascriptTSException", c.red)
|
||||
Group.new("javascriptTSFunction", c.none)
|
||||
Group.new("javascriptTSMethod", nil)
|
||||
Group.new("javascriptTSProperty", nil)
|
||||
Group.new("javascriptTSVariable", c.blue)
|
||||
|
||||
-- TypeScript
|
||||
Group.new("typescriptTSConditional", c.none)
|
||||
Group.new("typescriptTSKeyword", c.none)
|
||||
Group.new("typescriptTSProperty", c.violet)
|
||||
Group.new("typescriptTSType", c.blue)
|
19
config/neovim/after/plugin/comment.lua
Normal file
19
config/neovim/after/plugin/comment.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup {
|
||||
padding = true,
|
||||
|
||||
opleader = {
|
||||
line = "gc",
|
||||
block = "gb",
|
||||
},
|
||||
|
||||
mappings = {
|
||||
basic = true,
|
||||
extra = true,
|
||||
extended = false,
|
||||
},
|
||||
}
|
74
config/neovim/after/plugin/completion.lua
Normal file
74
config/neovim/after/plugin/completion.lua
Normal file
|
@ -0,0 +1,74 @@
|
|||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.shortmess:append "c"
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-y>"] = cmp.mapping.confirm { select = true },
|
||||
["<tab>"] = cmp.config.disable,
|
||||
},
|
||||
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "cmp_tabnine" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer", keyword_length = 5, max_item_count = 5 },
|
||||
},
|
||||
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format {
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[buf]",
|
||||
cmp_tabnine = "[tn]",
|
||||
luasnip = "[snip]",
|
||||
nvim_lsp = "[lsp]",
|
||||
nvim_lua = "[lua]",
|
||||
path = "[path]",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
experimental = {
|
||||
ghost_text = false,
|
||||
native_menu = false,
|
||||
},
|
||||
}
|
||||
|
||||
vim.cmd [[
|
||||
augroup DadbodSql
|
||||
au!
|
||||
autocmd FileType sql,mysql,plsql lua require('cmp').setup.buffer { sources = { { name = 'vim-dadbod-completion' } } }
|
||||
augroup END
|
||||
]]
|
74
config/neovim/after/plugin/dap.lua
Normal file
74
config/neovim/after/plugin/dap.lua
Normal file
|
@ -0,0 +1,74 @@
|
|||
local has_dap, dap = pcall(require, "dap")
|
||||
if not has_dap then
|
||||
return
|
||||
end
|
||||
|
||||
local has_dap_ui, dapui = pcall(require, "dapui")
|
||||
if not has_dap_ui then
|
||||
return
|
||||
end
|
||||
|
||||
dap.adapters.php = {
|
||||
type = "executable",
|
||||
command = "node",
|
||||
args = { os.getenv("HOME") .. "/build/vscode-php-debug/out/phpDebug.js" }
|
||||
}
|
||||
|
||||
dap.configurations.php = {
|
||||
{
|
||||
type = "php",
|
||||
request = "launch",
|
||||
name = "Listen for Xdebug",
|
||||
port = 9003,
|
||||
pathMappings = {
|
||||
["/var/www/html"] = "${workspaceFolder}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
require "dapui".setup {
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.25 },
|
||||
"breakpoints",
|
||||
"stacks",
|
||||
"watches",
|
||||
},
|
||||
size = 40, -- 40 columns
|
||||
position = "right",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"console",
|
||||
},
|
||||
size = 0.25, -- 25% of total lines
|
||||
position = "bottom",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
require "nvim-dap-virtual-text".setup {
|
||||
commented = true,
|
||||
}
|
||||
|
||||
local nmap = require "opdavies.keymap".nmap
|
||||
|
||||
nmap { "<F12>", ":lua require'dap'.step_over()<cr>" }
|
||||
nmap { "<F2>", ":lua require'dap'.step_into()<cr>" }
|
||||
nmap { "<F3>", ":lua require'dap'.step_over()<cr>" }
|
||||
nmap { "<F5>", ":lua require'dap'.continue()<cr>" }
|
||||
nmap { "<leader>b", ":lua require'dap'.toggle_breakpoint()<cr>" }
|
52
config/neovim/after/plugin/dial.lua
Normal file
52
config/neovim/after/plugin/dial.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
local status_ok, dial_config = pcall(require, "dial.config")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local augend = require "dial.augend"
|
||||
|
||||
dial_config.augends:register_group {
|
||||
visual = {
|
||||
augend.integer.alias.decimal,
|
||||
augend.integer.alias.hex,
|
||||
augend.date.alias["%Y/%m/%d"],
|
||||
augend.constant.alias.alpha,
|
||||
augend.constant.alias.Alpha,
|
||||
},
|
||||
|
||||
mygroup = {
|
||||
augend.constant.new {
|
||||
elements = { "TRUE", "FALSE" },
|
||||
word = true,
|
||||
cyclic = true,
|
||||
},
|
||||
|
||||
augend.constant.new {
|
||||
elements = { "public", "protected", "private" },
|
||||
word = true,
|
||||
cyclic = true,
|
||||
},
|
||||
|
||||
augend.constant.new {
|
||||
elements = { "&&", "||" },
|
||||
word = false,
|
||||
cyclic = true,
|
||||
},
|
||||
|
||||
augend.date.alias["%d/%m/%Y"],
|
||||
augend.constant.alias.bool, -- boolean value (true <-> false)
|
||||
augend.integer.alias.decimal,
|
||||
augend.integer.alias.hex,
|
||||
augend.semver.alias.semver
|
||||
},
|
||||
}
|
||||
|
||||
local dial_map = require "dial.map"
|
||||
|
||||
local nmap = require "opdavies.keymap".nmap
|
||||
local vmap = require "opdavies.keymap".vmap
|
||||
|
||||
nmap({ "<C-a>", dial_map.inc_normal "mygroup" })
|
||||
nmap({ "<C-x>", dial_map.dec_normal "mygroup" })
|
||||
vmap({ "<C-a>", dial_map.inc_normal "visual" })
|
||||
vmap({ "<C-x>", dial_map.dec_normal "visual" })
|
6
config/neovim/after/plugin/fidget.lua
Normal file
6
config/neovim/after/plugin/fidget.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local status_ok, fidget = pcall(require, "fidget")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
fidget.setup {}
|
30
config/neovim/after/plugin/git.lua
Normal file
30
config/neovim/after/plugin/git.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
local status_ok, neogit = pcall(require, "neogit")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
neogit.setup {
|
||||
disable_commit_confirmation = true,
|
||||
}
|
||||
|
||||
local nmap = require("opdavies.keymap").nmap
|
||||
|
||||
nmap {
|
||||
"<leader>gc",
|
||||
function()
|
||||
neogit.open { "commit" }
|
||||
end,
|
||||
}
|
||||
nmap {
|
||||
"<leader>gl",
|
||||
function()
|
||||
neogit.open { "log" }
|
||||
end,
|
||||
}
|
||||
nmap {
|
||||
"<leader>gp",
|
||||
function()
|
||||
neogit.open { "push" }
|
||||
end,
|
||||
}
|
||||
nmap { "<leader>gs", neogit.open }
|
31
config/neovim/after/plugin/gitsigns.lua
Normal file
31
config/neovim/after/plugin/gitsigns.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local colorbuddy_status_ok, colorbuddy = pcall(require, "colorbuddy")
|
||||
if not colorbuddy_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local gitsigns_status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not gitsigns_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local c = require("colorbuddy.color").colors
|
||||
local Group = require("colorbuddy.group").Group
|
||||
|
||||
Group.new("GitSignsAdd", c.green)
|
||||
Group.new("GitSignsChange", c.yellow)
|
||||
Group.new("GitSignsDelete", c.red)
|
||||
|
||||
gitsigns.setup {
|
||||
linehl = false,
|
||||
numhl = true,
|
||||
|
||||
signs = {
|
||||
add = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||
change = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||
delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr" },
|
||||
topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||
changedelete = { hl = "GitSignsDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||
},
|
||||
|
||||
word_diff = false,
|
||||
}
|
20
config/neovim/after/plugin/harpoon.lua
Normal file
20
config/neovim/after/plugin/harpoon.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local status_ok, harpoon = pcall(require, "harpoon")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local nmap = require("opdavies.keymap").nmap
|
||||
|
||||
harpoon.setup {}
|
||||
|
||||
nmap { "<M-h><M-l>", require("harpoon.ui").toggle_quick_menu }
|
||||
nmap { "<M-h><M-m>", require("harpoon.mark").add_file }
|
||||
|
||||
for i = 1, 5 do
|
||||
nmap {
|
||||
string.format("<space>%s", i),
|
||||
function()
|
||||
require("harpoon.ui").nav_file(i)
|
||||
end,
|
||||
}
|
||||
end
|
18
config/neovim/after/plugin/indent-blankline.lua
Normal file
18
config/neovim/after/plugin/indent-blankline.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = {
|
||||
eol = "↴",
|
||||
}
|
||||
|
||||
vim.cmd [[highlight IndentBlanklineIndent1 guifg=#555555 gui=nocombine]]
|
||||
|
||||
indent_blankline.setup {
|
||||
char_highlight_list = {
|
||||
"IndentBlanklineIndent1",
|
||||
},
|
||||
show_end_of_line = true,
|
||||
}
|
67
config/neovim/after/plugin/lir.lua
Normal file
67
config/neovim/after/plugin/lir.lua
Normal file
|
@ -0,0 +1,67 @@
|
|||
local has_lir, lir = pcall(require, "lir")
|
||||
if not has_lir then
|
||||
return
|
||||
end
|
||||
|
||||
local actions = require "lir.actions"
|
||||
local clipboard_actions = require "lir.clipboard.actions"
|
||||
local mark_actions = require "lir.mark.actions"
|
||||
|
||||
lir.setup {
|
||||
hide_cursor = true,
|
||||
show_hidden_files = true,
|
||||
devicons_enable = true,
|
||||
|
||||
mappings = {
|
||||
["l"] = actions.edit,
|
||||
["<C-s>"] = actions.split,
|
||||
["<C-v>"] = actions.vsplit,
|
||||
["<C-t>"] = actions.tabedit,
|
||||
|
||||
["h"] = actions.up,
|
||||
["q"] = actions.quit,
|
||||
|
||||
["K"] = actions.mkdir,
|
||||
["N"] = actions.newfile,
|
||||
["R"] = actions.rename,
|
||||
["@"] = actions.cd,
|
||||
["Y"] = actions.yank_path,
|
||||
["."] = actions.toggle_show_hidden,
|
||||
["D"] = actions.delete,
|
||||
|
||||
["J"] = function()
|
||||
mark_actions.toggle_mark()
|
||||
vim.cmd "normal! j"
|
||||
end,
|
||||
|
||||
["C"] = clipboard_actions.copy,
|
||||
["X"] = clipboard_actions.cut,
|
||||
["P"] = clipboard_actions.paste,
|
||||
},
|
||||
|
||||
float = {
|
||||
winblend = 0,
|
||||
curdir_window = {
|
||||
enable = false,
|
||||
highlight_dirname = false,
|
||||
},
|
||||
},
|
||||
|
||||
on_init = function()
|
||||
-- use visual mode
|
||||
vim.api.nvim_buf_set_keymap(
|
||||
0,
|
||||
"x",
|
||||
"J",
|
||||
':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
|
||||
-- echo cwd
|
||||
vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {})
|
||||
end,
|
||||
}
|
||||
|
||||
require("lir.git_status").setup {
|
||||
show_ignored = false,
|
||||
}
|
6
config/neovim/after/plugin/lualine.lua
Normal file
6
config/neovim/after/plugin/lualine.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local status_ok, lualine = pcall(require, "lualine")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
lualine.setup {}
|
95
config/neovim/after/plugin/luasnip.lua
Normal file
95
config/neovim/after/plugin/luasnip.lua
Normal file
|
@ -0,0 +1,95 @@
|
|||
if not pcall(require, "luasnip") then
|
||||
return
|
||||
end
|
||||
|
||||
local api = vim.api
|
||||
local fn = vim.fn
|
||||
|
||||
local ls = require "luasnip"
|
||||
|
||||
local snippet = ls.snippet
|
||||
local t = ls.text_node
|
||||
|
||||
local shortcut = function(val)
|
||||
if type(val) == "string" then
|
||||
return { t { val }, i(0) }
|
||||
end
|
||||
|
||||
if type(val) == "table" then
|
||||
for k, v in ipairs(val) do
|
||||
if type(v) == "string" then
|
||||
val[k] = t { v }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return val
|
||||
end
|
||||
|
||||
local make = function(tbl)
|
||||
local result = {}
|
||||
for k, v in pairs(tbl) do
|
||||
table.insert(result, (snippet({ trig = k, desc = v.desc }, shortcut(v))))
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local snippets = {}
|
||||
|
||||
for _, ft_path in ipairs(api.nvim_get_runtime_file("lua/opdavies/snippets/ft/*.lua", true)) do
|
||||
local ft = fn.fnamemodify(ft_path, ":t:r")
|
||||
snippets[ft] = make(loadfile(ft_path)())
|
||||
|
||||
ls.add_snippets(ft, snippets[ft])
|
||||
end
|
||||
|
||||
ls.add_snippets("js", snippets.javascript)
|
||||
ls.add_snippets("typescript", snippets.javascript)
|
||||
ls.add_snippets("vue", snippets.javascript)
|
||||
|
||||
ls.config.set_config {
|
||||
enable_autosnippets = true,
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
|
||||
local imap = require("opdavies.keymap").imap
|
||||
local map = require("opdavies.keymap").map
|
||||
local nmap = require("opdavies.keymap").nmap
|
||||
|
||||
-- Expand the current item or just to the next item within the snippet.
|
||||
map {
|
||||
{ "i", "s" },
|
||||
"<c-k>",
|
||||
function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end,
|
||||
{ silent = true },
|
||||
}
|
||||
|
||||
-- Jump backwards.
|
||||
map {
|
||||
{ "i", "s" },
|
||||
"<c-j>",
|
||||
function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end,
|
||||
{ silent = true },
|
||||
}
|
||||
|
||||
-- Select within a list of options.
|
||||
imap {
|
||||
"<c-l>",
|
||||
function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
nmap { "<leader><leader>s", "<cmd>source ~/.config/nvim/after/plugin/luasnip.lua<CR>" }
|
1
config/neovim/after/plugin/markdown-preview.lua
Normal file
1
config/neovim/after/plugin/markdown-preview.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.g.mkdp_refresh_slow = 1
|
17
config/neovim/after/plugin/nvim-rest.lua
Normal file
17
config/neovim/after/plugin/nvim-rest.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
local status_ok, rest_nvim = pcall(require, "rest-nvim")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local nmap = require("opdavies.keymap").nmap
|
||||
|
||||
-- Run the request.
|
||||
nmap { "<leader>rr", "require('rest-nvim').run()" }
|
||||
|
||||
-- Preview the request.
|
||||
nmap { "<leader>rp", "require('rest-nvim').run(true)" }
|
||||
|
||||
-- Re-run the last request.
|
||||
nmap { "<leader>rl", "require('rest-nvim').last()" }
|
||||
|
||||
rest_nvim.setup()
|
18
config/neovim/after/plugin/refactoring.lua
Normal file
18
config/neovim/after/plugin/refactoring.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local status_ok, refactoring = pcall(require, "refactoring")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local nmap = require("opdavies.keymap").nmap
|
||||
local vmap = require("opdavies.keymap").vmap
|
||||
|
||||
-- TODO: add keymaps - https://github.com/ThePrimeagen/refactoring.nvim#configuration-for-refactoring-operations
|
||||
refactoring.setup {}
|
||||
|
||||
local opts = { silent = true }
|
||||
|
||||
nmap { "<Leader>ri", "<Cmd>lua require 'refactoring'.refactor 'Inline Variable'<Cr>", opts }
|
||||
|
||||
vmap { "<Leader>re", "<Esc><Cmd>lua require 'refactoring'.refactor 'Extract Function'<Cr>", opts }
|
||||
vmap { "<Leader>ri", "<Esc><Cmd>lua require 'refactoring'.refactor 'Inline Variable'<Cr>", opts }
|
||||
vmap { "<Leader>rv", "<Esc><Cmd>lua require 'refactoring'.refactor 'Extract Variable'<Cr>", opts }
|
3
config/neovim/after/plugin/seiya.lua
Normal file
3
config/neovim/after/plugin/seiya.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
-- vim.g.seiya_auto_enable = 1
|
||||
|
||||
-- vim.g.seiya_target_groups = { "guibg" }
|
81
config/neovim/after/plugin/statusline.lua
Normal file
81
config/neovim/after/plugin/statusline.lua
Normal file
|
@ -0,0 +1,81 @@
|
|||
local status_ok, el = pcall(require, "el")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local builtin = require "el.builtin"
|
||||
local diagnostic = require "el.diagnostic"
|
||||
local extensions = require "el.extensions"
|
||||
local lsp_statusline = require "el.plugins.lsp_status"
|
||||
local sections = require "el.sections"
|
||||
local subscribe = require "el.subscribe"
|
||||
|
||||
local file_icon = subscribe.buf_autocmd("el_file_icon", "BufRead", function(_, buffer)
|
||||
return extensions.file_icon(_, buffer)
|
||||
end)
|
||||
|
||||
local git_branch = subscribe.buf_autocmd("el_git_branch", "BufEnter", function(window, buffer)
|
||||
local branch = extensions.git_branch(window, buffer)
|
||||
if branch then
|
||||
return " " .. extensions.git_icon() .. " " .. branch
|
||||
end
|
||||
end)
|
||||
|
||||
local git_changes = subscribe.buf_autocmd("el_git_changes", "BufWritePost", function(window, buffer)
|
||||
return extensions.git_changes(window, buffer)
|
||||
end)
|
||||
|
||||
local show_current_func = function(window, buffer)
|
||||
if buffer.filetype == "lua" then
|
||||
return ""
|
||||
end
|
||||
|
||||
return lsp_statusline.current_function(window, buffer)
|
||||
end
|
||||
|
||||
local diagnostic_display = diagnostic.make_buffer()
|
||||
|
||||
el.setup {
|
||||
generator = function(window, buffer)
|
||||
local mode = extensions.gen_mode { format_string = " %s " }
|
||||
|
||||
local items = {
|
||||
{ mode },
|
||||
{ git_branch },
|
||||
{ sections.split },
|
||||
{ file_icon },
|
||||
{ " " },
|
||||
{ sections.maximum_width(builtin.make_responsive_file(140, 90), 0.40) },
|
||||
{ sections.collapse_builtin { { " " }, { builtin.modified_flag } } },
|
||||
{ sections.split },
|
||||
{ diagnostic_display },
|
||||
{ show_current_func },
|
||||
{ git_changes },
|
||||
{ "[" },
|
||||
{ builtin.line_with_width(3) },
|
||||
{ ":" },
|
||||
{ builtin.column_with_width(2) },
|
||||
{ "]" },
|
||||
{
|
||||
sections.collapse_builtin {
|
||||
"[",
|
||||
builtin.help_list,
|
||||
builtin.readonly_list,
|
||||
"]",
|
||||
},
|
||||
},
|
||||
{ builtin.filetype },
|
||||
}
|
||||
|
||||
local add_item = function(result, item)
|
||||
table.insert(result, item)
|
||||
end
|
||||
|
||||
local result = {}
|
||||
for _, item in ipairs(items) do
|
||||
add_item(result, item)
|
||||
end
|
||||
|
||||
return result
|
||||
end,
|
||||
}
|
9
config/neovim/after/plugin/terminal.vim
Normal file
9
config/neovim/after/plugin/terminal.vim
Normal file
|
@ -0,0 +1,9 @@
|
|||
function! s:small_terminal() abort
|
||||
new
|
||||
wincmd J
|
||||
call nvim_win_set_height(0, 12)
|
||||
set winfixheight
|
||||
term
|
||||
endfunction
|
||||
|
||||
nnoremap <leader>st :call <SID>small_terminal()<CR>
|
6
config/neovim/after/plugin/todo-comments.lua
Normal file
6
config/neovim/after/plugin/todo-comments.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local status_ok, todo_comments = pcall(require, "todo-comments")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
todo_comments.setup {}
|
72
config/neovim/after/plugin/treesitter.lua
Normal file
72
config/neovim/after/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
local has_configs, configs = pcall(require, "nvim-treesitter.configs")
|
||||
if not has_configs then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local parser_install_dir = vim.fn.stdpath('data') .. "/site";
|
||||
|
||||
configs.setup {
|
||||
context_commenting = {
|
||||
enable = true,
|
||||
},
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"comment",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"go",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"make",
|
||||
"markdown",
|
||||
"php",
|
||||
"regex",
|
||||
"rst",
|
||||
"scss",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vue",
|
||||
"yaml",
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
disable = { "yaml" },
|
||||
enable = true,
|
||||
},
|
||||
matchup = {
|
||||
enable = true,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
},
|
||||
parser_install_dir = parser_install_dir,
|
||||
}
|
||||
|
||||
vim.opt.runtimepath:append(parser_install_dir)
|
||||
|
||||
local nmap = require("opdavies.keymap").nmap
|
||||
|
||||
nmap { "<leader>th", "<cmd>TSHighlightCapturesUnderCursor<CR>" }
|
||||
nmap { "<leader>tp", "<cmd>TSPlaygroundToggle<CR>" }
|
||||
|
||||
local has_context, context = pcall(require, "treesitter-context")
|
||||
if not has_context then
|
||||
return
|
||||
end
|
||||
|
||||
context.setup { enable = true }
|
8
config/neovim/after/plugin/twilight.lua
Normal file
8
config/neovim/after/plugin/twilight.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local status_ok, twilight = pcall(require, "twilight")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
twilight.setup {
|
||||
context = 2,
|
||||
}
|
15
config/neovim/after/plugin/vim-test.lua
Normal file
15
config/neovim/after/plugin/vim-test.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local map = vim.api.nvim_set_keymap
|
||||
|
||||
local options = {
|
||||
silent = true,
|
||||
}
|
||||
|
||||
map("n", "t<C-f>", ":TestFile<CR>", options)
|
||||
map("n", "t<C-g>", ":TestVisit<CR>", options)
|
||||
map("n", "t<C-l>", ":TestLast<CR>", options)
|
||||
map("n", "t<C-n>", ":TestNearest<CR>", options)
|
||||
map("n", "t<C-s>", ":TestSuite<CR>", options)
|
||||
|
||||
vim.g["test#echo_command"] = 0
|
||||
vim.g["test#neovim#start_normal"] = 1
|
||||
vim.g["test#strategy"] = "vimux"
|
25
config/neovim/after/plugin/zen-mode.lua
Normal file
25
config/neovim/after/plugin/zen-mode.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local status_ok, zen_mode = pcall(require, "zen-mode")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
zen_mode.setup {
|
||||
window = {
|
||||
backdrop = 0.95,
|
||||
height = 1,
|
||||
width = 80,
|
||||
options = {
|
||||
relativenumber = false,
|
||||
number = false,
|
||||
signcolumn = "no",
|
||||
},
|
||||
},
|
||||
plugins = {
|
||||
options = {
|
||||
enabled = true,
|
||||
ruler = false,
|
||||
},
|
||||
gitsigns = { enabled = true },
|
||||
tmux = { enabled = true },
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue