mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-24 02:34:52 +00:00
refactor neovim into proper lua files
This commit is contained in:
parent
050cbfcba7
commit
a10e33c1e1
@ -1,13 +0,0 @@
|
||||
-- Bootstrap the Packer plugin manager
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
install_path,
|
||||
})
|
||||
end
|
@ -1,11 +0,0 @@
|
||||
-- Colorscheme
|
||||
use({
|
||||
"morhetz/gruvbox",
|
||||
config = function()
|
||||
vim.g.gruvbox_italic = 1
|
||||
vim.cmd([[
|
||||
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
|
||||
colorscheme gruvbox
|
||||
]])
|
||||
end,
|
||||
})
|
@ -1,87 +0,0 @@
|
||||
-- =======================================================================
|
||||
-- Completion System
|
||||
-- =======================================================================
|
||||
|
||||
-- Completion sources
|
||||
use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin
|
||||
use("hrsh7th/cmp-buffer") --- Generic text completion
|
||||
use("hrsh7th/cmp-path") --- Local file completion
|
||||
use("hrsh7th/cmp-cmdline") --- Command line completion
|
||||
use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion
|
||||
use("saadparwaiz1/cmp_luasnip") --- Luasnip completion
|
||||
use("lukas-reineke/cmp-rg") --- Ripgrep completion
|
||||
|
||||
-- Completion engine
|
||||
use({
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = { "L3MON4D3/LuaSnip" },
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<Esc>"] = function(fallback)
|
||||
cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
})
|
||||
vim.cmd("stopinsert") --- Abort and leave insert mode
|
||||
end,
|
||||
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
|
||||
-- ['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
["<C-r>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<C-l>"] = cmp.mapping(function(fallback)
|
||||
if require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer", keyword_length = 3, max_item_count = 10 },
|
||||
{
|
||||
name = "rg",
|
||||
keyword_length = 6,
|
||||
max_item_count = 10,
|
||||
option = { additional_arguments = "--ignore-case" },
|
||||
},
|
||||
},
|
||||
experimental = {
|
||||
native_menu = false, --- Use cmp menu instead of Vim menu
|
||||
ghost_text = true, --- Show preview auto-completion
|
||||
},
|
||||
})
|
||||
|
||||
-- Use buffer source for `/`
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(":", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
})
|
@ -10,37 +10,8 @@
|
||||
];
|
||||
|
||||
xdg.configFile = {
|
||||
"nvim/init.lua".text = lib.mkMerge [
|
||||
(lib.mkOrder 100 ''
|
||||
${builtins.readFile ./bootstrap.lua}
|
||||
require("packer").startup(function(use)
|
||||
${builtins.readFile ./packer-basics.lua}
|
||||
'')
|
||||
(lib.mkOrder 200 ''
|
||||
${builtins.readFile ./colors.lua}
|
||||
'')
|
||||
(lib.mkOrder 300 ''
|
||||
${builtins.readFile ./lsp.lua}
|
||||
'')
|
||||
(lib.mkOrder 400 ''
|
||||
${builtins.readFile ./completion.lua}
|
||||
'')
|
||||
(lib.mkOrder 500 ''
|
||||
${builtins.readFile ./syntax.lua}
|
||||
'')
|
||||
(lib.mkOrder 600 ''
|
||||
${builtins.readFile ./telescope.lua}
|
||||
'')
|
||||
(lib.mkOrder 700 ''
|
||||
${builtins.readFile ./packer-sync.lua}
|
||||
end)
|
||||
'')
|
||||
(lib.mkOrder 800 ''
|
||||
${builtins.readFile ./settings.lua}
|
||||
${builtins.readFile ./functions.lua}
|
||||
${builtins.readFile ./keybinds.lua}
|
||||
'')
|
||||
];
|
||||
"nvim/init.lua".source = ./init.lua;
|
||||
"nvim/lua".source = ./lua;
|
||||
};
|
||||
|
||||
programs.git.extraConfig.core.editor = "nvim";
|
||||
|
4
modules/editor/neovim/init.lua
Normal file
4
modules/editor/neovim/init.lua
Normal file
@ -0,0 +1,4 @@
|
||||
require("packer_init")
|
||||
require("settings")
|
||||
require("functions")
|
||||
require("keybinds")
|
@ -1,65 +0,0 @@
|
||||
-- =======================================================================
|
||||
-- Language Server
|
||||
-- =======================================================================
|
||||
|
||||
-- Language server engine
|
||||
use({
|
||||
"neovim/nvim-lspconfig",
|
||||
requires = { "hrsh7th/cmp-nvim-lsp" },
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require("lspconfig").rust_analyzer.setup({ capabilities = capabilities })
|
||||
require("lspconfig").tflint.setup({ capabilities = capabilities })
|
||||
require("lspconfig").terraformls.setup({ capabilities = capabilities })
|
||||
require("lspconfig").pyright.setup({
|
||||
on_attach = function()
|
||||
-- set keymaps (requires 0.7.0)
|
||||
-- vim.keymap.set("n", "", "", {buffer=0})
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Pretty highlights
|
||||
use("folke/lsp-colors.nvim")
|
||||
|
||||
-- Linting
|
||||
use({
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
config = function()
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua,
|
||||
require("null-ls").builtins.formatting.black,
|
||||
require("null-ls").builtins.formatting.fish_indent,
|
||||
require("null-ls").builtins.formatting.nixfmt,
|
||||
require("null-ls").builtins.formatting.rustfmt,
|
||||
require("null-ls").builtins.diagnostics.shellcheck,
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
extra_args = { "-i", "4", "-ci" },
|
||||
}),
|
||||
require("null-ls").builtins.formatting.terraform_fmt,
|
||||
-- require("null-ls").builtins.diagnostics.luacheck,
|
||||
-- require("null-ls").builtins.diagnostics.markdownlint,
|
||||
-- require("null-ls").builtins.diagnostics.pylint,
|
||||
},
|
||||
-- Format on save
|
||||
on_attach = function(client)
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.cmd([[
|
||||
augroup LspFormatting
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
17
modules/editor/neovim/lua/packer/colors.lua
Normal file
17
modules/editor/neovim/lua/packer/colors.lua
Normal file
@ -0,0 +1,17 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Colorscheme
|
||||
use({
|
||||
"morhetz/gruvbox",
|
||||
config = function()
|
||||
vim.g.gruvbox_italic = 1
|
||||
vim.cmd([[
|
||||
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
|
||||
colorscheme gruvbox
|
||||
]])
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
93
modules/editor/neovim/lua/packer/completion.lua
Normal file
93
modules/editor/neovim/lua/packer/completion.lua
Normal file
@ -0,0 +1,93 @@
|
||||
-- =======================================================================
|
||||
-- Completion System
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Completion sources
|
||||
use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin
|
||||
use("hrsh7th/cmp-buffer") --- Generic text completion
|
||||
use("hrsh7th/cmp-path") --- Local file completion
|
||||
use("hrsh7th/cmp-cmdline") --- Command line completion
|
||||
use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion
|
||||
use("saadparwaiz1/cmp_luasnip") --- Luasnip completion
|
||||
use("lukas-reineke/cmp-rg") --- Ripgrep completion
|
||||
|
||||
-- Completion engine
|
||||
use({
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = { "L3MON4D3/LuaSnip" },
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
||||
["<Esc>"] = function(fallback)
|
||||
cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
})
|
||||
vim.cmd("stopinsert") --- Abort and leave insert mode
|
||||
end,
|
||||
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
|
||||
-- ['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
["<C-r>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<C-l>"] = cmp.mapping(function(fallback)
|
||||
if require("luasnip").expand_or_jumpable() then
|
||||
require("luasnip").expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer", keyword_length = 3, max_item_count = 10 },
|
||||
{
|
||||
name = "rg",
|
||||
keyword_length = 6,
|
||||
max_item_count = 10,
|
||||
option = { additional_arguments = "--ignore-case" },
|
||||
},
|
||||
},
|
||||
experimental = {
|
||||
native_menu = false, --- Use cmp menu instead of Vim menu
|
||||
ghost_text = true, --- Show preview auto-completion
|
||||
},
|
||||
})
|
||||
|
||||
-- Use buffer source for `/`
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = {
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(":", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
73
modules/editor/neovim/lua/packer/lsp.lua
Normal file
73
modules/editor/neovim/lua/packer/lsp.lua
Normal file
@ -0,0 +1,73 @@
|
||||
-- =======================================================================
|
||||
-- Language Server
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Language server engine
|
||||
use({
|
||||
"neovim/nvim-lspconfig",
|
||||
requires = { "hrsh7th/cmp-nvim-lsp" },
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(
|
||||
vim.lsp.protocol.make_client_capabilities()
|
||||
)
|
||||
require("lspconfig").rust_analyzer.setup({ capabilities = capabilities })
|
||||
require("lspconfig").tflint.setup({ capabilities = capabilities })
|
||||
require("lspconfig").terraformls.setup({ capabilities = capabilities })
|
||||
require("lspconfig").pyright.setup({
|
||||
on_attach = function()
|
||||
-- set keymaps (requires 0.7.0)
|
||||
-- vim.keymap.set("n", "", "", {buffer=0})
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Pretty highlights
|
||||
use("folke/lsp-colors.nvim")
|
||||
|
||||
-- Linting
|
||||
use({
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
config = function()
|
||||
require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua,
|
||||
require("null-ls").builtins.formatting.black,
|
||||
require("null-ls").builtins.formatting.fish_indent,
|
||||
require("null-ls").builtins.formatting.nixfmt,
|
||||
require("null-ls").builtins.formatting.rustfmt,
|
||||
require("null-ls").builtins.diagnostics.shellcheck,
|
||||
require("null-ls").builtins.formatting.shfmt.with({
|
||||
extra_args = { "-i", "4", "-ci" },
|
||||
}),
|
||||
require("null-ls").builtins.formatting.terraform_fmt,
|
||||
-- require("null-ls").builtins.diagnostics.luacheck,
|
||||
-- require("null-ls").builtins.diagnostics.markdownlint,
|
||||
-- require("null-ls").builtins.diagnostics.pylint,
|
||||
},
|
||||
-- Format on save
|
||||
on_attach = function(client)
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.cmd([[
|
||||
augroup LspFormatting
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
29
modules/editor/neovim/lua/packer/misc.lua
Normal file
29
modules/editor/neovim/lua/packer/misc.lua
Normal file
@ -0,0 +1,29 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Important tweaks
|
||||
use("tpope/vim-surround") --- Manipulate parentheses
|
||||
|
||||
-- Convenience tweaks
|
||||
use("tpope/vim-eunuch") --- File manipulation in Vim
|
||||
use("tpope/vim-vinegar") --- Fixes netrw file explorer
|
||||
use("tpope/vim-fugitive") --- Git commands and syntax
|
||||
use("tpope/vim-repeat") --- Actually repeat using .
|
||||
use("christoomey/vim-tmux-navigator") --- Hotkeys for tmux panes
|
||||
|
||||
-- Use gc or gcc to add comments
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Alignment tool
|
||||
use("godlygeek/tabular")
|
||||
|
||||
-- Markdown renderer / wiki notes
|
||||
use("vimwiki/vimwiki")
|
||||
end
|
||||
|
||||
return M
|
56
modules/editor/neovim/lua/packer/speed.lua
Normal file
56
modules/editor/neovim/lua/packer/speed.lua
Normal file
@ -0,0 +1,56 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Startup speed hacks
|
||||
use({
|
||||
"lewis6991/impatient.nvim",
|
||||
config = function()
|
||||
require("impatient")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Improve speed and filetype detection
|
||||
use({
|
||||
"nathom/filetype.nvim",
|
||||
config = function()
|
||||
-- Filetype for .env files
|
||||
local envfiletype = function()
|
||||
vim.bo.filetype = "text"
|
||||
vim.bo.syntax = "sh"
|
||||
end
|
||||
-- Force filetype patterns that Vim doesn't know about
|
||||
require("filetype").setup({
|
||||
overrides = {
|
||||
extensions = {
|
||||
Brewfile = "brewfile",
|
||||
muttrc = "muttrc",
|
||||
tfvars = "terraform",
|
||||
tf = "terraform",
|
||||
},
|
||||
literal = {
|
||||
Caskfile = "brewfile",
|
||||
[".gitignore"] = "gitignore",
|
||||
config = "config",
|
||||
},
|
||||
complex = {
|
||||
[".*git/config"] = "gitconfig",
|
||||
["tmux.conf%..*link"] = "tmux",
|
||||
["gitconfig%..*link"] = "gitconfig",
|
||||
[".*ignore%..*link"] = "gitignore",
|
||||
[".*%.toml%..*link"] = "toml",
|
||||
},
|
||||
function_extensions = {},
|
||||
function_literal = {
|
||||
[".envrc"] = envfiletype,
|
||||
[".env"] = envfiletype,
|
||||
[".env.dev"] = envfiletype,
|
||||
[".env.prod"] = envfiletype,
|
||||
[".env.example"] = envfiletype,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
37
modules/editor/neovim/lua/packer/syntax.lua
Normal file
37
modules/editor/neovim/lua/packer/syntax.lua
Normal file
@ -0,0 +1,37 @@
|
||||
-- =======================================================================
|
||||
-- Syntax
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Syntax engine
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"hcl",
|
||||
"python",
|
||||
"lua",
|
||||
"nix",
|
||||
"fish",
|
||||
"toml",
|
||||
"yaml",
|
||||
"json",
|
||||
},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Additional syntax sources
|
||||
use("bfontaine/Brewfile.vim") --- Brewfile syntax
|
||||
use("chr4/nginx.vim") --- Nginx syntax
|
||||
use("towolf/vim-helm") --- Helm syntax
|
||||
use("rodjek/vim-puppet") --- Puppet syntax
|
||||
end
|
||||
|
||||
return M
|
73
modules/editor/neovim/lua/packer/telescope.lua
Normal file
73
modules/editor/neovim/lua/packer/telescope.lua
Normal file
@ -0,0 +1,73 @@
|
||||
-- =======================================================================
|
||||
-- Fuzzy Launcher
|
||||
-- =======================================================================
|
||||
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "master",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
-- Telescope: quit instantly with escape
|
||||
local actions = require("telescope.actions")
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
["<C-h>"] = "which_key",
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = { theme = "ivy" },
|
||||
oldfiles = { theme = "ivy" },
|
||||
buffers = { theme = "dropdown" },
|
||||
},
|
||||
extensions = {
|
||||
fzy_native = {},
|
||||
tmux = {},
|
||||
zoxide = {},
|
||||
--neoclip = {},
|
||||
project = {
|
||||
base_dirs = { "~/dev" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Faster sorting
|
||||
use("nvim-telescope/telescope-fzy-native.nvim")
|
||||
|
||||
-- Jump around tmux sessions
|
||||
use("camgraff/telescope-tmux.nvim")
|
||||
|
||||
-- Jump directories
|
||||
use({
|
||||
"jvgrootveld/telescope-zoxide",
|
||||
requires = { "nvim-lua/popup.nvim" },
|
||||
})
|
||||
|
||||
-- Jump projects
|
||||
use({
|
||||
"nvim-telescope/telescope-project.nvim",
|
||||
requires = { "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
require("telescope").load_extension("project")
|
||||
end,
|
||||
})
|
||||
|
||||
-- File browser
|
||||
use({
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
requires = { "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
require("telescope").load_extension("file_browser")
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
40
modules/editor/neovim/lua/packer/visuals.lua
Normal file
40
modules/editor/neovim/lua/packer/visuals.lua
Normal file
@ -0,0 +1,40 @@
|
||||
local M = {}
|
||||
|
||||
M.packer = function(use)
|
||||
-- Git next to line numbers
|
||||
use({
|
||||
"lewis6991/gitsigns.nvim",
|
||||
branch = "main",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Status bar
|
||||
use({
|
||||
"hoob3rt/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "gruvbox",
|
||||
icons_enabled = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Markdown pretty view
|
||||
use("ellisonleao/glow.nvim")
|
||||
|
||||
-- Hex color previews
|
||||
use({
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require("colorizer").setup()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
33
modules/editor/neovim/lua/packer_init.lua
Normal file
33
modules/editor/neovim/lua/packer_init.lua
Normal file
@ -0,0 +1,33 @@
|
||||
-- Bootstrap the Packer plugin manager
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
install_path,
|
||||
})
|
||||
end
|
||||
|
||||
require("packer").startup(function(use)
|
||||
-- Maintain plugin manager
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
-- Include other files initialized by packer
|
||||
require("packer.speed").packer(use)
|
||||
require("packer.misc").packer(use)
|
||||
require("packer.colors").packer(use)
|
||||
require("packer.visuals").packer(use)
|
||||
require("packer.lsp").packer(use)
|
||||
require("packer.completion").packer(use)
|
||||
require("packer.syntax").packer(use)
|
||||
require("packer.telescope").packer(use)
|
||||
|
||||
-- Auto-install after bootstrapping
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
@ -1,112 +0,0 @@
|
||||
-- Maintain plugin manager
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
-- Startup speed hacks
|
||||
use({
|
||||
"lewis6991/impatient.nvim",
|
||||
config = function()
|
||||
require("impatient")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Important tweaks
|
||||
use("tpope/vim-surround") --- Manipulate parentheses
|
||||
|
||||
-- Convenience tweaks
|
||||
use("tpope/vim-eunuch") --- File manipulation in Vim
|
||||
use("tpope/vim-vinegar") --- Fixes netrw file explorer
|
||||
use("tpope/vim-fugitive") --- Git commands and syntax
|
||||
use("tpope/vim-repeat") --- Actually repeat using .
|
||||
use("christoomey/vim-tmux-navigator") --- Hotkeys for tmux panes
|
||||
|
||||
-- Use gc or gcc to add comments
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Git next to line numbers
|
||||
use({
|
||||
"lewis6991/gitsigns.nvim",
|
||||
branch = "main",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Status bar
|
||||
use({
|
||||
"hoob3rt/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = "gruvbox",
|
||||
icons_enabled = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Improve speed and filetype detection
|
||||
use({
|
||||
"nathom/filetype.nvim",
|
||||
config = function()
|
||||
-- Filetype for .env files
|
||||
local envfiletype = function()
|
||||
vim.bo.filetype = "text"
|
||||
vim.bo.syntax = "sh"
|
||||
end
|
||||
-- Force filetype patterns that Vim doesn't know about
|
||||
require("filetype").setup({
|
||||
overrides = {
|
||||
extensions = {
|
||||
Brewfile = "brewfile",
|
||||
muttrc = "muttrc",
|
||||
tfvars = "terraform",
|
||||
tf = "terraform",
|
||||
},
|
||||
literal = {
|
||||
Caskfile = "brewfile",
|
||||
[".gitignore"] = "gitignore",
|
||||
config = "config",
|
||||
},
|
||||
complex = {
|
||||
[".*git/config"] = "gitconfig",
|
||||
["tmux.conf%..*link"] = "tmux",
|
||||
["gitconfig%..*link"] = "gitconfig",
|
||||
[".*ignore%..*link"] = "gitignore",
|
||||
[".*%.toml%..*link"] = "toml",
|
||||
},
|
||||
function_extensions = {},
|
||||
function_literal = {
|
||||
[".envrc"] = envfiletype,
|
||||
[".env"] = envfiletype,
|
||||
[".env.dev"] = envfiletype,
|
||||
[".env.prod"] = envfiletype,
|
||||
[".env.example"] = envfiletype,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Alignment tool
|
||||
use("godlygeek/tabular")
|
||||
|
||||
-- Markdown renderer / wiki notes
|
||||
use("vimwiki/vimwiki")
|
||||
|
||||
-- Markdown pretty view
|
||||
use("ellisonleao/glow.nvim")
|
||||
|
||||
-- Hex color previews
|
||||
use({
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require("colorizer").setup()
|
||||
end,
|
||||
})
|
@ -1,6 +0,0 @@
|
||||
-- =======================================================================
|
||||
|
||||
-- Install on initial bootstrap
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
@ -1,31 +0,0 @@
|
||||
-- =======================================================================
|
||||
-- Syntax
|
||||
-- =======================================================================
|
||||
|
||||
-- Syntax engine
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"hcl",
|
||||
"python",
|
||||
"lua",
|
||||
"nix",
|
||||
"fish",
|
||||
"toml",
|
||||
"yaml",
|
||||
"json",
|
||||
},
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Additional syntax sources
|
||||
use("bfontaine/Brewfile.vim") --- Brewfile syntax
|
||||
use("chr4/nginx.vim") --- Nginx syntax
|
||||
use("towolf/vim-helm") --- Helm syntax
|
||||
use("rodjek/vim-puppet") --- Puppet syntax
|
@ -1,67 +0,0 @@
|
||||
-- =======================================================================
|
||||
-- Fuzzy Launcher
|
||||
-- =======================================================================
|
||||
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "master",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
-- Telescope: quit instantly with escape
|
||||
local actions = require("telescope.actions")
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
["<C-h>"] = "which_key",
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = { theme = "ivy" },
|
||||
oldfiles = { theme = "ivy" },
|
||||
buffers = { theme = "dropdown" },
|
||||
},
|
||||
extensions = {
|
||||
fzy_native = {},
|
||||
tmux = {},
|
||||
zoxide = {},
|
||||
--neoclip = {},
|
||||
project = {
|
||||
base_dirs = { "~/dev" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Faster sorting
|
||||
use("nvim-telescope/telescope-fzy-native.nvim")
|
||||
|
||||
-- Jump around tmux sessions
|
||||
use("camgraff/telescope-tmux.nvim")
|
||||
|
||||
-- Jump directories
|
||||
use({
|
||||
"jvgrootveld/telescope-zoxide",
|
||||
requires = { "nvim-lua/popup.nvim" },
|
||||
})
|
||||
|
||||
-- Jump projects
|
||||
use({
|
||||
"nvim-telescope/telescope-project.nvim",
|
||||
requires = { "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
require("telescope").load_extension("project")
|
||||
end,
|
||||
})
|
||||
|
||||
-- File browser
|
||||
use({
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
requires = { "nvim-telescope/telescope.nvim" },
|
||||
config = function()
|
||||
require("telescope").load_extension("file_browser")
|
||||
end,
|
||||
})
|
Loading…
Reference in New Issue
Block a user