mirror of
https://github.com/josean-dev/dev-environment-files.git
synced 2025-01-06 16:31:16 +01:00
Updated neovim config to latest with lazy.nvim
This commit is contained in:
parent
b9d2822e06
commit
7b3f9eb591
34 changed files with 884 additions and 640 deletions
|
@ -1,16 +1,2 @@
|
|||
require("josean.plugins-setup")
|
||||
require("josean.core.options")
|
||||
require("josean.core.keymaps")
|
||||
require("josean.core.colorscheme")
|
||||
require("josean.plugins.comment")
|
||||
require("josean.plugins.nvim-tree")
|
||||
require("josean.plugins.lualine")
|
||||
require("josean.plugins.telescope")
|
||||
require("josean.plugins.nvim-cmp")
|
||||
require("josean.plugins.lsp.mason")
|
||||
require("josean.plugins.lsp.lspsaga")
|
||||
require("josean.plugins.lsp.lspconfig")
|
||||
require("josean.plugins.lsp.null-ls")
|
||||
require("josean.plugins.autopairs")
|
||||
require("josean.plugins.treesitter")
|
||||
require("josean.plugins.gitsigns")
|
||||
require("josean.core")
|
||||
require("josean.lazy")
|
||||
|
|
44
.config/nvim/lazy-lock.json
Normal file
44
.config/nvim/lazy-lock.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "c4d6298347f7707e9757351b2ee03d0c00da5c20" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "7a6b9487dba044a43fde534bf5036f0fda5b6b23" },
|
||||
"auto-session": { "branch": "main", "commit": "f6d111f3c7ff2fb89c8a39b6280c8f90234196d9" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "d24378edc14a675c820a303b4512af3bbc5761e9" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"copilot.vim": { "branch": "release", "commit": "172955782814a49fbebca2d1a2ccce2059103329" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "377d45475b49e37460a902d6d569d2093d4037d0" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" },
|
||||
"harpoon": { "branch": "master", "commit": "21f4c47c6803d64ddb934a5b314dcb1b8e7365dc" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "ed0f6f2b917cac4eb3259f907da0a481b27a3b7e" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "2997f467881ac4faa6f8c5e7065e3a672297c8ad" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
|
||||
"mason.nvim": { "branch": "main", "commit": "a51c2d063c5377ee9e58c5f9cda7c7436787be72" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f7922e59aeb9bc3e31a660ea4e7405ffa3fc2c3a" },
|
||||
"nvim-surround": { "branch": "main", "commit": "0d6882635817a2677749a330127d12ac30a4f3c8" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "920868dba13466586897a8f40220eca6b2caac41" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "31f608e47b838594d32a7bc42028e2cefd0ddaad" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "e3e2b6de4ccf781fb653a3a1d397aeb4a0095609" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9bff161dfece6ecf3459e6e46ca42e49f9ed939f" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "0dbe561ae023f02c2fb772b879e905055b939ce3" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" },
|
||||
"typescript.nvim": { "branch": "main", "commit": "4de85ef699d7e6010528dcfbddc2ed4c2c421467" },
|
||||
"vim-ReplaceWithRegister": { "branch": "master", "commit": "aad1e8fa31cb4722f20fe40679caa56e25120032" },
|
||||
"vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" },
|
||||
"vim-nightfly-guicolors": { "branch": "master", "commit": "06eaaaa8717538a7ce96b13c137da8c9eaa84ec8" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "addb64a772cb4a3ae1f1363583012b2cada2cd66" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
-- set colorscheme to nightfly with protected call
|
||||
-- in case it isn't installed
|
||||
local status, _ = pcall(vim.cmd, "colorscheme nightfly")
|
||||
if not status then
|
||||
print("Colorscheme not found!") -- print error if colorscheme not installed
|
||||
return
|
||||
end
|
2
.config/nvim/lua/josean/core/init.lua
Normal file
2
.config/nvim/lua/josean/core/init.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
require("josean.core.keymaps")
|
||||
require("josean.core.options")
|
|
@ -4,55 +4,29 @@ vim.g.mapleader = " "
|
|||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
---------------------
|
||||
-- General Keymaps
|
||||
---------------------
|
||||
-- General Keymaps -------------------
|
||||
|
||||
-- use jk to exit insert mode
|
||||
keymap.set("i", "jk", "<ESC>")
|
||||
keymap.set("i", "jk", "<ESC>", { desc = "Exit insert mode with jk" })
|
||||
|
||||
-- clear search highlights
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>")
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
|
||||
|
||||
-- delete single character without copying into register
|
||||
keymap.set("n", "x", '"_x')
|
||||
-- keymap.set("n", "x", '"_x')
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>") -- increment
|
||||
keymap.set("n", "<leader>-", "<C-x>") -- decrement
|
||||
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
|
||||
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>sv", "<C-w>v") -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s") -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=") -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", ":close<CR>") -- close current split window
|
||||
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
|
||||
|
||||
keymap.set("n", "<leader>to", ":tabnew<CR>") -- open new tab
|
||||
keymap.set("n", "<leader>tx", ":tabclose<CR>") -- close current tab
|
||||
keymap.set("n", "<leader>tn", ":tabn<CR>") -- go to next tab
|
||||
keymap.set("n", "<leader>tp", ":tabp<CR>") -- go to previous tab
|
||||
|
||||
----------------------
|
||||
-- Plugin Keybinds
|
||||
----------------------
|
||||
|
||||
-- vim-maximizer
|
||||
keymap.set("n", "<leader>sm", ":MaximizerToggle<CR>") -- toggle split window maximization
|
||||
|
||||
-- nvim-tree
|
||||
keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>") -- toggle file explorer
|
||||
|
||||
-- telescope
|
||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>") -- find files within current working directory, respects .gitignore
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>") -- find string in current working directory as you type
|
||||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>") -- find string under cursor in current working directory
|
||||
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>") -- list open buffers in current neovim instance
|
||||
keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags<cr>") -- list available help tags
|
||||
|
||||
-- telescope git commands (not on youtube nvim video)
|
||||
keymap.set("n", "<leader>gc", "<cmd>Telescope git_commits<cr>") -- list all git commits (use <cr> to checkout) ["gc" for git commits]
|
||||
keymap.set("n", "<leader>gfc", "<cmd>Telescope git_bcommits<cr>") -- list git commits for current file/buffer (use <cr> to checkout) ["gfc" for git file commits]
|
||||
keymap.set("n", "<leader>gb", "<cmd>Telescope git_branches<cr>") -- list git branches (use <cr> to checkout) ["gb" for git branch]
|
||||
keymap.set("n", "<leader>gs", "<cmd>Telescope git_status<cr>") -- list current changes per file with diff preview ["gs" for git status]
|
||||
|
||||
-- restart lsp server (not on youtube nvim video)
|
||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>") -- mapping to restart lsp if necessary
|
||||
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
|
||||
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
|
||||
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
|
||||
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
|
||||
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
|
||||
|
|
|
@ -38,4 +38,5 @@ opt.clipboard:append("unnamedplus") -- use system clipboard as default register
|
|||
opt.splitright = true -- split vertical window to the right
|
||||
opt.splitbelow = true -- split horizontal window to the bottom
|
||||
|
||||
opt.iskeyword:append("-") -- consider string-string as whole word
|
||||
-- turn off swapfile
|
||||
opt.swapfile = false
|
||||
|
|
25
.config/nvim/lua/josean/lazy.lua
Normal file
25
.config/nvim/lua/josean/lazy.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({ { import = "josean.plugins" }, { import = "josean.plugins.lsp" } }, {
|
||||
install = {
|
||||
colorscheme = { "nightfly" },
|
||||
},
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = false,
|
||||
},
|
||||
change_detection = {
|
||||
notify = false,
|
||||
},
|
||||
})
|
|
@ -1,113 +0,0 @@
|
|||
-- auto install packer if not installed
|
||||
local ensure_packer = function()
|
||||
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
|
||||
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
local packer_bootstrap = ensure_packer() -- true if packer was just installed
|
||||
|
||||
-- autocommand that reloads neovim and installs/updates/removes plugins
|
||||
-- when file is saved
|
||||
vim.cmd([[
|
||||
augroup packer_user_config
|
||||
autocmd!
|
||||
autocmd BufWritePost plugins-setup.lua source <afile> | PackerSync
|
||||
augroup end
|
||||
]])
|
||||
|
||||
-- import packer safely
|
||||
local status, packer = pcall(require, "packer")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- add list of plugins to install
|
||||
return packer.startup(function(use)
|
||||
-- packer can manage itself
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
use("nvim-lua/plenary.nvim") -- lua functions that many plugins use
|
||||
|
||||
use("bluz71/vim-nightfly-guicolors") -- preferred colorscheme
|
||||
|
||||
use("christoomey/vim-tmux-navigator") -- tmux & split window navigation
|
||||
|
||||
use("szw/vim-maximizer") -- maximizes and restores current window
|
||||
|
||||
-- essential plugins
|
||||
use("tpope/vim-surround") -- add, delete, change surroundings (it's awesome)
|
||||
use("inkarkat/vim-ReplaceWithRegister") -- replace with register contents using motion (gr + motion)
|
||||
|
||||
-- commenting with gc
|
||||
use("numToStr/Comment.nvim")
|
||||
|
||||
-- file explorer
|
||||
use("nvim-tree/nvim-tree.lua")
|
||||
|
||||
-- vs-code like icons
|
||||
use("nvim-tree/nvim-web-devicons")
|
||||
|
||||
-- statusline
|
||||
use("nvim-lualine/lualine.nvim")
|
||||
|
||||
-- fuzzy finding w/ telescope
|
||||
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }) -- dependency for better sorting performance
|
||||
use({ "nvim-telescope/telescope.nvim", branch = "0.1.x" }) -- fuzzy finder
|
||||
|
||||
-- autocompletion
|
||||
use("hrsh7th/nvim-cmp") -- completion plugin
|
||||
use("hrsh7th/cmp-buffer") -- source for text in buffer
|
||||
use("hrsh7th/cmp-path") -- source for file system paths
|
||||
|
||||
-- snippets
|
||||
use("L3MON4D3/LuaSnip") -- snippet engine
|
||||
use("saadparwaiz1/cmp_luasnip") -- for autocompletion
|
||||
use("rafamadriz/friendly-snippets") -- useful snippets
|
||||
|
||||
-- managing & installing lsp servers, linters & formatters
|
||||
use("williamboman/mason.nvim") -- in charge of managing lsp servers, linters & formatters
|
||||
use("williamboman/mason-lspconfig.nvim") -- bridges gap b/w mason & lspconfig
|
||||
|
||||
-- configuring lsp servers
|
||||
use("neovim/nvim-lspconfig") -- easily configure language servers
|
||||
use("hrsh7th/cmp-nvim-lsp") -- for autocompletion
|
||||
use({
|
||||
"glepnir/lspsaga.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
},
|
||||
}) -- enhanced lsp uis
|
||||
use("jose-elias-alvarez/typescript.nvim") -- additional functionality for typescript server (e.g. rename file & update imports)
|
||||
use("onsails/lspkind.nvim") -- vs-code like icons for autocompletion
|
||||
|
||||
-- formatting & linting
|
||||
use("jose-elias-alvarez/null-ls.nvim") -- configure formatters & linters
|
||||
use("jayp0521/mason-null-ls.nvim") -- bridges gap b/w mason & null-ls
|
||||
|
||||
-- treesitter configuration
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = function()
|
||||
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
|
||||
ts_update()
|
||||
end,
|
||||
})
|
||||
|
||||
-- auto closing
|
||||
use("windwp/nvim-autopairs") -- autoclose parens, brackets, quotes, etc...
|
||||
use({ "windwp/nvim-ts-autotag", after = "nvim-treesitter" }) -- autoclose tags
|
||||
|
||||
-- git integration
|
||||
use("lewis6991/gitsigns.nvim") -- show line modifications on left hand side
|
||||
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
37
.config/nvim/lua/josean/plugins/alpha-nvim.lua
Normal file
37
.config/nvim/lua/josean/plugins/alpha-nvim.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
return {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Set header
|
||||
dashboard.section.header.val = {
|
||||
" ",
|
||||
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
|
||||
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
|
||||
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
|
||||
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
|
||||
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
|
||||
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
|
||||
" ",
|
||||
}
|
||||
|
||||
-- Set menu
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
|
||||
dashboard.button("SPC ee", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
|
||||
dashboard.button("SPC ff", " > Find File", "<cmd>Telescope find_files<CR>"),
|
||||
dashboard.button("SPC fs", " > Find Word", "<cmd>Telescope live_grep<CR>"),
|
||||
dashboard.button("SPC wr", " > Restore Session For Current Directory", "<cmd>SessionRestore<CR>"),
|
||||
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
|
||||
}
|
||||
|
||||
-- Send config to alpha
|
||||
alpha.setup(dashboard.opts)
|
||||
|
||||
-- Disable folding on alpha buffer
|
||||
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
|
||||
end,
|
||||
}
|
16
.config/nvim/lua/josean/plugins/auto-session.lua
Normal file
16
.config/nvim/lua/josean/plugins/auto-session.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"rmagatti/auto-session",
|
||||
config = function()
|
||||
local auto_session = require("auto-session")
|
||||
|
||||
auto_session.setup({
|
||||
auto_restore_enabled = false,
|
||||
auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" },
|
||||
})
|
||||
|
||||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session for cwd" }) -- restore last workspace session for current directory
|
||||
keymap.set("n", "<leader>ws", "<cmd>SessionSave<CR>", { desc = "Save session for auto session root dir" }) -- save workspace session for current working directory
|
||||
end,
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
-- import nvim-autopairs safely
|
||||
local autopairs_setup, autopairs = pcall(require, "nvim-autopairs")
|
||||
if not autopairs_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- configure autopairs
|
||||
autopairs.setup({
|
||||
check_ts = true, -- enable treesitter
|
||||
ts_config = {
|
||||
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
|
||||
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
|
||||
java = false, -- don't check treesitter on java
|
||||
},
|
||||
})
|
||||
|
||||
-- import nvim-autopairs completion functionality safely
|
||||
local cmp_autopairs_setup, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||
if not cmp_autopairs_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- import nvim-cmp plugin safely (completions plugin)
|
||||
local cmp_setup, cmp = pcall(require, "cmp")
|
||||
if not cmp_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- make autopairs and completion work together
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
11
.config/nvim/lua/josean/plugins/bufferline.lua
Normal file
11
.config/nvim/lua/josean/plugins/bufferline.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
version = "*",
|
||||
opts = {
|
||||
options = {
|
||||
mode = "tabs",
|
||||
separator_style = "slant",
|
||||
},
|
||||
},
|
||||
}
|
5
.config/nvim/lua/josean/plugins/colorizer.lua
Normal file
5
.config/nvim/lua/josean/plugins/colorizer.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = true,
|
||||
}
|
10
.config/nvim/lua/josean/plugins/colorscheme.lua
Normal file
10
.config/nvim/lua/josean/plugins/colorscheme.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
{
|
||||
"bluz71/vim-nightfly-guicolors",
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
config = function()
|
||||
-- load the colorscheme here
|
||||
vim.cmd([[colorscheme nightfly]])
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -1,8 +1,19 @@
|
|||
-- import comment plugin safely
|
||||
local setup, comment = pcall(require, "Comment")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
return {
|
||||
"numToStr/Comment.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
},
|
||||
config = function()
|
||||
-- import comment plugin safely
|
||||
local comment = require("Comment")
|
||||
|
||||
-- enable comment
|
||||
comment.setup()
|
||||
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim")
|
||||
|
||||
-- enable comment
|
||||
comment.setup({
|
||||
-- for commenting tsx and jsx files
|
||||
pre_hook = ts_context_commentstring.create_pre_hook(),
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
-- import gitsigns plugin safely
|
||||
local setup, gitsigns = pcall(require, "gitsigns")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- configure/enable gitsigns
|
||||
gitsigns.setup()
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = true,
|
||||
}
|
||||
|
|
24
.config/nvim/lua/josean/plugins/harpoon.lua
Normal file
24
.config/nvim/lua/josean/plugins/harpoon.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
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,
|
||||
}
|
9
.config/nvim/lua/josean/plugins/init.lua
Normal file
9
.config/nvim/lua/josean/plugins/init.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"nvim-lua/plenary.nvim", -- lua functions that many plugins use
|
||||
|
||||
"christoomey/vim-tmux-navigator", -- tmux & split window navigation
|
||||
|
||||
"inkarkat/vim-ReplaceWithRegister", -- replace with register contents using motion (gr + motion)
|
||||
|
||||
"github/copilot.vim",
|
||||
}
|
|
@ -1,111 +1,166 @@
|
|||
-- import lspconfig plugin safely
|
||||
local lspconfig_status, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import cmp-nvim-lsp plugin safely
|
||||
local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not cmp_nvim_lsp_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import typescript plugin safely
|
||||
local typescript_setup, typescript = pcall(require, "typescript")
|
||||
if not typescript_setup then
|
||||
return
|
||||
end
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
-- enable keybinds only for when lsp server available
|
||||
local on_attach = function(client, bufnr)
|
||||
-- keybind options
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
-- set keybinds
|
||||
keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references
|
||||
keymap.set("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts) -- got to declaration
|
||||
keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window
|
||||
keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation
|
||||
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions
|
||||
keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename
|
||||
keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show diagnostics for line
|
||||
keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor
|
||||
keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer
|
||||
keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer
|
||||
keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor
|
||||
keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
|
||||
|
||||
-- typescript specific keymaps (e.g. rename file and update imports)
|
||||
if client.name == "tsserver" then
|
||||
keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>") -- rename file and update imports
|
||||
keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>") -- organize imports (not in youtube nvim video)
|
||||
keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>") -- remove unused variables (not in youtube nvim video)
|
||||
end
|
||||
end
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- (not in youtube nvim video)
|
||||
local signs = { Error = " ", Warn = " ", Hint = "ﴞ ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
-- configure html server
|
||||
lspconfig["html"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure typescript server with plugin
|
||||
typescript.setup({
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
},
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure tailwindcss server
|
||||
lspconfig["tailwindcss"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure emmet language server
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
-- 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,
|
||||
},
|
||||
},
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{
|
||||
"smjonas/inc-rename.nvim",
|
||||
config = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
config = function()
|
||||
-- import lspconfig plugin
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- import cmp-nvim-lsp plugin
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
-- import typescript plugin
|
||||
local typescript = require("typescript")
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
-- enable keybinds only for when lsp server available
|
||||
local on_attach = function(client, bufnr)
|
||||
-- keybind options
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
|
||||
-- set keybinds
|
||||
opts.desc = "Show LSP references"
|
||||
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts) -- show definition, references
|
||||
|
||||
opts.desc = "Go to declaration"
|
||||
keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration
|
||||
|
||||
opts.desc = "Show LSP definitions"
|
||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
|
||||
|
||||
opts.desc = "Show LSP implementations"
|
||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
|
||||
|
||||
opts.desc = "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"
|
||||
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"
|
||||
keymap.set("n", "<leader>rn", ":IncRename ", opts) -- smart rename
|
||||
|
||||
opts.desc = "Show buffer diagnostics"
|
||||
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
|
||||
|
||||
opts.desc = "Show line diagnostics"
|
||||
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
|
||||
|
||||
opts.desc = "Go to previous diagnostic"
|
||||
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
|
||||
|
||||
opts.desc = "Go to next diagnostic"
|
||||
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
|
||||
|
||||
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
|
||||
|
||||
opts.desc = "Restart LSP"
|
||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
||||
|
||||
-- typescript specific keymaps (e.g. rename file and update imports)
|
||||
if client.name == "tsserver" then
|
||||
opts.desc = "Rename file and update file imports"
|
||||
keymap.set("n", "<leader>rf", ":TypescriptRenameFile<CR>") -- rename file and update imports
|
||||
|
||||
opts.desc = "Rename file and update file imports"
|
||||
keymap.set("n", "<leader>oi", ":TypescriptOrganizeImports<CR>", opts) -- organize imports (not in youtube nvim video)
|
||||
|
||||
opts.desc = "Remove unused imports"
|
||||
keymap.set("n", "<leader>ru", ":TypescriptRemoveUnused<CR>", opts) -- remove unused variables (not in youtube nvim video)
|
||||
end
|
||||
end
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- (not in youtube nvim video)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
-- configure html server
|
||||
lspconfig["html"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure typescript server with plugin
|
||||
typescript.setup({
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
},
|
||||
})
|
||||
|
||||
-- configure css server
|
||||
lspconfig["cssls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure tailwindcss server
|
||||
lspconfig["tailwindcss"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure svelte server
|
||||
lspconfig["svelte"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure prisma orm server
|
||||
lspconfig["prismals"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
-- configure graphql language server
|
||||
lspconfig["graphql"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" },
|
||||
})
|
||||
|
||||
-- configure emmet language server
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
|
||||
-- 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,
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
-- import lspsaga safely
|
||||
local saga_status, saga = pcall(require, "lspsaga")
|
||||
if not saga_status then
|
||||
return
|
||||
end
|
||||
|
||||
saga.setup({
|
||||
-- keybinds for navigation in lspsaga window
|
||||
scroll_preview = { scroll_down = "<C-f>", scroll_up = "<C-b>" },
|
||||
-- use enter to open file with definition preview
|
||||
definition = {
|
||||
edit = "<CR>",
|
||||
},
|
||||
ui = {
|
||||
colors = {
|
||||
normal_bg = "#022746",
|
||||
},
|
||||
},
|
||||
})
|
|
@ -1,45 +1,48 @@
|
|||
-- import mason plugin safely
|
||||
local mason_status, mason = pcall(require, "mason")
|
||||
if not mason_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import mason-lspconfig plugin safely
|
||||
local mason_lspconfig_status, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if not mason_lspconfig_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import mason-null-ls plugin safely
|
||||
local mason_null_ls_status, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if not mason_null_ls_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- enable mason
|
||||
mason.setup()
|
||||
|
||||
mason_lspconfig.setup({
|
||||
-- list of servers for mason to install
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"html",
|
||||
"cssls",
|
||||
"tailwindcss",
|
||||
"lua_ls",
|
||||
"emmet_ls",
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"jayp0521/mason-null-ls.nvim",
|
||||
},
|
||||
-- auto-install configured servers (with lspconfig)
|
||||
automatic_installation = true, -- not the same as ensure_installed
|
||||
})
|
||||
config = function()
|
||||
-- import mason plugin safely
|
||||
local mason = require("mason")
|
||||
|
||||
mason_null_ls.setup({
|
||||
-- list of formatters & linters for mason to install
|
||||
ensure_installed = {
|
||||
"prettier", -- ts/js formatter
|
||||
"stylua", -- lua formatter
|
||||
"eslint_d", -- ts/js linter
|
||||
},
|
||||
-- auto-install configured formatters & linters (with null-ls)
|
||||
automatic_installation = true,
|
||||
})
|
||||
-- import mason-lspconfig plugin safely
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
-- import mason-null-ls plugin safely
|
||||
local mason_null_ls = require("mason-null-ls")
|
||||
|
||||
-- enable mason
|
||||
mason.setup()
|
||||
|
||||
mason_lspconfig.setup({
|
||||
-- list of servers for mason to install
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"html",
|
||||
"cssls",
|
||||
"tailwindcss",
|
||||
"svelte",
|
||||
"lua_ls",
|
||||
"graphql",
|
||||
"emmet_ls",
|
||||
"prismals",
|
||||
},
|
||||
-- auto-install configured servers (with lspconfig)
|
||||
automatic_installation = true, -- not the same as ensure_installed
|
||||
})
|
||||
|
||||
mason_null_ls.setup({
|
||||
-- list of formatters & linters for mason to install
|
||||
ensure_installed = {
|
||||
"prettier", -- ts/js formatter
|
||||
"stylua", -- lua formatter
|
||||
"eslint_d", -- ts/js linter
|
||||
},
|
||||
-- auto-install configured servers (with lspconfig)
|
||||
automatic_installation = true,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,48 +1,56 @@
|
|||
-- import null-ls plugin safely
|
||||
local setup, null_ls = pcall(require, "null-ls")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
return {
|
||||
"jose-elias-alvarez/null-ls.nvim", -- configure formatters & linters
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
-- import null-ls plugin
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
-- for conciseness
|
||||
local formatting = null_ls.builtins.formatting -- to setup formatters
|
||||
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
|
||||
local null_ls_utils = require("null-ls.utils")
|
||||
|
||||
-- to setup format on save
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
-- for conciseness
|
||||
local formatting = null_ls.builtins.formatting -- to setup formatters
|
||||
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
|
||||
|
||||
-- configure null_ls
|
||||
null_ls.setup({
|
||||
-- setup formatters & linters
|
||||
sources = {
|
||||
-- to disable file types use
|
||||
-- "formatting.prettier.with({disabled_filetypes = {}})" (see null-ls docs)
|
||||
formatting.prettier, -- js/ts formatter
|
||||
formatting.stylua, -- lua formatter
|
||||
diagnostics.eslint_d.with({ -- js/ts linter
|
||||
-- only enable eslint if root has .eslintrc.js (not in youtube nvim video)
|
||||
condition = function(utils)
|
||||
return utils.root_has_file(".eslintrc.js") -- change file extension if you use something else
|
||||
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"
|
||||
-- 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
|
||||
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,
|
||||
bufnr = bufnr,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,36 +1,71 @@
|
|||
-- import lualine plugin safely
|
||||
local status, lualine = pcall(require, "lualine")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
local lazy_status = require("lazy.status") -- to configure lazy pending updates count
|
||||
|
||||
-- get lualine nightfly theme
|
||||
local lualine_nightfly = require("lualine.themes.nightfly")
|
||||
local colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
violet = "#FF61EF",
|
||||
yellow = "#FFDA7B",
|
||||
red = "#FF4A4A",
|
||||
fg = "#c3ccdc",
|
||||
bg = "#112638",
|
||||
inactive_bg = "#2c3043",
|
||||
}
|
||||
|
||||
-- new colors for theme
|
||||
local new_colors = {
|
||||
blue = "#65D1FF",
|
||||
green = "#3EFFDC",
|
||||
violet = "#FF61EF",
|
||||
yellow = "#FFDA7B",
|
||||
black = "#000000",
|
||||
local my_lualine_theme = {
|
||||
normal = {
|
||||
a = { bg = colors.blue, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
insert = {
|
||||
a = { bg = colors.green, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
visual = {
|
||||
a = { bg = colors.violet, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
command = {
|
||||
a = { bg = colors.yellow, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
replace = {
|
||||
a = { bg = colors.red, fg = colors.bg, gui = "bold" },
|
||||
b = { bg = colors.bg, fg = colors.fg },
|
||||
c = { bg = colors.bg, fg = colors.fg },
|
||||
},
|
||||
inactive = {
|
||||
a = { bg = colors.inactive_bg, fg = colors.semilightgray, gui = "bold" },
|
||||
b = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||
c = { bg = colors.inactive_bg, fg = colors.semilightgray },
|
||||
},
|
||||
}
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = my_lualine_theme,
|
||||
},
|
||||
sections = {
|
||||
lualine_x = {
|
||||
{
|
||||
lazy_status.updates,
|
||||
cond = lazy_status.has_updates,
|
||||
color = { fg = "#ff9e64" },
|
||||
},
|
||||
{ "encoding" },
|
||||
{ "fileformat" },
|
||||
{ "filetype" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
-- change nightlfy theme colors
|
||||
lualine_nightfly.normal.a.bg = new_colors.blue
|
||||
lualine_nightfly.insert.a.bg = new_colors.green
|
||||
lualine_nightfly.visual.a.bg = new_colors.violet
|
||||
lualine_nightfly.command = {
|
||||
a = {
|
||||
gui = "bold",
|
||||
bg = new_colors.yellow,
|
||||
fg = new_colors.black, -- black
|
||||
},
|
||||
}
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = lualine_nightfly,
|
||||
},
|
||||
})
|
||||
|
|
30
.config/nvim/lua/josean/plugins/nvim-autopairs.lua
Normal file
30
.config/nvim/lua/josean/plugins/nvim-autopairs.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = { "InsertEnter" },
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function()
|
||||
-- import nvim-autopairs
|
||||
local autopairs = require("nvim-autopairs")
|
||||
|
||||
-- configure autopairs
|
||||
autopairs.setup({
|
||||
check_ts = true, -- enable treesitter
|
||||
ts_config = {
|
||||
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
|
||||
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
|
||||
java = false, -- don't check treesitter on java
|
||||
},
|
||||
})
|
||||
|
||||
-- import nvim-autopairs completion functionality
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
-- import nvim-cmp plugin (completions plugin)
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- make autopairs and completion work together
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
|
@ -1,53 +1,54 @@
|
|||
-- import nvim-cmp plugin safely
|
||||
local cmp_status, cmp = pcall(require, "cmp")
|
||||
if not cmp_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import luasnip plugin safely
|
||||
local luasnip_status, luasnip = pcall(require, "luasnip")
|
||||
if not luasnip_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- import lspkind plugin safely
|
||||
local lspkind_status, lspkind = pcall(require, "lspkind")
|
||||
if not lspkind_status then
|
||||
return
|
||||
end
|
||||
|
||||
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
vim.opt.completeopt = "menu,menuone,noselect"
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
"onsails/lspkind.nvim",
|
||||
"L3MON4D3/LuaSnip", -- snippet engine
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }, -- lsp
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
-- configure lspkind for vs-code like icons
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
vim.opt.completeopt = "menu,menuone,noselect"
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }, -- lsp
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
-- configure lspkind for vs-code like icons
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
|
6
.config/nvim/lua/josean/plugins/nvim-surround.lua
Normal file
6
.config/nvim/lua/josean/plugins/nvim-surround.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"kylechui/nvim-surround",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||
config = true,
|
||||
}
|
|
@ -1,64 +1,56 @@
|
|||
-- import nvim-tree plugin safely
|
||||
local setup, nvimtree = pcall(require, "nvim-tree")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local nvimtree = require("nvim-tree")
|
||||
|
||||
-- recommended settings from nvim-tree documentation
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
-- recommended settings from nvim-tree documentation
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- change color for arrows in tree to light blue
|
||||
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
|
||||
-- change color for arrows in tree to light blue
|
||||
vim.cmd([[ highlight NvimTreeIndentMarker guifg=#3FC5FF ]])
|
||||
|
||||
-- configure nvim-tree
|
||||
nvimtree.setup({
|
||||
-- change folder arrow icons
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
folder = {
|
||||
arrow_closed = "", -- arrow when folder is closed
|
||||
arrow_open = "", -- arrow when folder is open
|
||||
-- configure nvim-tree
|
||||
nvimtree.setup({
|
||||
view = {
|
||||
width = 60,
|
||||
},
|
||||
-- change folder arrow icons
|
||||
renderer = {
|
||||
icons = {
|
||||
glyphs = {
|
||||
folder = {
|
||||
arrow_closed = "", -- arrow when folder is closed
|
||||
arrow_open = "", -- arrow when folder is open
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- disable window_picker for
|
||||
-- explorer to work well with
|
||||
-- window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = false,
|
||||
-- disable window_picker for
|
||||
-- explorer to work well with
|
||||
-- window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- git = {
|
||||
-- ignore = false,
|
||||
-- },
|
||||
})
|
||||
filters = {
|
||||
custom = { ".DS_Store" },
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- open nvim-tree on setup
|
||||
-- set keymaps
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
local function open_nvim_tree(data)
|
||||
-- buffer is a [No Name]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if not no_name and not directory then
|
||||
return
|
||||
end
|
||||
|
||||
-- change to the directory
|
||||
if directory then
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
|
||||
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>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
|
||||
-- Automatically jump forward to textobj, similar to targets.vim
|
||||
lookahead = true,
|
||||
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment region" },
|
||||
["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment region" },
|
||||
|
||||
["a:"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/field region" },
|
||||
["i:"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/field region" },
|
||||
|
||||
["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional region" },
|
||||
["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional region" },
|
||||
|
||||
["al"] = { query = "@loop.outer", desc = "Select outer part of a loop region" },
|
||||
["il"] = { query = "@loop.inner", desc = "Select inner part of a loop region" },
|
||||
|
||||
["ab"] = { query = "@block.outer", desc = "Select outer part of a block region" }, -- overrides default text object block of parenthesis to parenthesis
|
||||
["ib"] = { query = "@block.inner", desc = "Select inner part of a block region" }, -- overrides default text object block of parenthesis to parenthesis
|
||||
|
||||
["af"] = { query = "@function.outer", desc = "Select outer part of a function region" },
|
||||
["if"] = { query = "@function.inner", desc = "Select inner part of a function region" },
|
||||
|
||||
["ac"] = { query = "@class.outer", desc = "Select outer part of a class region" },
|
||||
["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
|
||||
},
|
||||
include_surrounding_whitespace = true,
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>on"] = "@parameter.inner", -- swap object under cursor with next
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>op"] = "@parameter.inner", -- swap object under cursor with previous
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
52
.config/nvim/lua/josean/plugins/nvim-treesitter.lua
Normal file
52
.config/nvim/lua/josean/plugins/nvim-treesitter.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
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",
|
||||
},
|
||||
-- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
-- auto install above language parsers
|
||||
auto_install = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
13
.config/nvim/lua/josean/plugins/nvim-web-devicons.lua
Normal file
13
.config/nvim/lua/josean/plugins/nvim-web-devicons.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
require("nvim-web-devicons").set_icon({
|
||||
gql = {
|
||||
icon = "",
|
||||
color = "#e535ab",
|
||||
cterm_color = "199",
|
||||
name = "GraphQL",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
|
@ -1,27 +1,59 @@
|
|||
-- import telescope plugin safely
|
||||
local telescope_setup, telescope = pcall(require, "telescope")
|
||||
if not telescope_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- import telescope actions safely
|
||||
local actions_setup, actions = pcall(require, "telescope.actions")
|
||||
if not actions_setup then
|
||||
return
|
||||
end
|
||||
|
||||
-- configure telescope
|
||||
telescope.setup({
|
||||
-- configure custom mappings
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist
|
||||
},
|
||||
},
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"ThePrimeagen/harpoon",
|
||||
},
|
||||
})
|
||||
config = function()
|
||||
-- import telescope plugin safely
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
-- import telescope actions safely
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
-- import telescope-ui-select safely
|
||||
local themes = require("telescope.themes")
|
||||
|
||||
-- configure telescope
|
||||
telescope.setup({
|
||||
-- configure custom mappings
|
||||
defaults = {
|
||||
path_display = { "truncate" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
themes.get_dropdown({}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("ui-select")
|
||||
telescope.load_extension("harpoon")
|
||||
|
||||
-- set keymaps
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" }) -- find files within current working directory, respects .gitignore
|
||||
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" }) -- find previously opened files
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" }) -- find string in current working directory as you type
|
||||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" }) -- find string under cursor in current working directory
|
||||
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>", { desc = "Show open buffers" }) -- list open buffers in current neovim instance
|
||||
keymap.set("n", "<leader>hf", "<cmd>Telescope harpoon marks<cr>", { desc = "Show harpoon marks" }) -- show harpoon marks
|
||||
keymap.set("n", "<leader>gc", "<cmd>Telescope git_commits<cr>", { desc = "Show git commits" }) -- list all git commits (use <cr> to checkout) ["gc" for git commits]
|
||||
keymap.set("n", "<leader>gfc", "<cmd>Telescope git_bcommits<cr>", { desc = "Show git commits for current buffer" }) -- list git commits for current file/buffer (use <cr> to checkout) ["gfc" for git file commits]
|
||||
keymap.set("n", "<leader>gb", "<cmd>Telescope git_branches<cr>", { desc = "Show git branches" }) -- list git branches (use <cr> to checkout) ["gb" for git branch]
|
||||
keymap.set("n", "<leader>gs", "<cmd>Telescope git_status<cr>", { desc = "Show current git changes per file" }) -- list current changes per file with diff preview ["gs" for git status]
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
-- import nvim-treesitter plugin safely
|
||||
local status, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||
if not status then
|
||||
return
|
||||
end
|
||||
|
||||
-- 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",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"svelte",
|
||||
"graphql",
|
||||
"bash",
|
||||
"lua",
|
||||
"vim",
|
||||
"dockerfile",
|
||||
"gitignore",
|
||||
},
|
||||
-- auto install above language parsers
|
||||
auto_install = true,
|
||||
})
|
6
.config/nvim/lua/josean/plugins/vim-maximizer.lua
Normal file
6
.config/nvim/lua/josean/plugins/vim-maximizer.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"szw/vim-maximizer",
|
||||
keys = {
|
||||
{ "<leader>sm", "<cmd>MaximizerToggle<CR>", { desc = "Maximize/minimize a split" } },
|
||||
},
|
||||
}
|
13
.config/nvim/lua/josean/plugins/which-key.lua
Normal file
13
.config/nvim/lua/josean/plugins/which-key.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 500
|
||||
end,
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue