feat(neovim): from scratch!
This commit is contained in:
12
nvim/init.lua
Normal file
12
nvim/init.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
require("./mappings")
|
||||
require("./lazy")
|
||||
|
||||
-- Guard (Linters + Formatters)
|
||||
vim.g.guard_config = {
|
||||
fmt_on_save = true,
|
||||
lsp_as_default_formatter = true,
|
||||
save_on_fmt = true,
|
||||
}
|
||||
|
||||
-- Sync system clipboard and neovim register
|
||||
vim.opt.clipboard = { "unnamedplus" }
|
||||
13
nvim/lazy-lock.json
Normal file
13
nvim/lazy-lock.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"guard-collection": { "branch": "main", "commit": "06da4a065b974bbedf1a5535232c90a3526f8a43" },
|
||||
"guard.nvim": { "branch": "main", "commit": "bdbc43dadd530b0058708723db76e705a4542063" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
|
||||
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "38da5bbe1eaab2394056109e48c7e195bdb8fdfe" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "0179a89656b4ce395a4487c07ae385b8425524ae" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "f0267921c845c42685968401bc49aa65e18d3e09" },
|
||||
"nvim-window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "74ce793a60759e3db0d265174f137fb627430355" }
|
||||
}
|
||||
18
nvim/lazy.lua
Normal file
18
nvim/lazy.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup("plugins")
|
||||
83
nvim/lua/plugins/init.lua
Normal file
83
nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,83 @@
|
||||
return {
|
||||
{
|
||||
"nvimdev/guard.nvim",
|
||||
-- Builtin configuration, optional
|
||||
dependencies = {
|
||||
"nvimdev/guard-collection",
|
||||
},
|
||||
config = function()
|
||||
local ft = require("guard.filetype")
|
||||
ft("lua"):fmt("lsp"):append("stylua")
|
||||
ft("typescript,javascript,typescriptreact"):fmt("prettierd"):lint("eslint_d")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.x",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
|
||||
configs.setup({
|
||||
ensure_installed = { "lua", "javascript", "typescript", "html" },
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
{
|
||||
"s1n7ax/nvim-window-picker",
|
||||
version = "2.*",
|
||||
config = function()
|
||||
require("window-picker").setup({
|
||||
filter_rules = {
|
||||
include_current_win = false,
|
||||
autoselect_one = true,
|
||||
-- filter using buffer options
|
||||
bo = {
|
||||
-- if the file type is one of following, the window will be ignored
|
||||
filetype = { "neo-tree", "neo-tree-popup", "notify" },
|
||||
-- if the buffer type is one of following, the window will be ignored
|
||||
buftype = { "terminal", "quickfix" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = false,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require("lspconfig").lua_ls.setup({
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim", "require" } },
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
22
nvim/mappings.lua
Normal file
22
nvim/mappings.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Save --
|
||||
vim.keymap.set("n", "<C-s>", "<Cmd>w<CR>")
|
||||
|
||||
-- Split navigation --
|
||||
vim.keymap.set("n", "<C-h>", "<C-w>h")
|
||||
vim.keymap.set("n", "<C-j>", "<C-w>j")
|
||||
vim.keymap.set("n", "<C-k>", "<C-w>k")
|
||||
vim.keymap.set("n", "<C-l>", "<C-w>l")
|
||||
|
||||
-- Buffers --
|
||||
vim.keymap.set("n", "<leader>x", "<Cmd>bd<CR>")
|
||||
|
||||
-- Telescope Mappings --
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Telescope find files" })
|
||||
vim.keymap.set("n", "<leader>fw", builtin.live_grep, { desc = "Telescope live grep" })
|
||||
|
||||
-- Neo Tree --
|
||||
vim.keymap.set("n", "<C-n>", "<Cmd> Neotree toggle <CR>")
|
||||
vim.keymap.set("n", "<leader>e", "<Cmd> Neotree focus <CR>")
|
||||
Reference in New Issue
Block a user