add plugins

This commit is contained in:
Vinit Neogi 2023-10-08 23:55:49 +05:30
parent cc75c445f7
commit 47048db3b1
11 changed files with 300 additions and 45 deletions

View File

@ -86,7 +86,7 @@ require('lazy').setup({
-- Useful status updates for LSP -- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing! -- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim', 'folke/neodev.nvim',
@ -110,7 +110,7 @@ require('lazy').setup({
}, },
-- Useful plugin to show you pending keybinds. -- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} }, { 'folke/which-key.nvim', opts = {} },
{ {
-- Adds git related signs to the gutter, as well as utilities for managing changes -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
@ -128,16 +128,16 @@ require('lazy').setup({
-- don't override the built-in and fugitive keymaps -- don't override the built-in and fugitive keymaps
local gs = package.loaded.gitsigns local gs = package.loaded.gitsigns
vim.keymap.set({'n', 'v'}, ']c', function() vim.keymap.set({ 'n', 'v' }, ']c', function()
if vim.wo.diff then return ']c' end if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end) vim.schedule(function() gs.next_hunk() end)
return '<Ignore>' return '<Ignore>'
end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"}) end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" })
vim.keymap.set({'n', 'v'}, '[c', function() vim.keymap.set({ 'n', 'v' }, '[c', function()
if vim.wo.diff then return '[c' end if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end) vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>' return '<Ignore>'
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"}) end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" })
end, end,
}, },
}, },
@ -151,19 +151,19 @@ require('lazy').setup({
-- end, -- end,
-- }, -- },
{ -- {
-- Set lualine as statusline -- -- Set lualine as statusline
'nvim-lualine/lualine.nvim', -- 'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt` -- -- See `:help lualine.txt`
opts = { -- opts = {
options = { -- options = {
icons_enabled = false, -- icons_enabled = false,
-- theme = 'onedark', -- -- theme = 'onedark',
component_separators = '|', -- component_separators = '|',
section_separators = '', -- section_separators = '',
}, -- },
}, -- },
}, -- },
{ {
-- Add indentation guides even on blank lines -- Add indentation guides even on blank lines
@ -212,7 +212,7 @@ require('lazy').setup({
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- These are some example plugins that I've included in the kickstart repository. -- These are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them. -- Uncomment any of the lines below to enable them.
-- require 'kickstart.plugins.autoformat', require 'kickstart.plugins.autoformat',
require 'kickstart.plugins.debug', require 'kickstart.plugins.debug',
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
@ -233,6 +233,7 @@ vim.o.hlsearch = false
-- Make line numbers default -- Make line numbers default
vim.wo.number = true vim.wo.number = true
vim.o.relativenumber = true
-- Enable mouse mode -- Enable mouse mode
vim.o.mouse = 'a' vim.o.mouse = 'a'
@ -265,12 +266,44 @@ vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this -- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true vim.o.termguicolors = true
vim.o.tabstop = 4
vim.o.softtabstop = 4
vim.o.shiftwidth = 4
vim.o.expandtab = true
vim.o.smartindent = true
vim.o.incsearch = true
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.o.updatetime = 50
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
-- Keymaps for better default experience -- Keymaps for better default experience
-- See `:help vim.keymap.set()` -- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set("x", "<leader>p", [["_dP]], { desc = "Paste without writing current text into register" })
vim.keymap.set("n", "<leader>x", '"_x', { desc = "Delete character but don't copy into register" })
vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Center screen when scrolling up" })
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Center screen when scrolling down" })
vim.keymap.set("n", "n", "nzz", { desc = "Center screen when going to next search result" })
vim.keymap.set("n", "N", "Nzz", { desc = "Center screen when going to previous search result" })
vim.keymap.set("n", "t", "tzz", { desc = "Center screen when going until next search result" })
vim.keymap.set("n", "T", "Tzz", { desc = "Center screen when going until previous search result" })
-- Remap ESC key in different modes
vim.keymap.set("i", "kj", "<ESC>", { desc = "Escape when in insert mode" })
vim.keymap.set("v", "kj", "<ESC>", { desc = "Escape when in visual mode" })
vim.keymap.set("c", "kj", "<ESC>", { desc = "Escape when in change mode" })
-- Remap for dealing with word wrap -- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })

View File

@ -0,0 +1,15 @@
return {
"windwp/nvim-autopairs",
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require("nvim-autopairs").setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
end,
}

View File

@ -0,0 +1,8 @@
return {
'catppuccin/nvim',
name = 'catppuccin',
config = function()
vim.cmd.colorscheme 'catppuccin-frappe'
end,
priority = 1000,
}

View File

@ -0,0 +1,8 @@
return {
"sudormrfbin/cheatsheet.nvim",
dependencies = {
{ "nvim-telescope/telescope.nvim" },
{ "nvim-lua/popup.nvim" },
{ "nvim-lua/plenary.nvim" },
},
}

View File

@ -0,0 +1,33 @@
return {
"folke/flash.nvim",
event = "VeryLazy",
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{
"s",
mode = { "n", "o", "x" },
function()
require("flash").jump({
search = {
mode = function(str)
return "\\<" .. str
end,
},
})
end,
desc = "Flash"
},
{ "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{
"<c-s>",
mode = { "c" },
function() require("flash").toggle() end,
desc =
"Toggle Flash Search"
},
},
}

View File

@ -0,0 +1,31 @@
return {
'ThePrimeagen/harpoon',
config = function()
require("harpoon").setup()
vim.keymap.set("n", "<leader>ha", require("harpoon.mark").add_file, { desc = "[H]arpoon [A]dd file" })
vim.keymap.set("n", "<leader>ht", require("harpoon.ui").toggle_quick_menu,
{ desc = "[H]arpoon [T]oggle quick menu" })
vim.keymap.set("n", "<leader>hn", require("harpoon.ui").nav_next, { desc = "[H]arpoon nav [N]ext" })
vim.keymap.set("n", "<leader>hp", require("harpoon.ui").nav_prev, { desc = "[H]arpoon nav [P]revious" })
vim.keymap.set("n", "<leader>h1", function() require("harpoon.ui").nav_file(1) end,
{ desc = "[H]arpoon goto file [1]" })
vim.keymap.set("n", "<leader>h2", function() require("harpoon.ui").nav_file(2) end,
{ desc = "[H]arpoon goto file [2]" })
vim.keymap.set("n", "<leader>h3", function() require("harpoon.ui").nav_file(3) end,
{ desc = "[H]arpoon goto file [3]" })
vim.keymap.set("n", "<leader>h4", function() require("harpoon.ui").nav_file(4) end,
{ desc = "[H]arpoon goto file [4]" })
vim.keymap.set("n", "<leader>hm1", function() require("harpoon.tmux").gotoTerminal(1) end,
{ desc = "[H]arpoon goto {T]mux window [1]" })
vim.keymap.set("n", "<leader>hm2", function() require("harpoon.tmux").gotoTerminal(2) end,
{ desc = "[H]arpoon goto {T]mux window [2]" })
vim.keymap.set("n", "<leader>hm3", function() require("harpoon.tmux").gotoTerminal(3) end,
{ desc = "[H]arpoon goto {T]mux window [3]" })
vim.keymap.set("n", "<leader>hm4", function() require("harpoon.tmux").gotoTerminal(4) end,
{ desc = "[H]arpoon goto {T]mux window [4]" })
end,
dependencies = {
"nvim-lua/plenary.nvim",
},
}

View File

@ -2,33 +2,15 @@
-- I promise not to create any merge conflicts in this directory :) -- I promise not to create any merge conflicts in this directory :)
-- --
-- See the kickstart.nvim README for more information -- See the kickstart.nvim README for more information
vim.o.relativenumber = true
return { return {
{ --[[ {
'catppuccin/nvim', 'theprimeagen/harpoon',
name = 'catppuccin',
priority = 1000,
config = function()
vim.cmd.colorscheme 'catppuccin-frappe'
end,
}, },
]] --[[ {
'mbbill/undotree'
} ]]
{ {
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
dependencies = {
'nvim-tree/nvim-web-devicons'
},
opts = {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = '|',
section_separators = '',
},
},
},
'nvim-web-devicons',
}
} }

View File

@ -0,0 +1,44 @@
local function lsp_name(msg)
msg = msg or "Inactive"
local buf_clients = vim.lsp.get_active_clients()
if next(buf_clients) == nil then
if type(msg) == "boolean" or #msg == 0 then
return "Inactive"
end
return msg
end
local buf_client_names = {}
for _, client in pairs(buf_clients) do
if client.name ~= "null-ls" then
table.insert(buf_client_names, client.name)
end
end
return table.concat(buf_client_names, ", ")
end
return {
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
dependencies = {
'nvim-tree/nvim-web-devicons'
},
opts = {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = '|',
section_separators = '',
},
sections = {
lualine_y = {
{
lsp_name,
icon = "",
},
},
}
},
}

View File

@ -0,0 +1,74 @@
-- return {
-- "nvim-neo-tree/neo-tree.nvim",
-- branch = "v3.x",
-- dependencies = {
-- "nvim-lua/plenary.nvim",
-- "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
-- "MunifTanjim/nui.nvim",
-- },
-- opts = {
-- window = {
-- position = "left",
-- width = 40,
-- mapping_options = {
-- noremap = true,
-- nowait = true,
-- },
-- },
-- filesystem = {
-- filtered_items = {
-- visible = false, -- when true, they will just be displayed differently than normal items
-- hide_dotfiles = false,
-- hide_gitignored = true,
-- hide_hidden = true, -- only works on Windows for hidden files/directories
-- hide_by_name = {
-- "node_modules"
-- },
-- hide_by_pattern = { -- uses glob style patterns
-- --"*.meta",
-- --"*/src/*/tsconfig.json",
-- },
-- always_show = { -- remains visible even if other settings would normally hide it
-- --".gitignored",
-- },
-- never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
-- --".DS_Store",
-- --"thumbs.db"
-- },
-- never_show_by_pattern = { -- uses glob style patterns
-- --".null-ls_*",
-- },
-- },
-- follow_current_file = {
-- enabled = false, -- This will find and focus the file in the active buffer every time
-- -- -- the current file is changed while the tree is open.
-- leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
-- },
-- group_empty_dirs = false, -- when true, empty folders will be grouped together
-- hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
-- },
-- },
-- config = function()
-- require("neo-tree").setup()
-- vim.keymap.set("n", "<leader>T", "<Cmd>Neotree toggle current reveal_force_cwd<CR>")
-- vim.keymap.set("n", "<leader>|", "<Cmd>Neotree reveal<CR>")
-- vim.keymap.set("n", "gd", "<Cmd>:Neotree float reveal_file=<cfile> reveal_force_cwd<CR>")
-- vim.keymap.set("n", "<leader>Br", "<Cmd>:Neotree toggle show buffers right<CR>")
-- vim.keymap.set("n", "<leader>Gs", "<Cmd>:Neotree float git_status<CR>")
-- end
-- }
-- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
return {
"nvim-neo-tree/neo-tree.nvim",
version = "*",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
config = function ()
require('neo-tree').setup {}
end,
}

View File

@ -0,0 +1,9 @@
return {
'nvim-tree/nvim-tree.lua',
config = function()
require("nvim-tree").setup()
vim.keymap.set("n", "<leader>f", ":NvimTreeToggle<cr>", { desc = "Toggle NvimTree" })
end,
-- cmd = { "NvimTreeToggle", "NvimTreeOpen", "NvimTreeFocus", "NvimTreeFindFileToggle" },
-- event = "User DirOpened",
}

View File

@ -0,0 +1,18 @@
return {
'akinsho/toggleterm.nvim',
version = "*",
config = function()
require('toggleterm').setup({
open_mapping = "<C-\\>",
direction = "float",
})
local terminal = require('toggleterm.terminal')
vim.keymap.set({ "n", "v", "t" }, "<leader>tt", "<Cmd>ToggleTerm direction=tab<cr>", { desc = "ToggleTerm tab" });
vim.keymap.set({ "n", "v", "t" }, "<leader>th", "<Cmd>ToggleTerm direction=horizontal<cr>",
{ desc = "ToggleTerm horizontal" });
vim.keymap.set({ "n", "v", "t" }, "<leader>tv", "<Cmd>ToggleTerm direction=vertical<cr>",
{ desc = "ToggleTerm vertical" });
vim.keymap.set({ "n", "v", "t" }, "<leader>tn", function() terminal.Terminal:new():toggle() end,
{ desc = "ToggleTerm new" });
end
}