new and improved nvim config

+5
.luarc.json
···
+
{
+
"diagnostics.globals": [
+
"vim"
+
]
+
}
+2
init.lua
···
+
-- Trey's super simple neovim config
+
require("config")
+21
lua/config/conform.lua
···
+
local vim = vim
+
vim.pack.add({
+
"https://github.com/stevearc/conform.nvim",
+
})
+
+
vim.keymap.set("n", "<leader>bf", function()
+
require("conform").format({
+
async = true,
+
lsp_format = "fallback",
+
})
+
end)
+
+
require("conform").setup({
+
formatters_by_ft = {
+
lua = { "stylua" }, -- os package manager stylua
+
},
+
format_on_save = {
+
timeout_ms = 1001,
+
lsp_format = "fallback",
+
},
+
})
+6
lua/config/init.lua
···
+
require("config.opts")
+
require("config.keys")
+
require("config.plugins")
+
require("config.lsp")
+
require("config.telescope")
+
require("config.conform")
+11
lua/config/keys.lua
···
+
local vim = vim
+
+
vim.g.mapleader = " "
+
vim.g.maplocalleader = ","
+
+
vim.keymap.set("x", "p", [["_dP]])
+
vim.keymap.set("v", "<Tab>", ">gv")
+
vim.keymap.set("v", "<S-Tab>", "<gv")
+
vim.keymap.set("n", "<Tab>", "v><C-\\><C-N>")
+
vim.keymap.set("n", "<S-Tab>", "v<<C-\\><C-N>")
+
vim.keymap.set("i", "<S-Tab>", "<C-\\><C-N>v<<C-\\><C-N>^i")
+14
lua/config/lsp.lua
···
+
local vim = vim
+
+
vim.pack.add({
+
{ src = "https://github.com/saghen/blink.cmp", version = vim.version.range("*") },
+
"https://github.com/neovim/nvim-lspconfig",
+
"https://github.com/rafamadriz/friendly-snippets",
+
})
+
+
vim.lsp.enable({
+
"bashls", -- npm install -g bash-language-server
+
"lua_ls", -- os pkg manager lua-language-server
+
})
+
+
require("blink.cmp").setup({})
+23
lua/config/opts.lua
···
+
-- options
+
local o = vim.opt
+
o.expandtab = true
+
o.signcolumn = "yes"
+
o.nu = true
+
o.relativenumber = true
+
o.tabstop = 4
+
o.softtabstop = 4
+
o.shiftwidth = 2
+
o.expandtab = true
+
o.smartindent = true
+
o.wrap = false
+
o.swapfile = false
+
o.backup = false
+
o.undofile = true
+
o.undodir = vim.fn.stdpath("data") .. "/undodir"
+
o.hlsearch = false
+
o.incsearch = true
+
o.clipboard = "unnamedplus"
+
o.colorcolumn = "80"
+
o.pumheight = 15
+
o.updatetime = 50
+
o.scrolloff = 8
+11
lua/config/plugins.lua
···
+
-- plugins that require no configuration
+
vim.pack.add({
+
"https://github.com/tpope/vim-fugitive",
+
"https://github.com/tpope/vim-eunuch",
+
"https://github.com/jessarcher/vim-heritage",
+
"https://github.com/windwp/nvim-autopairs",
+
"https://github.com/kylechui/nvim-surround",
+
})
+
+
require("nvim-autopairs").setup()
+
require("nvim-surround").setup()
+14
lua/config/telescope.lua
···
+
local vim = vim
+
vim.pack.add({
+
"https://github.com/nvim-lua/plenary.nvim",
+
"https://github.com/nvim-telescope/telescope.nvim",
+
})
+
+
require("telescope").setup()
+
+
local builtin = require("telescope.builtin")
+
vim.keymap.set("n", "<leader>ff", builtin.find_files)
+
vim.keymap.set("n", "<leader>fg", builtin.git_files)
+
vim.keymap.set("n", "<leader>fb", builtin.buffers)
+
vim.keymap.set("n", "<leader>fh", builtin.help_tags)
+
vim.keymap.set("n", "<leader><leader>", builtin.live_grep)
+28
lua/config/treesitter.lua
···
+
local vim = vim
+
vim.pack.add({
+
"https://github.com/windwp/nvim-ts-autotag",
+
"https://github.com/HiPhish/rainbow-delimiters.nvim",
+
"https://github.com/RRethy/nvim-treesitter-endwise",
+
"https://github.com/nvim-treesitter/nvim-treesitter-context",
+
"https://github.com/nvim-treesitter/nvim-treesitter",
+
})
+
+
require("nvim-treesitter").setup({
+
sync_install = false,
+
auto_install = true,
+
highlight = { enable = true },
+
autotag = { enable = true },
+
rainbow = { enable = true, extended_mode = true },
+
indent = { enable = true },
+
endwise = { enable = true },
+
})
+
+
vim.api.nvim_create_autocmd("PackChanged", {
+
callback = function()
+
vim.cmd("TSUpdate")
+
end,
+
})
+
+
require("treesitter-context").setup({
+
max_lines = 4,
+
})
+65
nvim-pack-lock.json
···
+
{
+
"plugins": {
+
"blink.cmp": {
+
"rev": "327fff9",
+
"src": "https://github.com/saghen/blink.cmp",
+
"version": ">=0.0.0"
+
},
+
"conform.nvim": {
+
"rev": "9fd3d5e",
+
"src": "https://github.com/stevearc/conform.nvim"
+
},
+
"friendly-snippets": {
+
"rev": "572f566",
+
"src": "https://github.com/rafamadriz/friendly-snippets"
+
},
+
"nvim-autopairs": {
+
"rev": "7a2c97c",
+
"src": "https://github.com/windwp/nvim-autopairs"
+
},
+
"nvim-lspconfig": {
+
"rev": "cbd1e91"
+
},
+
"nvim-surround": {
+
"rev": "fcfa7e0",
+
"src": "https://github.com/kylechui/nvim-surround"
+
},
+
"nvim-treesitter": {
+
"rev": "42fc28ba",
+
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
+
},
+
"nvim-treesitter-context": {
+
"rev": "ec308c7",
+
"src": "https://github.com/nvim-treesitter/nvim-treesitter-context"
+
},
+
"nvim-treesitter-endwise": {
+
"rev": "a61a9de",
+
"src": "https://github.com/RRethy/nvim-treesitter-endwise"
+
},
+
"nvim-ts-autotag": {
+
"rev": "c4ca798",
+
"src": "https://github.com/windwp/nvim-ts-autotag"
+
},
+
"plenary.nvim": {
+
"rev": "b9fd522",
+
"src": "https://github.com/nvim-lua/plenary.nvim"
+
},
+
"rainbow-delimiters.nvim": {
+
"rev": "b6b3c9e",
+
"src": "https://github.com/HiPhish/rainbow-delimiters.nvim"
+
},
+
"telescope.nvim": {
+
"rev": "b4da76b",
+
"src": "https://github.com/nvim-telescope/telescope.nvim"
+
},
+
"vim-eunuch": {
+
"rev": "e86bb79",
+
"src": "https://github.com/tpope/vim-eunuch"
+
},
+
"vim-fugitive": [],
+
"vim-heritage": {
+
"rev": "574baeb",
+
"src": "https://github.com/jessarcher/vim-heritage"
+
}
+
}
+
}