From 7851cfe3a0b1c0c79450b09435e280490acaf845 Mon Sep 17 00:00:00 2001 From: harshitsharmas84 Date: Wed, 7 May 2025 12:16:04 +0530 Subject: [PATCH] Done --- init.lua | 22 ++++++------ kickstart.nvim | 1 + lua/custom/plugins/copilot.lua | 32 +++++++++++++++++ lua/custom/plugins/init.lua | 4 ++- lua/custom/plugins/tab_keymaps.lua | 21 +++++++++++ lua/custom/plugins/toggleterm.lua | 58 ++++++++++++++++++++++++++++++ lua/kickstart/plugins/lint.lua | 3 +- 7 files changed, 129 insertions(+), 12 deletions(-) create mode 160000 kickstart.nvim create mode 100644 lua/custom/plugins/copilot.lua create mode 100644 lua/custom/plugins/tab_keymaps.lua create mode 100644 lua/custom/plugins/toggleterm.lua diff --git a/init.lua b/init.lua index 776c6873..e96cbcbb 100644 --- a/init.lua +++ b/init.lua @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -166,7 +166,9 @@ vim.opt.confirm = true -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` -vim.keymap.set('n', '', 'nohlsearch') +-- vim.keymap.set('n', '', 'nohlsearch') +-- Replaced with a better approach that doesn't override Escape's normal function +vim.keymap.set('n', '/', 'nohlsearch', { desc = 'Clear search highlights' }) -- Diagnostic keymaps vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) @@ -177,7 +179,7 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn -- -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping -- or just use to exit terminal mode -vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode -- vim.keymap.set('n', '', 'echo "Use h to move!!"') @@ -965,18 +967,18 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/kickstart.nvim b/kickstart.nvim new file mode 160000 index 00000000..d350db24 --- /dev/null +++ b/kickstart.nvim @@ -0,0 +1 @@ +Subproject commit d350db2449da40df003c40d440f909d74e2d4e70 diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000..c111f7b2 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,32 @@ +-- GitHub Copilot configuration +-- https://github.com/github/copilot.vim + +return { + "github/copilot.vim", + event = "InsertEnter", + config = function() + -- Disable default mappings + vim.g.copilot_no_maps = true + + -- Key mappings + vim.keymap.set('i', '', 'copilot#Accept("")', { + expr = true, + replace_keycodes = false, + silent = true, + }) + + -- Additional keymaps for Copilot + vim.keymap.set('i', '', '(copilot-accept-word)', { silent = true }) + vim.keymap.set('i', '', '(copilot-next)', { silent = true }) + -- Changed from to (Alt+[) to avoid conflicting with Escape + vim.keymap.set('i', '', '(copilot-previous)', { silent = true }) + vim.keymap.set('i', '', '(copilot-dismiss)', { silent = true }) + + -- Additional settings + vim.g.copilot_filetypes = { + ["*"] = true, + ["markdown"] = true, + ["help"] = false, + } + end, +} \ No newline at end of file diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index be0eb9d8..70d7986c 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -2,4 +2,6 @@ -- I promise not to create any merge conflicts in this directory :) -- -- See the kickstart.nvim README for more information -return {} +return { + -- Load all plugin files in the custom/plugins directory +} diff --git a/lua/custom/plugins/tab_keymaps.lua b/lua/custom/plugins/tab_keymaps.lua new file mode 100644 index 00000000..5f28475f --- /dev/null +++ b/lua/custom/plugins/tab_keymaps.lua @@ -0,0 +1,21 @@ +-- Tab management keymaps +-- These provide VS Code-like tab navigation and management + +-- Create a new empty tab +vim.keymap.set('n', 'tn', ':tabnew', { desc = 'New tab' }) + +-- Create a new tab and open Telescope file finder +vim.keymap.set('n', 'to', ':tabnew:Telescope find_files', { desc = 'New tab with file' }) + +-- Close the current tab +vim.keymap.set('n', 'tc', ':tabclose', { desc = 'Close tab' }) + +-- Navigate to next tab (similar to VS Code) +vim.keymap.set('n', '', 'gt', { desc = 'Next tab' }) + +-- Navigate to previous tab (similar to VS Code) +vim.keymap.set('n', '', 'gT', { desc = 'Previous tab' }) + +-- Add this keymap group to Which-key if you're using it +-- (the plugin will automatically pick this up on next restart) +return {} \ No newline at end of file diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua new file mode 100644 index 00000000..30eb55ae --- /dev/null +++ b/lua/custom/plugins/toggleterm.lua @@ -0,0 +1,58 @@ +-- toggleterm.lua +-- A plugin that helps manage multiple terminal windows in Neovim +-- Github: https://github.com/akinsho/toggleterm.nvim + +return { + -- The repository on GitHub + 'akinsho/toggleterm.nvim', + + -- Use the latest stable version + version = "*", + + -- Configuration options for the plugin + opts = { + -- Ctrl+\ will toggle the terminal visibility + open_mapping = [[]], + + -- Terminal appears as a floating window by default + direction = 'float', + + -- How the floating window should look + float_opts = { + -- Curved borders for a nicer appearance + border = 'curved', + }, + + -- Slightly dim the terminal background + shade_terminals = true, + + -- How much to dim the terminal (0-100) + shading_factor = 2, + + -- Function to determine size based on terminal direction + size = function(term) + if term.direction == "horizontal" then + -- 15 lines height for horizontal terminals + return 15 + elseif term.direction == "vertical" then + -- 40% of window width for vertical terminals + return vim.o.columns * 0.4 + end + end, + }, + + -- Extra key mappings for different terminal layouts + keys = { + -- Leader+th opens a horizontal terminal at the bottom + { "th", "ToggleTerm direction=horizontal", desc = "Terminal Horizontal" }, + + -- Leader+tv opens a vertical terminal at the side + { "tv", "ToggleTerm direction=vertical", desc = "Terminal Vertical" }, + + -- Leader+tf opens a floating terminal (alternative to Ctrl+\) + { "tf", "ToggleTerm direction=float", desc = "Terminal Float" }, + + -- Leader+tt opens a new terminal tab + { "tt", "ToggleTerm direction=tab", desc = "Terminal Tab" }, + }, +} \ No newline at end of file diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 907c6bf3..2d3193bf 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -6,7 +6,8 @@ return { config = function() local lint = require 'lint' lint.linters_by_ft = { - markdown = { 'markdownlint' }, + -- Commenting out markdownlint to prevent errors + -- markdown = { 'markdownlint' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft,