added autopairs, comment, cursor animation, indentation, smooth scrolling, surround and other plugins for neovim

This commit is contained in:
2025-05-26 01:49:43 +05:30
parent 04483ed6aa
commit 264319500b
10 changed files with 161 additions and 51 deletions

8
.luarc.json Normal file
View File

@@ -0,0 +1,8 @@
{
"diagnostics.globals": [
"vim"
],
"diagnostics.disable": [
"undefined-global"
]
}

View File

@@ -0,0 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/LuaLS/lua-language-server/master/schema/luarc.json",
"diagnostics.globals": ["vim"],
}

View File

@@ -0,0 +1,20 @@
local npairs = require("nvim-autopairs")
local Rule = require("nvim-autopairs.rule")
npairs.setup({
check_ts = true,
ts_config = {
python = { "string" },
},
})
npairs.add_rules({
Rule(" ", " "):with_pair(function(opts)
return vim.tbl_contains({ "()", "[]", "{}" }, opts.line:sub(opts.col - 1, opts.col))
end),
})
npairs.add_rules({
Rule("'''", "'''", "python"),
Rule('"""', '"""', "python"),
})

View File

@@ -0,0 +1,16 @@
require("Comment").setup({
-- pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
toggler = {
line = "<leader>cc", -- Line-comment toggle keymap
block = "<leader>bc",
},
opleader = {
line = "<leader>c",
block = "<leader>b",
},
extra = {
above = "<leader>cO",
below = "<leader>co",
eol = "<leader>cA",
},
})

View File

@@ -0,0 +1,24 @@
require("ibl").setup({
indent = {
char = "", --"│",
tab_char = "",
},
scope = {
show_start = false,
show_end = false,
},
exclude = {
filetypes = {
"help",
"alpha",
"dashboard",
"neo-tree",
"Trouble",
"lazy",
"mason",
"notify",
"togglerterm",
"lazyterm",
},
},
})

View File

@@ -0,0 +1,11 @@
require("neoscroll").setup({
mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "zz", "zt", "zb" },
hide_cursor = true,
stop_eof = true,
respect_scrolloff = false,
cursor_scrolls_alone = true,
easing_function = "quadratic",
pre_hook = nil,
post_hook = nil,
performance_mode = false,
})

View File

@@ -0,0 +1,14 @@
require("nvim-surround").setup({
keymaps = {
insert = "<C-g>s",
insert_line = "<C-g>S",
normal = "ys",
normal_cur = "yss",
normal_line = "yS",
normal_cur_line = "ySS",
visual = "S",
visual_line = "gS",
delete = "ds",
change = "cs",
},
})

View File

@@ -44,6 +44,14 @@ require("lazy").setup({
"windwp/nvim-ts-autotag",
},
},
{
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
config = function()
require("nvim-surround").setup()
end,
},
-- LSP
{
"neovim/nvim-lspconfig",
@@ -55,9 +63,6 @@ require("lazy").setup({
"saghen/blink.cmp",
},
},
{
"nvim-java/nvim-java",
},
{ -- Autoformat
"stevearc/conform.nvim",
event = { "BufWritePre" },
@@ -90,11 +95,9 @@ require("lazy").setup({
end,
formatters_by_ft = {
lua = { "stylua" },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
python = { "isort", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
},
},
},
@@ -109,9 +112,6 @@ require("lazy").setup({
"L3MON4D3/LuaSnip",
version = "2.*",
build = (function()
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
return
end
@@ -133,42 +133,14 @@ require("lazy").setup({
--- @type blink.cmp.Config
opts = {
keymap = {
-- 'default' (recommended) for mappings similar to built-in completions
-- <c-y> to accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
-- 'super-tab' for tab to accept
-- 'enter' for enter to accept
-- 'none' for no mappings
--
-- For an understanding of why the 'default' preset is recommended,
-- you will need to read `:help ins-completion`
--
-- No, but seriously. Please read `:help ins-completion`, it is really good!
--
-- All presets have the following mappings:
-- <tab>/<s-tab>: move to right/left of your snippet expansion
-- <c-space>: Open menu or open docs if already open
-- <c-n>/<c-p> or <up>/<down>: Select next/previous item
-- <c-e>: Hide menu
-- <c-k>: Toggle signature help
--
-- See :h blink-cmp-config-keymap for defining your own keymap
preset = "default",
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = "mono",
},
completion = {
-- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 },
},
@@ -180,17 +152,7 @@ require("lazy").setup({
},
snippets = { preset = "luasnip" },
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
-- which automatically downloads a prebuilt binary when enabled.
--
-- By default, we use the Lua implementation instead, but you may enable
-- the rust implementation via `'prefer_rust_with_warning'`
--
-- See :h blink-cmp-config-fuzzy for more information
fuzzy = { implementation = "lua" },
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
},
},
@@ -208,8 +170,6 @@ require("lazy").setup({
opts = {},
-- Optional dependencies
dependencies = { { "echasnovski/mini.icons", opts = {} } },
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
-- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
lazy = false,
config = function()
require("oil").setup({
@@ -218,6 +178,23 @@ require("lazy").setup({
vim.keymap.set("n", "-", "<cmd>Oil<CR>", { desc = "open parent directory" })
end,
},
{ "numToStr/Comment.nvim", opts = {} },
{ "windwp/nvim-autopairs", event = "InsertEnter", opts = {} },
{ "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} },
{
"karb94/neoscroll.nvim",
event = "VeryLazy",
config = function()
require("neoscroll").setup()
end,
},
{
"sphamba/smear-cursor.nvim",
event = "VeryLazy",
opts = {
smear_between_neighbour_lines = true,
},
},
},
defaults = {
lazy = false,

View File

@@ -21,16 +21,52 @@ local servers = {
lua_ls = {
settings = {
Lua = {
runtime = {
version = "LuaJIT",
path = {
"?.lua",
"?/init.lua",
vim.fn.stdpath("data") .. "lazy/?.lua",
vim.fn.stdpath("data") .. "lazy/?/init.lua",
},
},
completion = {
callSnippet = "Replace",
keywordSnippet = "Replace",
},
diagnostics = {
globals = { "vim" },
useLocalExclude = { "_*" },
},
workspace = {
library = {
vim.api.nvim_get_runtime_file("", true),
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true,
},
maxPreload = 2000,
preloadFileSize = 50000,
checkThirdParty = false,
},
telemetry = { enable = false },
},
},
},
pyright = {
settings = {
pyright = {
disableOrganizeImports = true,
},
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "workspace",
useLibraryCodeForTypes = true,
typeCheckingMode = "basic",
},
},
},
},
ts_ls = {},
}
local ensure_installed = vim.tbl_keys(servers or {})