1
0
mirror of https://github.com/danbee/dotfiles-local synced 2025-03-04 08:49:07 +00:00

Rejig config

This commit is contained in:
Daniel Barber 2023-06-08 12:18:31 -05:00
parent b09c8ab204
commit b5c9203263
18 changed files with 323 additions and 279 deletions

View File

@ -17,6 +17,7 @@ keymap(
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
-- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"

View File

@ -0,0 +1,7 @@
return {
"MaximilianLloyd/ascii.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
},
}

View File

@ -1,24 +1,30 @@
return function()
require("dashboard").setup({
theme = "hyper",
config = {
header = {
[[ . . ]],
[[ ';;,. ::' ]],
[[ ,:::;,, :ccc, ]],
[[,::c::,,,,. :cccc,]],
[[,cccc:;;;;;. cllll,]],
[[,cccc;.;;;;;, cllll;]],
[[:cccc; .;;;;;;. coooo;]],
[[;llll; ,:::::'loooo;]],
[[;llll: ':::::loooo:]],
[[:oooo: .::::llodd:]],
[[.;ooo: ;cclooo:.]],
[[ .;oc 'coo;. ]],
[[ .' .,. ]],
[[]],
[[]],
return {
"glepnir/dashboard-nvim",
event = "VimEnter",
config = function()
require("dashboard").setup({
theme = "hyper",
config = {
header = {
[[ . . ]],
[[ ';;,. ::' ]],
[[ ,:::;,, :ccc, ]],
[[,::c::,,,,. :cccc,]],
[[,cccc:;;;;;. cllll,]],
[[,cccc;.;;;;;, cllll;]],
[[:cccc; .;;;;;;. coooo;]],
[[;llll; ,:::::'loooo;]],
[[;llll: ':::::loooo:]],
[[:oooo: .::::llodd:]],
[[.;ooo: ;cclooo:.]],
[[ .;oc 'coo;. ]],
[[ .' .,. ]],
[[]],
[[]],
},
},
},
})
end
})
end,
}

View File

@ -0,0 +1,7 @@
return {
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end,
}

View File

@ -1,8 +1,12 @@
return function()
require("config.plugins.lspconfig.elixir")
require("config.plugins.lspconfig.emmet")
require("config.plugins.lspconfig.javascript")
require("config.plugins.lspconfig.lua")
require("config.plugins.lspconfig.ruby")
require("config.plugins.lspconfig.rust")
end
return {
"neovim/nvim-lspconfig",
config = function()
require("config.plugins.lspconfig.elixir")
require("config.plugins.lspconfig.emmet")
require("config.plugins.lspconfig.javascript")
require("config.plugins.lspconfig.lua")
require("config.plugins.lspconfig.ruby")
require("config.plugins.lspconfig.rust")
end,
}

View File

@ -1,3 +1,9 @@
return function()
require("lualine").setup()
end
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("lualine").setup()
end,
}

View File

@ -0,0 +1,7 @@
return {
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
}

View File

@ -1,8 +1,18 @@
return function()
-- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
return {
"nvim-neo-tree/neo-tree.nvim",
require("neo-tree").setup({
hijack_netrw_behavior = "open_default",
})
end
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
config = function()
-- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
require("neo-tree").setup({
hijack_netrw_behavior = "open_default",
})
end,
}

View File

@ -1,39 +1,45 @@
return function()
local null_ls = require("null-ls")
return {
"jose-elias-alvarez/null-ls.nvim",
null_ls.setup({
sources = {
null_ls.builtins.formatting.crystal_format,
null_ls.builtins.formatting.prettierd.with({
filetypes = {
"css",
"graphql",
"handlebars",
"html",
"javascript",
"javascriptreact",
"json",
"jsonc",
"less",
"markdown",
"markdown.mdx",
"ruby",
"scss",
"typescript",
"typescriptreact",
"vue",
"yaml",
},
timeout = 5000,
}),
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.standardrb,
null_ls.builtins.formatting.stylua,
},
})
dependencies = { "nvim-lua/plenary.nvim" },
-- Format on save
vim.api.nvim_create_autocmd("BufWritePre", {
command = "lua vim.lsp.buf.format()",
})
end
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.crystal_format,
null_ls.builtins.formatting.prettierd.with({
filetypes = {
"css",
"graphql",
"handlebars",
"html",
"javascript",
"javascriptreact",
"json",
"jsonc",
"less",
"markdown",
"markdown.mdx",
"ruby",
"scss",
"typescript",
"typescriptreact",
"vue",
"yaml",
},
timeout = 5000,
}),
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.standardrb,
null_ls.builtins.formatting.stylua,
},
})
-- Format on save
vim.api.nvim_create_autocmd("BufWritePre", {
command = "lua vim.lsp.buf.format()",
})
end,
}

View File

@ -1,54 +1,66 @@
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
return col ~= 0
and vim.api
.nvim_buf_get_lines(0, line - 1, line, true)[1]
:sub(col, col)
:match("%s")
== nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes(key, true, true, true),
mode,
true
)
end
return function()
local cmp = require("cmp")
return {
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" })
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "vsnip" },
}, {
{ name = "buffer" },
}),
})
end
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "vsnip" },
}, {
{ name = "buffer" },
}),
})
end,
}

View File

@ -0,0 +1,7 @@
return {
"klen/nvim-test",
config = function()
require("nvim-test").setup()
end,
}

View File

@ -0,0 +1,82 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
{
"nvim-treesitter/nvim-treesitter-textobjects",
init = function()
-- PERF: no need to load the plugin,
-- if we only need its queries for mini.ai
local plugin =
require("lazy.core.config").spec.plugins["nvim-treesitter"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
local enabled = false
if opts.textobjects then
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
if opts.textobjects[mod] and opts.textobjects[mod].enable then
enabled = true
break
end
end
end
if not enabled then
require("lazy.core.loader").disable_rtp_plugin(
"nvim-treesitter-textobjects"
)
end
end,
},
"JoosepAlviste/nvim-ts-context-commentstring",
"RRethy/nvim-treesitter-endwise",
},
config = function()
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
indent = { enable = true },
endwise = { enable = true },
context_commentstring = { enable = true },
auto_install = true,
sync_install = false,
ensure_installed = {
"bash",
"c",
"comment",
"css",
"dockerfile",
"eex",
"elixir",
"html",
"javascript",
"json",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"ruby",
"rust",
"scss",
"sql",
"swift",
"toml",
"tsx",
"typescript",
"vim",
"vue",
"yaml",
},
})
end,
},
}

