feat: adding tmux and renaming config folder
This commit is contained in:
111
config/nvim/init.lua
Normal file
111
config/nvim/init.lua
Normal file
@@ -0,0 +1,111 @@
|
||||
-- Leader
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- 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" }
|
||||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
--
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Remove sign column (LSP gutter on the left)
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
-- Line Numbers
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Tabs
|
||||
|
||||
vim.o.tabstop = 4 -- A TAB character looks like 4 spaces
|
||||
vim.o.expandtab = true -- Pressing the TAB key will insert spaces instead of a TAB character
|
||||
vim.o.softtabstop = 4 -- Number of spaces inserted instead of a TAB character
|
||||
vim.o.shiftwidth = 4 -- Number of spaces inserted when indenting
|
||||
|
||||
-- Modules --
|
||||
|
||||
-- Lazy = Package Manager --
|
||||
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")
|
||||
|
||||
-- LSP Ignore error
|
||||
for _, method in ipairs({ "textDocument/diagnostic", "workspace/diagnostic" }) do
|
||||
local default_diagnostic_handler = vim.lsp.handlers[method]
|
||||
vim.lsp.handlers[method] = function(err, result, context, config)
|
||||
if err ~= nil and err.code == -32802 then
|
||||
return
|
||||
end
|
||||
return default_diagnostic_handler(err, result, context, config)
|
||||
end
|
||||
end
|
||||
|
||||
-- Mappings
|
||||
|
||||
-- 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" })
|
||||
vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope live buffers" })
|
||||
|
||||
-- Neo Tree --
|
||||
vim.keymap.set("n", "<C-n>", "<Cmd> Neotree toggle <CR>")
|
||||
vim.keymap.set("n", "<leader>e", "<Cmd> Neotree focus <CR>")
|
||||
|
||||
-- LSP --
|
||||
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition)
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action)
|
||||
vim.keymap.set("n", "<leader>ra", vim.lsp.buf.rename)
|
||||
vim.keymap.set("n", "<leader>lf", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references)
|
||||
|
||||
-- Search --
|
||||
vim.keymap.set("n", "<ESC>", "<Cmd> noh <CR>")
|
||||
|
||||
-- Tmux navigator --
|
||||
vim.keymap.set("n", "<c-h>", "<cmd>TmuxNavigateLeft<cr>")
|
||||
vim.keymap.set("n", "<c-j>", "<cmd>TmuxNavigateDown<cr>")
|
||||
vim.keymap.set("n", "<c-k>", "<cmd>TmuxNavigateUp<cr>")
|
||||
vim.keymap.set("n", "<c-l>", "<cmd>TmuxNavigateRight<cr>")
|
||||
vim.keymap.set("n", "<c-\\>", "<cmd>TmuxNavigatePrevious<cr>")
|
||||
|
||||
-- Floating Terminal --
|
||||
vim.keymap.set("n", "<A-k>", "<cmd>ToggleTerm direction=float<cr>")
|
||||
vim.keymap.set("t", "<A-k>", "<cmd>ToggleTerm direction=float<cr>")
|
||||
17
config/nvim/lazy-lock.json
Normal file
17
config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"everblush": { "branch": "main", "commit": "9a0e695fdd57b340d3ba2b72406e3ca519029f25" },
|
||||
"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-cmp": { "branch": "main", "commit": "d3a3056204e1a9dbb7c7fe36c114dc43b681768c" },
|
||||
"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" },
|
||||
"vim-vsnip": { "branch": "master", "commit": "02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9" }
|
||||
}
|
||||
193
config/nvim/lua/plugins/init.lua
Normal file
193
config/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,193 @@
|
||||
return {
|
||||
{ "wakatime/vim-wakatime", lazy = false },
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
config = function()
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
rust = { "rustfmt", lsp_format = "fallback" },
|
||||
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
},
|
||||
{ "akinsho/toggleterm.nvim", version = "*", config = true },
|
||||
{
|
||||
"christoomey/vim-tmux-navigator",
|
||||
cmd = {
|
||||
"TmuxNavigateLeft",
|
||||
"TmuxNavigateDown",
|
||||
"TmuxNavigateUp",
|
||||
"TmuxNavigateRight",
|
||||
"TmuxNavigatePrevious",
|
||||
},
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"sainnhe/gruvbox-material",
|
||||
lazy = false,
|
||||
config = function()
|
||||
-- Optionally configure and load the colorscheme
|
||||
-- directly inside the plugin declaration.
|
||||
vim.g.gruvbox_material_enable_italic = true
|
||||
vim.g.gruvbox_material_background = "hard"
|
||||
vim.cmd.colorscheme("gruvbox-material")
|
||||
end,
|
||||
},
|
||||
{ "hrsh7th/vim-vsnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
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(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
-- require("telescope").load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
|
||||
configs.setup({
|
||||
ensure_installed = { "lua", "javascript", "typescript", "html", "tsx", "zig" },
|
||||
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({
|
||||
filesystem = {
|
||||
follow_current_file = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
close_if_last_window = false,
|
||||
})
|
||||
vim.cmd([[nnoremap \ :Neotree reveal<cr>]])
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = { "hrsh7th/cmp-nvim-lsp" },
|
||||
config = function()
|
||||
local lsp = require("lspconfig")
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
lsp.lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim", "require" } },
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.vtsls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lsp.zls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
lsp.rust_analyzer.setup({
|
||||
capabilities = capabilities,
|
||||
diagnostic = {
|
||||
-- Prevents the annoying popup for cancalled requests
|
||||
refreshSupport = false,
|
||||
},
|
||||
})
|
||||
|
||||
lsp.gopls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.tailwindcss.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.ocamllsp.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.svelte.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lsp.biome.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"sindrets/diffview.nvim",
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user