This commit is contained in:
rapzy 2024-03-10 17:34:27 +05:45
parent 3cfccc01be
commit af6bff337e
1 changed files with 41 additions and 4 deletions

View File

@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
vim.opt.number = true vim.opt.number = true
-- You can also add relative line numbers, for help with jumping. -- You can also add relative line numbers, for help with jumping.
-- Experiment for yourself to see if you like it! -- 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! -- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
@ -158,6 +158,10 @@ vim.opt.scrolloff = 10
vim.opt.hlsearch = true vim.opt.hlsearch = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Move line of code up or down
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
-- Diagnostic keymaps -- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
@ -187,6 +191,12 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- CUSTOM KEYBINDINGS
-- jk to enter normal mode
vim.keymap.set('i', 'jk', '<ESC>')
-- Open Netrw
vim.keymap.set('n', 'rw', ':Ex!<CR>')
-- [[ Basic Autocommands ]] -- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands` -- See `:help lua-guide-autocommands`
@ -197,7 +207,7 @@ vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text', desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function() callback = function()
vim.highlight.on_yank() vim.highlight.on_yank { timeout = 100 }
end, end,
}) })
@ -225,11 +235,23 @@ require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
-- NVIM CHATGPT
-- {
-- 'jackMort/ChatGPT.nvim',
-- event = 'VeryLazy',
-- dependencies = {
-- 'MunifTanjim/nui.nvim',
-- 'nvim-lua/plenary.nvim',
-- 'nvim-telescope/telescope.nvim',
-- },
-- },
-- NOTE: Plugins can also be added by using a table, -- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following -- with the first argument being the link and the following
-- keys can be used to configure plugin behavior/loading/etc. -- keys can be used to configure plugin behavior/loading/etc.
-- --
-- Use `opts = {}` to force a plugin to be loaded. -- Use `opts = {}` to force a plugin to be loaded.
-- NOTE plugins
-- --
-- This is equivalent to: -- This is equivalent to:
-- require('Comment').setup({}) -- require('Comment').setup({})
@ -653,12 +675,13 @@ require('lazy').setup({
-- you can use this plugin to help you. It even has snippets -- you can use this plugin to help you. It even has snippets
-- for various frameworks/libraries/etc. but you will have to -- for various frameworks/libraries/etc. but you will have to
-- set up the ones that are useful for you. -- set up the ones that are useful for you.
-- 'rafamadriz/friendly-snippets', 'rafamadriz/friendly-snippets',
}, },
config = function() config = function()
-- See `:help cmp` -- See `:help cmp`
local cmp = require 'cmp' local cmp = require 'cmp'
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {} luasnip.config.setup {}
cmp.setup { cmp.setup {
@ -778,18 +801,32 @@ require('lazy').setup({
{ -- Highlight, edit, and navigate code { -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
'nvim-treesitter/nvim-treesitter-context',
build = ':TSUpdate', build = ':TSUpdate',
config = function() config = function()
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' }, ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc', 'javascript', 'css', 'python' },
-- Autoinstall languages that are not installed -- Autoinstall languages that are not installed
auto_install = true, auto_install = true,
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
} }
-- require('treesitter-context').setup {
-- enable = true, -- Enable this plugin
-- max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
-- min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
-- line_numbers = true,
-- multiline_threshold = 20, -- Maximum number of lines to show for a single context
-- trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
-- mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
-- separator = nil, -- Separator between context and content. Should be a single character string, like '-'.
-- -- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
-- zindex = 20, -- The Z-index of the context window
-- on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
-- }
-- There are additional nvim-treesitter modules that you can use to interact -- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you: -- with nvim-treesitter. You should go explore a few and see what interests you: