mirror of
https://github.com/josean-dev/dev-environment-files.git
synced 2025-01-08 01:11:12 +01:00
New nvim setup for 2024 youtube video
This commit is contained in:
parent
01d6e00c68
commit
e6d3dbf0ca
31 changed files with 371 additions and 464 deletions
44
.config/nvim/.gitignore
vendored
44
.config/nvim/.gitignore
vendored
|
@ -1,44 +0,0 @@
|
||||||
# Compiled Lua sources
|
|
||||||
luac.out
|
|
||||||
|
|
||||||
|
|
||||||
# luarocks build files
|
|
||||||
*.src.rock
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
|
|
||||||
# Object files
|
|
||||||
*.o
|
|
||||||
*.os
|
|
||||||
*.ko
|
|
||||||
*.obj
|
|
||||||
*.elf
|
|
||||||
|
|
||||||
# Precompiled Headers
|
|
||||||
*.gch
|
|
||||||
*.pch
|
|
||||||
|
|
||||||
# Libraries
|
|
||||||
*.lib
|
|
||||||
*.a
|
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
*.def
|
|
||||||
*.exp
|
|
||||||
|
|
||||||
# Shared objects (inc. Windows DLLs)
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.so.*
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# Executables
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
*.app
|
|
||||||
*.i*86
|
|
||||||
*.x86_64
|
|
||||||
*.hex
|
|
||||||
|
|
||||||
|
|
||||||
plugin/packer_compiled.lua
|
|
|
@ -1,43 +1,46 @@
|
||||||
{
|
{
|
||||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" },
|
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
|
||||||
"alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" },
|
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
|
||||||
"auto-session": { "branch": "main", "commit": "3eb26b949e1b90798e84926848551046e2eb0721" },
|
"auto-session": { "branch": "main", "commit": "64dc86e43c85f0062baafb0b607a6162efc99c91" },
|
||||||
"bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" },
|
"bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "3f8927532bc8ce4fc4b5b75eab1bf8f1fc83f6b9" },
|
"conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "73a7d54b5289000108c7f52402a36cf380fced67" },
|
"dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "0368bee1cecaf3c58d436524234baad4c0e0b8cb" },
|
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "bdeba1cec3faddd89146690c10b9a87949c0ee66" },
|
"gitsigns.nvim": { "branch": "main", "commit": "a4db718c78bff65198e3b63f1043f1e7bb5e05c8" },
|
||||||
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6a2c47e6424a3f1e373bfeb714b716f6be13501c" },
|
"lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" },
|
||||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
"lazygit.nvim": { "branch": "main", "commit": "0ada6c6e7e138df92f5009b6952f4ac41248305a" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "81e30dd629de24cbb26d08073ee938ab40006695" },
|
"lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" },
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "83dcddb6477f9ba5db98971ef27bd18bdca921b4" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "1212fb6082b7177dde17ea65e429e027835aeb40" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" },
|
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
|
"nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" },
|
||||||
"nvim-lint": { "branch": "master", "commit": "67f74e630a84ecfa73a82783c487bdedd8cecdc3" },
|
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
|
||||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "0ae13ac58136c6175638b6e1ba04cb487dd22272" },
|
"nvim-lint": { "branch": "master", "commit": "6670b3ac73fa4caf720f017b91c619e9424d955e" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "50fcf96ec5a6e7bfdcbbea4f905c33e85408f170" },
|
"nvim-lsp-file-operations": { "branch": "master", "commit": "223aca86b737dc66e9c51ebcda8788a8d9cc6cf2" },
|
||||||
"nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
|
"nvim-lspconfig": { "branch": "master", "commit": "f4619ab31fc4676001ea05ae8200846e6e7700c7" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "934469b9b6df369e198fb3016969e56393b0dc07" },
|
"nvim-surround": { "branch": "main", "commit": "d47001f8ddf9646c24f16d2732d4d0255acd2121" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "dd4e2dbc002dfce109d621e8bdcd9d89438b0a32" },
|
"nvim-tree.lua": { "branch": "master", "commit": "d8d3a1590a05b2d8b5eb26e2ed1c6052b1b47a77" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
|
"nvim-treesitter": { "branch": "master", "commit": "54cf9180a36299265e217858e6e531245074c3f4" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "45f90966a53a4e1bac374fe9aac530b7b5925c76" },
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "95e9ba9de4289d221666b66fd930d157c7ca08c6" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "734ebad31c81c6198dfe102aa23280937c937c42" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
|
"nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" },
|
"substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "e89caa3ad6d8da9d0dd981ec74a82c55adc61ffd" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
|
||||||
"vim-ReplaceWithRegister": { "branch": "master", "commit": "aad1e8fa31cb4722f20fe40679caa56e25120032" },
|
"telescope.nvim": { "branch": "0.1.x", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
|
||||||
|
"todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
|
||||||
|
"tokyonight.nvim": { "branch": "main", "commit": "9bf9ec53d5e87b025e2404069b71e7ebdc3a13e5" },
|
||||||
|
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
|
||||||
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
|
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
|
||||||
"vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" },
|
"vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
|
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||||
}
|
}
|
|
@ -1,2 +1,2 @@
|
||||||
require("josean.core.keymaps")
|
|
||||||
require("josean.core.options")
|
require("josean.core.options")
|
||||||
|
require("josean.core.keymaps")
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
-- set leader key to space
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
local keymap = vim.keymap -- for conciseness
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
---------------------
|
|
||||||
-- General Keymaps -------------------
|
|
||||||
|
|
||||||
-- use jk to exit insert mode
|
|
||||||
keymap.set("i", "jk", "<ESC>", { desc = "Exit insert mode with jk" })
|
keymap.set("i", "jk", "<ESC>", { desc = "Exit insert mode with jk" })
|
||||||
|
|
||||||
-- clear search highlights
|
|
||||||
keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
|
keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
|
||||||
|
|
||||||
-- delete single character without copying into register
|
|
||||||
-- keymap.set("n", "x", '"_x')
|
|
||||||
|
|
||||||
-- increment/decrement numbers
|
-- increment/decrement numbers
|
||||||
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
|
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
|
||||||
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
|
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
local opt = vim.opt -- for conciseness
|
vim.cmd("let g:netrw_liststyle = 3")
|
||||||
|
|
||||||
-- line numbers
|
local opt = vim.opt
|
||||||
opt.relativenumber = true -- show relative line numbers
|
|
||||||
opt.number = true -- shows absolute line number on cursor line (when relative number is on)
|
opt.relativenumber = true
|
||||||
|
opt.number = true
|
||||||
|
|
||||||
-- tabs & indentation
|
-- tabs & indentation
|
||||||
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
|
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
|
||||||
|
@ -10,19 +11,15 @@ opt.shiftwidth = 2 -- 2 spaces for indent width
|
||||||
opt.expandtab = true -- expand tab to spaces
|
opt.expandtab = true -- expand tab to spaces
|
||||||
opt.autoindent = true -- copy indent from current line when starting new one
|
opt.autoindent = true -- copy indent from current line when starting new one
|
||||||
|
|
||||||
-- line wrapping
|
opt.wrap = false
|
||||||
opt.wrap = false -- disable line wrapping
|
|
||||||
|
|
||||||
-- search settings
|
-- search settings
|
||||||
opt.ignorecase = true -- ignore case when searching
|
opt.ignorecase = true -- ignore case when searching
|
||||||
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
|
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
|
||||||
|
|
||||||
-- cursor line
|
opt.cursorline = true
|
||||||
opt.cursorline = true -- highlight the current cursor line
|
|
||||||
|
|
||||||
-- appearance
|
-- turn on termguicolors for tokyonight colorscheme to work
|
||||||
|
|
||||||
-- turn on termguicolors for nightfly colorscheme to work
|
|
||||||
-- (have to use iterm2 or any other true color terminal)
|
-- (have to use iterm2 or any other true color terminal)
|
||||||
opt.termguicolors = true
|
opt.termguicolors = true
|
||||||
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
|
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
|
||||||
|
|
|
@ -12,9 +12,6 @@ end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup({ { import = "josean.plugins" }, { import = "josean.plugins.lsp" } }, {
|
require("lazy").setup({ { import = "josean.plugins" }, { import = "josean.plugins.lsp" } }, {
|
||||||
install = {
|
|
||||||
colorscheme = { "nightfly" },
|
|
||||||
},
|
|
||||||
checker = {
|
checker = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
notify = false,
|
notify = false,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
return {
|
return {
|
||||||
"goolord/alpha-nvim",
|
"goolord/alpha-nvim",
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
|
||||||
config = function()
|
config = function()
|
||||||
local alpha = require("alpha")
|
local alpha = require("alpha")
|
||||||
local dashboard = require("alpha.themes.dashboard")
|
local dashboard = require("alpha.themes.dashboard")
|
|
@ -28,3 +28,4 @@ return {
|
||||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
return {
|
|
||||||
"NvChad/nvim-colorizer.lua",
|
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
|
||||||
config = true,
|
|
||||||
}
|
|
|
@ -1,48 +1,38 @@
|
||||||
return {
|
return {
|
||||||
{
|
"folke/tokyonight.nvim",
|
||||||
"bluz71/vim-nightfly-guicolors",
|
priority = 1000,
|
||||||
priority = 1000, -- make sure to load this before all the other start plugins
|
config = function()
|
||||||
config = function()
|
local bg = "#011628"
|
||||||
-- load the colorscheme here
|
local bg_dark = "#011423"
|
||||||
vim.cmd([[colorscheme nightfly]])
|
local bg_highlight = "#143652"
|
||||||
end,
|
local bg_search = "#0A64AC"
|
||||||
},
|
local bg_visual = "#275378"
|
||||||
-- {
|
local fg = "#CBE0F0"
|
||||||
-- "folke/tokyonight.nvim",
|
local fg_dark = "#B4D0E9"
|
||||||
-- priority = 1000, -- make sure to load this before all the other start plugins
|
local fg_gutter = "#627E97"
|
||||||
-- config = function()
|
local border = "#547998"
|
||||||
-- local bg = "#011628"
|
|
||||||
-- local bg_dark = "#011423"
|
require("tokyonight").setup({
|
||||||
-- local bg_highlight = "#143652"
|
style = "night",
|
||||||
-- local bg_search = "#0A64AC"
|
on_colors = function(colors)
|
||||||
-- local bg_visual = "#275378"
|
colors.bg = bg
|
||||||
-- local fg = "#CBE0F0"
|
colors.bg_dark = bg_dark
|
||||||
-- local fg_dark = "#B4D0E9"
|
colors.bg_float = bg_dark
|
||||||
-- local fg_gutter = "#627E97"
|
colors.bg_highlight = bg_highlight
|
||||||
-- local border = "#547998"
|
colors.bg_popup = bg_dark
|
||||||
--
|
colors.bg_search = bg_search
|
||||||
-- require("tokyonight").setup({
|
colors.bg_sidebar = bg_dark
|
||||||
-- style = "night",
|
colors.bg_statusline = bg_dark
|
||||||
-- on_colors = function(colors)
|
colors.bg_visual = bg_visual
|
||||||
-- colors.bg = bg
|
colors.border = border
|
||||||
-- colors.bg_dark = bg_dark
|
colors.fg = fg
|
||||||
-- colors.bg_float = bg_dark
|
colors.fg_dark = fg_dark
|
||||||
-- colors.bg_highlight = bg_highlight
|
colors.fg_float = fg
|
||||||
-- colors.bg_popup = bg_dark
|
colors.fg_gutter = fg_gutter
|
||||||
-- colors.bg_search = bg_search
|
colors.fg_sidebar = fg_dark
|
||||||
-- colors.bg_sidebar = bg_dark
|
end
|
||||||
-- colors.bg_statusline = bg_dark
|
})
|
||||||
-- colors.bg_visual = bg_visual
|
|
||||||
-- colors.border = border
|
vim.cmd("colorscheme tokyonight")
|
||||||
-- colors.fg = fg
|
end
|
||||||
-- colors.fg_dark = fg_dark
|
|
||||||
-- colors.fg_float = fg
|
|
||||||
-- colors.fg_gutter = fg_gutter
|
|
||||||
-- colors.fg_sidebar = fg_dark
|
|
||||||
-- end,
|
|
||||||
-- })
|
|
||||||
-- -- load the colorscheme here
|
|
||||||
-- vim.cmd([[colorscheme tokyonight]])
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ return {
|
||||||
|
|
||||||
-- enable comment
|
-- enable comment
|
||||||
comment.setup({
|
comment.setup({
|
||||||
-- for commenting tsx and jsx files
|
-- for commenting tsx, jsx, svelte, html files
|
||||||
pre_hook = ts_context_commentstring.create_pre_hook(),
|
pre_hook = ts_context_commentstring.create_pre_hook(),
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
lazy = true,
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
event = { "BufReadPre", "BufNewFile" }, -- to disable, comment this out
|
|
||||||
config = function()
|
config = function()
|
||||||
local conform = require("conform")
|
local conform = require("conform")
|
||||||
|
|
||||||
|
@ -18,6 +17,7 @@ return {
|
||||||
yaml = { "prettier" },
|
yaml = { "prettier" },
|
||||||
markdown = { "prettier" },
|
markdown = { "prettier" },
|
||||||
graphql = { "prettier" },
|
graphql = { "prettier" },
|
||||||
|
liquid = { "prettier" },
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
python = { "isort", "black" },
|
python = { "isort", "black" },
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,47 @@
|
||||||
return {
|
return {
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = true,
|
opts = {
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, desc)
|
||||||
|
vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map("n", "]h", gs.next_hunk, "Next Hunk")
|
||||||
|
map("n", "[h", gs.prev_hunk, "Prev Hunk")
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map("n", "<leader>hs", gs.stage_hunk, "Stage hunk")
|
||||||
|
map("n", "<leader>hr", gs.reset_hunk, "Reset hunk")
|
||||||
|
map("v", "<leader>hs", function()
|
||||||
|
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
|
end, "Stage hunk")
|
||||||
|
map("v", "<leader>hr", function()
|
||||||
|
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
|
end, "Reset hunk")
|
||||||
|
|
||||||
|
map("n", "<leader>hS", gs.stage_buffer, "Stage buffer")
|
||||||
|
map("n", "<leader>hR", gs.reset_buffer, "Reset buffer")
|
||||||
|
|
||||||
|
map("n", "<leader>hu", gs.undo_stage_hunk, "Undo stage hunk")
|
||||||
|
|
||||||
|
map("n", "<leader>hp", gs.preview_hunk, "Preview hunk")
|
||||||
|
|
||||||
|
map("n", "<leader>hb", function()
|
||||||
|
gs.blame_line({ full = true })
|
||||||
|
end, "Blame line")
|
||||||
|
map("n", "<leader>hB", gs.toggle_current_line_blame, "Toggle line blame")
|
||||||
|
|
||||||
|
map("n", "<leader>hd", gs.diffthis, "Diff this")
|
||||||
|
map("n", "<leader>hD", function()
|
||||||
|
gs.diffthis("~")
|
||||||
|
end, "Diff this ~")
|
||||||
|
|
||||||
|
-- Text object
|
||||||
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Gitsigns select hunk")
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
return {
|
|
||||||
"ThePrimeagen/harpoon",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- set keymaps
|
|
||||||
local keymap = vim.keymap -- for conciseness
|
|
||||||
|
|
||||||
keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>hm",
|
|
||||||
"<cmd>lua require('harpoon.mark').add_file()<cr>",
|
|
||||||
{ desc = "Mark file with harpoon" }
|
|
||||||
)
|
|
||||||
keymap.set("n", "<leader>hn", "<cmd>lua require('harpoon.ui').nav_next()<cr>", { desc = "Go to next harpoon mark" })
|
|
||||||
keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>hp",
|
|
||||||
"<cmd>lua require('harpoon.ui').nav_prev()<cr>",
|
|
||||||
{ desc = "Go to previous harpoon mark" }
|
|
||||||
)
|
|
||||||
end,
|
|
||||||
}
|
|
8
.config/nvim/lua/josean/plugins/indent-blankline.lua
Normal file
8
.config/nvim/lua/josean/plugins/indent-blankline.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
return {
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
main = "ibl",
|
||||||
|
opts = {
|
||||||
|
indent = { char = "┊" },
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,7 +1,4 @@
|
||||||
return {
|
return {
|
||||||
"nvim-lua/plenary.nvim", -- lua functions that many plugins use
|
"nvim-lua/plenary.nvim", -- lua functions that many plugins use
|
||||||
|
|
||||||
"christoomey/vim-tmux-navigator", -- tmux & split window navigation
|
"christoomey/vim-tmux-navigator", -- tmux & split window navigation
|
||||||
|
|
||||||
"inkarkat/vim-ReplaceWithRegister", -- replace with register contents using motion (gr + motion)
|
|
||||||
}
|
}
|
||||||
|
|
19
.config/nvim/lua/josean/plugins/lazygit.lua
Normal file
19
.config/nvim/lua/josean/plugins/lazygit.lua
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
return {
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
cmd = {
|
||||||
|
"LazyGit",
|
||||||
|
"LazyGitConfig",
|
||||||
|
"LazyGitCurrentFile",
|
||||||
|
"LazyGitFilter",
|
||||||
|
"LazyGitFilterCurrentFile",
|
||||||
|
},
|
||||||
|
-- optional for floating window border decoration
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||||
|
-- order to load the plugin when the command is run for the first time
|
||||||
|
keys = {
|
||||||
|
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "Open lazy git" },
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
return {
|
return {
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
lazy = true,
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
event = { "BufReadPre", "BufNewFile" }, -- to disable, comment this out
|
|
||||||
config = function()
|
config = function()
|
||||||
local lint = require("lint")
|
local lint = require("lint")
|
||||||
|
|
||||||
|
|
|
@ -4,60 +4,68 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||||
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- import lspconfig plugin
|
-- import lspconfig plugin
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
|
-- import mason_lspconfig plugin
|
||||||
|
local mason_lspconfig = require("mason-lspconfig")
|
||||||
|
|
||||||
-- import cmp-nvim-lsp plugin
|
-- import cmp-nvim-lsp plugin
|
||||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
|
|
||||||
local keymap = vim.keymap -- for conciseness
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
local opts = { noremap = true, silent = true }
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
local on_attach = function(client, bufnr)
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
opts.buffer = bufnr
|
callback = function(ev)
|
||||||
|
-- Buffer local mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local opts = { buffer = ev.buf, silent = true }
|
||||||
|
|
||||||
-- set keybinds
|
-- set keybinds
|
||||||
opts.desc = "Show LSP references"
|
opts.desc = "Show LSP references"
|
||||||
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts) -- show definition, references
|
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts) -- show definition, references
|
||||||
|
|
||||||
opts.desc = "Go to declaration"
|
opts.desc = "Go to declaration"
|
||||||
keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration
|
keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration
|
||||||
|
|
||||||
opts.desc = "Show LSP definitions"
|
opts.desc = "Show LSP definitions"
|
||||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
|
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
|
||||||
|
|
||||||
opts.desc = "Show LSP implementations"
|
opts.desc = "Show LSP implementations"
|
||||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
|
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
|
||||||
|
|
||||||
opts.desc = "Show LSP type definitions"
|
opts.desc = "Show LSP type definitions"
|
||||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
|
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
|
||||||
|
|
||||||
opts.desc = "See available code actions"
|
opts.desc = "See available code actions"
|
||||||
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
|
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
|
||||||
|
|
||||||
opts.desc = "Smart rename"
|
opts.desc = "Smart rename"
|
||||||
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
|
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
|
||||||
|
|
||||||
opts.desc = "Show buffer diagnostics"
|
opts.desc = "Show buffer diagnostics"
|
||||||
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
|
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
|
||||||
|
|
||||||
opts.desc = "Show line diagnostics"
|
opts.desc = "Show line diagnostics"
|
||||||
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
|
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
|
||||||
|
|
||||||
opts.desc = "Go to previous diagnostic"
|
opts.desc = "Go to previous diagnostic"
|
||||||
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
|
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
|
||||||
|
|
||||||
opts.desc = "Go to next diagnostic"
|
opts.desc = "Go to next diagnostic"
|
||||||
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
|
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
|
||||||
|
|
||||||
opts.desc = "Show documentation for what is under cursor"
|
opts.desc = "Show documentation for what is under cursor"
|
||||||
keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
|
keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
|
||||||
|
|
||||||
opts.desc = "Restart LSP"
|
opts.desc = "Restart LSP"
|
||||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
||||||
end
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- used to enable autocompletion (assign to every lsp server config)
|
-- used to enable autocompletion (assign to every lsp server config)
|
||||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
@ -70,92 +78,60 @@ return {
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- configure html server
|
mason_lspconfig.setup_handlers({
|
||||||
lspconfig["html"].setup({
|
-- default handler for installed servers
|
||||||
capabilities = capabilities,
|
function(server_name)
|
||||||
on_attach = on_attach,
|
lspconfig[server_name].setup({
|
||||||
})
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
-- configure typescript server with plugin
|
end,
|
||||||
lspconfig["tsserver"].setup({
|
["svelte"] = function()
|
||||||
capabilities = capabilities,
|
-- configure svelte server
|
||||||
on_attach = on_attach,
|
lspconfig["svelte"].setup({
|
||||||
})
|
capabilities = capabilities,
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
-- configure css server
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
lspconfig["cssls"].setup({
|
pattern = { "*.js", "*.ts" },
|
||||||
capabilities = capabilities,
|
callback = function(ctx)
|
||||||
on_attach = on_attach,
|
-- Here use ctx.match instead of ctx.file
|
||||||
})
|
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||||
|
end,
|
||||||
-- configure tailwindcss server
|
})
|
||||||
lspconfig["tailwindcss"].setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- configure svelte server
|
|
||||||
lspconfig["svelte"].setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
on_attach(client, bufnr)
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
|
||||||
pattern = { "*.js", "*.ts" },
|
|
||||||
callback = function(ctx)
|
|
||||||
if client.name == "svelte" then
|
|
||||||
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file })
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
})
|
["graphql"] = function()
|
||||||
|
-- configure graphql language server
|
||||||
-- configure prisma orm server
|
lspconfig["graphql"].setup({
|
||||||
lspconfig["prismals"].setup({
|
capabilities = capabilities,
|
||||||
capabilities = capabilities,
|
filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" },
|
||||||
on_attach = on_attach,
|
})
|
||||||
})
|
end,
|
||||||
|
["emmet_ls"] = function()
|
||||||
-- configure graphql language server
|
-- configure emmet language server
|
||||||
lspconfig["graphql"].setup({
|
lspconfig["emmet_ls"].setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||||
filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" },
|
})
|
||||||
})
|
end,
|
||||||
|
["lua_ls"] = function()
|
||||||
-- configure emmet language server
|
-- configure lua server (with special settings)
|
||||||
lspconfig["emmet_ls"].setup({
|
lspconfig["lua_ls"].setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
settings = {
|
||||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
Lua = {
|
||||||
})
|
-- make the language server recognize "vim" global
|
||||||
|
diagnostics = {
|
||||||
-- configure python server
|
globals = { "vim" },
|
||||||
lspconfig["pyright"].setup({
|
},
|
||||||
capabilities = capabilities,
|
completion = {
|
||||||
on_attach = on_attach,
|
callSnippet = "Replace",
|
||||||
})
|
},
|
||||||
|
|
||||||
-- configure lua server (with special settings)
|
|
||||||
lspconfig["lua_ls"].setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
settings = { -- custom settings for lua
|
|
||||||
Lua = {
|
|
||||||
-- make the language server recognize "vim" global
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
-- make language server aware of runtime files
|
|
||||||
library = {
|
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
||||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
},
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,6 @@ return {
|
||||||
"prismals",
|
"prismals",
|
||||||
"pyright",
|
"pyright",
|
||||||
},
|
},
|
||||||
-- auto-install configured servers (with lspconfig)
|
|
||||||
automatic_installation = true, -- not the same as ensure_installed
|
|
||||||
})
|
})
|
||||||
|
|
||||||
mason_tool_installer.setup({
|
mason_tool_installer.setup({
|
||||||
|
@ -48,8 +46,8 @@ return {
|
||||||
"stylua", -- lua formatter
|
"stylua", -- lua formatter
|
||||||
"isort", -- python formatter
|
"isort", -- python formatter
|
||||||
"black", -- python formatter
|
"black", -- python formatter
|
||||||
"pylint", -- python linter
|
"pylint",
|
||||||
"eslint_d", -- js linter
|
"eslint_d",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
return {
|
|
||||||
"nvimtools/none-ls.nvim", -- configure formatters & linters
|
|
||||||
lazy = true,
|
|
||||||
-- event = { "BufReadPre", "BufNewFile" }, -- to enable uncomment this
|
|
||||||
dependencies = {
|
|
||||||
"jay-babu/mason-null-ls.nvim",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local mason_null_ls = require("mason-null-ls")
|
|
||||||
|
|
||||||
local null_ls = require("null-ls")
|
|
||||||
|
|
||||||
local null_ls_utils = require("null-ls.utils")
|
|
||||||
|
|
||||||
mason_null_ls.setup({
|
|
||||||
ensure_installed = {
|
|
||||||
"prettier", -- prettier formatter
|
|
||||||
"stylua", -- lua formatter
|
|
||||||
"black", -- python formatter
|
|
||||||
"pylint", -- python linter
|
|
||||||
"eslint_d", -- js linter
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- for conciseness
|
|
||||||
local formatting = null_ls.builtins.formatting -- to setup formatters
|
|
||||||
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
|
|
||||||
|
|
||||||
-- to setup format on save
|
|
||||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
|
||||||
|
|
||||||
-- configure null_ls
|
|
||||||
null_ls.setup({
|
|
||||||
-- add package.json as identifier for root (for typescript monorepos)
|
|
||||||
root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"),
|
|
||||||
-- setup formatters & linters
|
|
||||||
sources = {
|
|
||||||
-- to disable file types use
|
|
||||||
-- "formatting.prettier.with({disabled_filetypes: {}})" (see null-ls docs)
|
|
||||||
formatting.prettier.with({
|
|
||||||
extra_filetypes = { "svelte" },
|
|
||||||
}), -- js/ts formatter
|
|
||||||
formatting.stylua, -- lua formatter
|
|
||||||
formatting.isort,
|
|
||||||
formatting.black,
|
|
||||||
diagnostics.pylint,
|
|
||||||
diagnostics.eslint_d.with({ -- js/ts linter
|
|
||||||
condition = function(utils)
|
|
||||||
return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs
|
|
||||||
end,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
-- configure format on save
|
|
||||||
on_attach = function(current_client, bufnr)
|
|
||||||
if current_client.supports_method("textDocument/formatting") then
|
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
group = augroup,
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.buf.format({
|
|
||||||
filter = function(client)
|
|
||||||
-- only use null-ls for formatting instead of lsp server
|
|
||||||
return client.name == "null-ls"
|
|
||||||
end,
|
|
||||||
bufnr = bufnr,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -4,7 +4,13 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||||
"hrsh7th/cmp-path", -- source for file system paths
|
"hrsh7th/cmp-path", -- source for file system paths
|
||||||
"L3MON4D3/LuaSnip", -- snippet engine
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
-- follow latest release.
|
||||||
|
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||||
|
-- install jsregexp (optional!).
|
||||||
|
build = "make install_jsregexp",
|
||||||
|
},
|
||||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||||
"rafamadriz/friendly-snippets", -- useful snippets
|
"rafamadriz/friendly-snippets", -- useful snippets
|
||||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||||
|
@ -39,11 +45,12 @@ return {
|
||||||
}),
|
}),
|
||||||
-- sources for autocompletion
|
-- sources for autocompletion
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp"},
|
||||||
{ name = "luasnip" }, -- snippets
|
{ name = "luasnip" }, -- snippets
|
||||||
{ name = "buffer" }, -- text within current buffer
|
{ name = "buffer" }, -- text within current buffer
|
||||||
{ name = "path" }, -- file system paths
|
{ name = "path" }, -- file system paths
|
||||||
}),
|
}),
|
||||||
|
|
||||||
-- configure lspkind for vs-code like pictograms in completion menu
|
-- configure lspkind for vs-code like pictograms in completion menu
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
return {
|
return {
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = "nvim-tree/nvim-web-devicons",
|
||||||
config = function()
|
config = function()
|
||||||
local nvimtree = require("nvim-tree")
|
local nvimtree = require("nvim-tree")
|
||||||
|
|
||||||
|
@ -8,11 +8,6 @@ return {
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
-- change color for arrows in tree to light blue
|
|
||||||
vim.cmd([[ highlight NvimTreeFolderArrowClosed guifg=#3FC5FF ]])
|
|
||||||
vim.cmd([[ highlight NvimTreeFolderArrowOpen guifg=#3FC5FF ]])
|
|
||||||
|
|
||||||
-- configure nvim-tree
|
|
||||||
nvimtree.setup({
|
nvimtree.setup({
|
||||||
view = {
|
view = {
|
||||||
width = 35,
|
width = 35,
|
||||||
|
@ -57,5 +52,5 @@ return {
|
||||||
keymap.set("n", "<leader>ef", "<cmd>NvimTreeFindFileToggle<CR>", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file
|
keymap.set("n", "<leader>ef", "<cmd>NvimTreeFindFileToggle<CR>", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file
|
||||||
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
|
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
|
||||||
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
|
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
|
||||||
end,
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
|
||||||
build = ":TSUpdate",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
||||||
"windwp/nvim-ts-autotag",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- import nvim-treesitter plugin
|
|
||||||
local treesitter = require("nvim-treesitter.configs")
|
|
||||||
|
|
||||||
-- configure treesitter
|
|
||||||
treesitter.setup({ -- enable syntax highlighting
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
-- enable indentation
|
|
||||||
indent = { enable = true },
|
|
||||||
-- enable autotagging (w/ nvim-ts-autotag plugin)
|
|
||||||
autotag = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
-- ensure these language parsers are installed
|
|
||||||
ensure_installed = {
|
|
||||||
"json",
|
|
||||||
"javascript",
|
|
||||||
"typescript",
|
|
||||||
"tsx",
|
|
||||||
"yaml",
|
|
||||||
"html",
|
|
||||||
"css",
|
|
||||||
"prisma",
|
|
||||||
"markdown",
|
|
||||||
"markdown_inline",
|
|
||||||
"svelte",
|
|
||||||
"graphql",
|
|
||||||
"bash",
|
|
||||||
"lua",
|
|
||||||
"vim",
|
|
||||||
"dockerfile",
|
|
||||||
"gitignore",
|
|
||||||
"query",
|
|
||||||
},
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = "<C-space>",
|
|
||||||
node_incremental = "<C-space>",
|
|
||||||
scope_incremental = false,
|
|
||||||
node_decremental = "<bs>",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx
|
|
||||||
require('ts_context_commentstring').setup {}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
return {
|
|
||||||
"nvim-tree/nvim-web-devicons",
|
|
||||||
config = function()
|
|
||||||
require("nvim-web-devicons").set_icon({
|
|
||||||
gql = {
|
|
||||||
icon = "",
|
|
||||||
color = "#e535ab",
|
|
||||||
cterm_color = "199",
|
|
||||||
name = "GraphQL",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
17
.config/nvim/lua/josean/plugins/substitute.lua
Normal file
17
.config/nvim/lua/josean/plugins/substitute.lua
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
return {
|
||||||
|
"gbprod/substitute.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
config = function()
|
||||||
|
local substitute = require("substitute")
|
||||||
|
|
||||||
|
substitute.setup()
|
||||||
|
|
||||||
|
-- set keymaps
|
||||||
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
|
vim.keymap.set("n", "s", substitute.operator, { desc = "Substitute with motion" })
|
||||||
|
vim.keymap.set("n", "ss", substitute.line, { desc = "Substitute line" })
|
||||||
|
vim.keymap.set("n", "S", substitute.eol, { desc = "Substitute to end of line" })
|
||||||
|
vim.keymap.set("x", "s", substitute.visual, { desc = "Substitute in visual mode" })
|
||||||
|
end,
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ return {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
|
@ -12,7 +13,7 @@ return {
|
||||||
|
|
||||||
telescope.setup({
|
telescope.setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
path_display = { "truncate " },
|
path_display = { "smart" },
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||||
|
@ -32,5 +33,6 @@ return {
|
||||||
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
|
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
|
||||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
|
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
|
||||||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
|
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
|
||||||
|
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<cr>", { desc = "Find todos" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
21
.config/nvim/lua/josean/plugins/todo-comments.lua
Normal file
21
.config/nvim/lua/josean/plugins/todo-comments.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
return {
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
local todo_comments = require("todo-comments")
|
||||||
|
|
||||||
|
-- set keymaps
|
||||||
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
|
keymap.set("n", "]t", function()
|
||||||
|
todo_comments.jump_next()
|
||||||
|
end, { desc = "Next todo comment" })
|
||||||
|
|
||||||
|
keymap.set("n", "[t", function()
|
||||||
|
todo_comments.jump_prev()
|
||||||
|
end, { desc = "Previous todo comment" })
|
||||||
|
|
||||||
|
todo_comments.setup()
|
||||||
|
end,
|
||||||
|
}
|
57
.config/nvim/lua/josean/plugins/treesitter.lua
Normal file
57
.config/nvim/lua/josean/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
build = ":TSUpdate",
|
||||||
|
dependencies = {
|
||||||
|
"windwp/nvim-ts-autotag",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- import nvim-treesitter plugin
|
||||||
|
local treesitter = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
|
-- configure treesitter
|
||||||
|
treesitter.setup({ -- enable syntax highlighting
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
-- enable indentation
|
||||||
|
indent = { enable = true },
|
||||||
|
-- enable autotagging (w/ nvim-ts-autotag plugin)
|
||||||
|
autotag = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
-- ensure these language parsers are installed
|
||||||
|
ensure_installed = {
|
||||||
|
"json",
|
||||||
|
"javascript",
|
||||||
|
"typescript",
|
||||||
|
"tsx",
|
||||||
|
"yaml",
|
||||||
|
"html",
|
||||||
|
"css",
|
||||||
|
"prisma",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"svelte",
|
||||||
|
"graphql",
|
||||||
|
"bash",
|
||||||
|
"lua",
|
||||||
|
"vim",
|
||||||
|
"dockerfile",
|
||||||
|
"gitignore",
|
||||||
|
"query",
|
||||||
|
"vimdoc",
|
||||||
|
"c",
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<C-space>",
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = false,
|
||||||
|
node_decremental = "<bs>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
12
.config/nvim/lua/josean/plugins/trouble.lua
Normal file
12
.config/nvim/lua/josean/plugins/trouble.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons", "folke/todo-comments.nvim" },
|
||||||
|
keys = {
|
||||||
|
{ "<leader>xx", "<cmd>TroubleToggle<CR>", desc = "Open/close trouble list" },
|
||||||
|
{ "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<CR>", desc = "Open trouble workspace diagnostics" },
|
||||||
|
{ "<leader>xd", "<cmd>TroubleToggle document_diagnostics<CR>", desc = "Open trouble document diagnostics" },
|
||||||
|
{ "<leader>xq", "<cmd>TroubleToggle quickfix<CR>", desc = "Open trouble quickfix list" },
|
||||||
|
{ "<leader>xl", "<cmd>TroubleToggle loclist<CR>", desc = "Open trouble location list" },
|
||||||
|
{ "<leader>xt", "<cmd>TodoTrouble<CR>", desc = "Open todos in trouble" },
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in a new issue