mirror of
https://github.com/pratiktri/dotfiles.git
synced 2026-02-04 08:41:43 +05:30
Vscode-Neovim Support
- NeoVIM: Updates to NOT certain plugins in VSCode - NeoVIM: Keymaps loaded only when neovim and NOT for VSCode - VSCode: Added NeoVIM plugin with corresponding settings
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
-- Load Keybindings from VIM
|
||||
local vim_mappings = os.getenv("HOME") .. "/.vim/key_maps.vim"
|
||||
if vim.loop.fs_stat(vim_mappings) then
|
||||
local util = require("config.util")
|
||||
if vim.loop.fs_stat(vim_mappings) and util.is_not_vscode() then
|
||||
vim.cmd("source " .. vim_mappings)
|
||||
end
|
||||
|
||||
@@ -43,8 +44,10 @@ vim.keymap.set("i", ";", ";<C-g>u", { desc = "Auto add undo breakpoints on ';'"
|
||||
vim.keymap.set("i", "\r", "\r<C-g>u", { desc = "Auto add undo breakpoints on new lines" })
|
||||
|
||||
-- Traverse Buffer
|
||||
vim.keymap.set("n", "<Tab>", "<cmd>bnext<CR>", { desc = "Switch to next buffer" })
|
||||
vim.keymap.set("n", "<S-Tab>", "<cmd>bprevious<CR>", { desc = "Switch to previous buffer" })
|
||||
if require("config.util").is_not_vscode() then
|
||||
vim.keymap.set("n", "<Tab>", "<cmd>bnext<CR>", { desc = "Switch to next buffer" })
|
||||
vim.keymap.set("n", "<S-Tab>", "<cmd>bprevious<CR>", { desc = "Switch to previous buffer" })
|
||||
end
|
||||
|
||||
-- Save file
|
||||
vim.keymap.set({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
|
||||
|
||||
@@ -98,6 +98,10 @@ local M = {
|
||||
},
|
||||
}
|
||||
|
||||
function M.is_not_vscode()
|
||||
return not vim.g.vscode
|
||||
end
|
||||
|
||||
function M.fg(name)
|
||||
---@type {foreground?:number}?
|
||||
---@diagnostic disable-next-line: deprecated
|
||||
|
||||
@@ -5,6 +5,7 @@ return {
|
||||
{
|
||||
-- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
"L3MON4D3/LuaSnip",
|
||||
@@ -76,6 +77,7 @@ return {
|
||||
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
keys = {
|
||||
{
|
||||
"<tab>",
|
||||
|
||||
@@ -5,6 +5,7 @@ end
|
||||
return {
|
||||
{
|
||||
"tpope/vim-dadbod",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
opt = true,
|
||||
dependencies = {
|
||||
{ "kristijanhusak/vim-dadbod-ui" },
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
-- Creates a beautiful debugger UI
|
||||
"rcarriga/nvim-dap-ui",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
-- cond = require("config.util").is_not_vscode(),
|
||||
lazy = true,
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
|
||||
@@ -14,6 +14,7 @@ return {
|
||||
-- "gc" to comment visual regions/lines
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
config = function()
|
||||
require("Comment").setup({
|
||||
pre_hook = function()
|
||||
@@ -26,6 +27,7 @@ return {
|
||||
-- Better code folding
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"kevinhwang91/promise-async",
|
||||
@@ -114,6 +116,7 @@ return {
|
||||
-- indent guides for Neovim
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
opts = {
|
||||
indent = { char = "│", tab_char = "│" },
|
||||
scope = { enabled = false },
|
||||
@@ -139,6 +142,7 @@ return {
|
||||
-- Highlights the current level of indentation, and animates the highlighting.
|
||||
{
|
||||
"echasnovski/mini.indentscope",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
opts = { symbol = "│", options = { try_as_border = true } },
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
@@ -281,6 +285,7 @@ return {
|
||||
-- Inlay hints
|
||||
{
|
||||
"lvimuser/lsp-inlayhints.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
config = function()
|
||||
require("lsp-inlayhints").setup()
|
||||
|
||||
@@ -304,6 +309,7 @@ return {
|
||||
-- LspSaga
|
||||
{
|
||||
"nvimdev/lspsaga.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
@@ -412,6 +418,7 @@ return {
|
||||
-- Refactor code: Refactoring book by Martin Fowler
|
||||
{
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
@@ -2,6 +2,7 @@ return {
|
||||
-- Better fugitive: neogit
|
||||
{
|
||||
"NeogitOrg/neogit",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"sindrets/diffview.nvim",
|
||||
@@ -30,6 +31,7 @@ return {
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
@@ -109,6 +111,7 @@ return {
|
||||
-- Git worktree
|
||||
{
|
||||
"ThePrimeagen/git-worktree.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
config = function()
|
||||
-- FIX: Open files do NOT get replaced with the changed branch
|
||||
require("telescope").load_extension("git_worktree")
|
||||
|
||||
@@ -33,6 +33,7 @@ return {
|
||||
{
|
||||
-- LSP Configuration & Plugins
|
||||
"neovim/nvim-lspconfig",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
@@ -46,6 +47,7 @@ return {
|
||||
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
config = function()
|
||||
-- Configure LSP
|
||||
|
||||
@@ -64,6 +66,7 @@ return {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
completion = { callSnippet = "Replace" },
|
||||
hint = { enable = true },
|
||||
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
@@ -95,7 +98,7 @@ return {
|
||||
},
|
||||
typescript = {
|
||||
inlayHints = {
|
||||
-- includeInlayParameterNameHints = 'all',
|
||||
includeInlayParameterNameHints = "all",
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||
includeInlayFunctionParameterTypeHints = true,
|
||||
includeInlayVariableTypeHints = true,
|
||||
@@ -107,7 +110,7 @@ return {
|
||||
},
|
||||
javascript = {
|
||||
inlayHints = {
|
||||
-- includeInlayParameterNameHints = 'all',
|
||||
includeInlayParameterNameHints = "all",
|
||||
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
||||
includeInlayFunctionParameterTypeHints = true,
|
||||
includeInlayVariableTypeHints = true,
|
||||
@@ -173,6 +176,7 @@ return {
|
||||
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
opts = {
|
||||
progress = {
|
||||
poll_rate = 1, -- How and when to poll for progress messages
|
||||
|
||||
@@ -3,11 +3,12 @@ return {
|
||||
-- Taken from LazyVim
|
||||
{
|
||||
"nvim-neotest/neotest",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"marilari88/neotest-vitest"
|
||||
"marilari88/neotest-vitest",
|
||||
},
|
||||
opts = {
|
||||
-- Do NOT add adapters here
|
||||
@@ -31,8 +32,7 @@ return {
|
||||
virtual_text = {
|
||||
format = function(diagnostic)
|
||||
-- Replace newline and tab characters with space for more compact diagnostics
|
||||
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+",
|
||||
"")
|
||||
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
|
||||
return message
|
||||
end,
|
||||
},
|
||||
|
||||
@@ -114,6 +114,7 @@ return {
|
||||
-- File Explorer: Neotree
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
branch = "v3.x",
|
||||
keys = {
|
||||
{ "<leader>e", "<CMD>Neotree filesystem toggle<CR>", desc = "Open NeoTree Explorer at Git root", remap = true },
|
||||
@@ -206,6 +207,7 @@ return {
|
||||
-- Telescope: Fuzzy Finder (files, lsp, etc)
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
return {
|
||||
-- icons
|
||||
{ "nvim-tree/nvim-web-devicons" },
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
},
|
||||
|
||||
-- ui components
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
{
|
||||
"MunifTanjim/nui.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
},
|
||||
|
||||
-- Better vim.ui
|
||||
{ "stevearc/dressing.nvim" },
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
},
|
||||
|
||||
{ "machakann/vim-highlightedyank" },
|
||||
|
||||
-- colorscheme
|
||||
{
|
||||
"projekt0n/github-nvim-theme",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
@@ -23,6 +33,7 @@ return {
|
||||
-- Show buffers like VS Code tabs
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
dependencies = {
|
||||
{ "echasnovski/mini.bufremove", version = "*" },
|
||||
},
|
||||
@@ -72,6 +83,7 @@ return {
|
||||
-- Better `vim.notify()`
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
keys = {
|
||||
{
|
||||
"<leader>xn",
|
||||
@@ -106,6 +118,7 @@ return {
|
||||
-- Completely replaces the UI for messages, cmdline and the popupmenu.
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
@@ -177,6 +190,7 @@ return {
|
||||
-- Set lualine as statusline
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
init = function()
|
||||
vim.g.lualine_laststatus = vim.o.laststatus
|
||||
if vim.fn.argc(-1) > 0 then
|
||||
|
||||
@@ -176,11 +176,15 @@ return {
|
||||
},
|
||||
|
||||
-- Navigate between NVIM & Tmux splits seamlessly
|
||||
{ "christoomey/vim-tmux-navigator" },
|
||||
{
|
||||
"christoomey/vim-tmux-navigator",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
},
|
||||
|
||||
-- Navigate between NVIM & kitty splits
|
||||
{
|
||||
"knubie/vim-kitty-navigator",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
build = "cp ./*.py ~/.config/kitty/",
|
||||
keys = {
|
||||
{ "<C-S-h>", "<cmd>KittyNavigateLeft<cr>" },
|
||||
@@ -194,6 +198,7 @@ return {
|
||||
{
|
||||
"mikesmithgh/kitty-scrollback.nvim",
|
||||
lazy = true,
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
cmd = { "KittyScrollbackGenerateKittens", "KittyScrollbackCheckHealth" },
|
||||
event = { "User KittyScrollbackLaunch" },
|
||||
version = "^4.0.0",
|
||||
@@ -210,6 +215,7 @@ return {
|
||||
-- Changes the Nvim root to git root
|
||||
{
|
||||
"airblade/vim-rooter",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
config = function()
|
||||
vim.g.rooter_cd_cmd = "tcd" -- Use tcd command to change the root
|
||||
end,
|
||||
@@ -265,6 +271,7 @@ return {
|
||||
-- Speedup loading large files by disabling some plugins
|
||||
{
|
||||
"LunarVim/bigfile.nvim",
|
||||
cond = require("config.util").is_not_vscode(),
|
||||
lazy = true,
|
||||
opts = {
|
||||
filesize = 2, --2MiB
|
||||
|
||||
Reference in New Issue
Block a user