View File

@ -0,0 +1,5 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
}

View File

@ -1,41 +0,0 @@
return function()
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
indent = { enable = true },
endwise = { enable = true },
context_commentstring = { enable = true },
auto_install = true,
sync_install = false,
ensure_installed = {
"bash",
"c",
"comment",
"css",
"dockerfile",
"eex",
"elixir",
"html",
"javascript",
"json",
"lua",
"luadoc",
"luap",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"ruby",
"rust",
"scss",
"sql",
"swift",
"toml",
"tsx",
"typescript",
"vim",
"vue",
"yaml",
},
})
end

View File

@ -1,3 +1,9 @@
return function()
require("treesj").setup()
end
return {
"Wansmer/treesj",
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("treesj").setup()
end,
}

View File

@ -1,10 +1,14 @@
return function()
vim.o.timeout = true
vim.o.timeoutlen = 300
return {
"folke/which-key.nvim",
require("which-key").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
})
end
config = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
require("which-key").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
})
end,
}

View File

@ -1,74 +1,24 @@
return {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-vsnip",
"hrsh7th/vim-vsnip",
"tpope/vim-fugitive",
"preservim/nerdcommenter",
{
"Wansmer/treesj",
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = require("config.plugins.treesj"),
},
{
"MaximilianLloyd/ascii.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
},
},
{
"glepnir/dashboard-nvim",
event = "VimEnter",
config = require("config.plugins.dashboard"),
dependencies = { { "nvim-tree/nvim-web-devicons" } },
},
{
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup()
end,
},
{
"hrsh7th/nvim-cmp",
config = require("config.plugins.nvim-cmp"),
},
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"neovim/nvim-lspconfig",
config = require("config.plugins.lspconfig"),
},
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = require("config.plugins.lualine"),
},
{
"nvim-neo-tree/neo-tree.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
config = require("config.plugins.neo-tree"),
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
{
"folke/which-key.nvim",
config = require("config.plugins.which-key"),
},
{
"jose-elias-alvarez/null-ls.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = require("config.plugins.null-ls"),
},
"tpope/vim-fugitive",
require("config.plugins.ascii"),
require("config.plugins.dashboard"),
require("config.plugins.gitsigns"),
require("config.plugins.lspconfig"),
require("config.plugins.lualine"),
require("config.plugins.mason"),
require("config.plugins.neo-tree"),
require("config.plugins.null-ls"),
require("config.plugins.nvim-cmp"),
require("config.plugins.nvim-test"),
require("config.plugins.nvim-treesitter"),
require("config.plugins.telescope"),
require("config.plugins.treesj"),
require("config.plugins.which-key"),
}

View File

@ -1,35 +0,0 @@
return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
{
"nvim-treesitter/nvim-treesitter-textobjects",
init = function()
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
local plugin =
require("lazy.core.config").spec.plugins["nvim-treesitter"]
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
local enabled = false
if opts.textobjects then
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
if opts.textobjects[mod] and opts.textobjects[mod].enable then
enabled = true
break
end
end
end
if not enabled then
require("lazy.core.loader").disable_rtp_plugin(
"nvim-treesitter-textobjects"
)
end
end,
},
"JoosepAlviste/nvim-ts-context-commentstring",
"RRethy/nvim-treesitter-endwise",
},
config = require("config.plugins.tree-sitter"),
},
}