This commit is contained in:
2026-02-08 13:34:54 +05:30
parent df68895da5
commit 92ba53888e
9 changed files with 171 additions and 145 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,2 @@
lua/
pack/ pack/
test/ test/

View File

@@ -16,10 +16,16 @@
- I will not seperately complement about the dependecy plugins of these pluginsn as I do not have a direct interactions with them. - I will not seperately complement about the dependecy plugins of these pluginsn as I do not have a direct interactions with them.
- But I believe that as they are a hard dependency so they must be doing something very vital for them. - But I believe that as they are a hard dependency so they must be doing something very vital for them.
## nvim-tree ## nvim-tree.lua
- url: https://github.com/nvim-tree/nvim-tree.lua - url: https://github.com/nvim-tree/nvim-tree.lua
- This has been a very useful addition to my whole plugin ecosysystem.
- I use a floating nvim-tree, this helps me in saving space from having a permananent setting.
## telescope
# Directory Structure # Directory Structure
``` ```
@@ -34,6 +40,7 @@
│   ├── mini.icons │   ├── mini.icons
│   ├── nvim-cmp │   ├── nvim-cmp
│   ├── nvim-lspconfig │   ├── nvim-lspconfig
│   ├── nvim-tree.lua
│   ├── plenary.nvim │   ├── plenary.nvim
│   └── telescope.nvim │   └── telescope.nvim
└── test └── test

177
init.lua
View File

@@ -7,6 +7,8 @@ vim.opt.shiftwidth = 2 -- Indent width
vim.opt.expandtab = true -- Use spaces instead of tabs vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.wrap = true vim.opt.wrap = true
--vim.cmd.colorscheme("retrobox")
vim.opt.termguicolors = true
vim.opt.clipboard = 'unnamedplus' -- System clipboard vim.opt.clipboard = 'unnamedplus' -- System clipboard
@@ -16,149 +18,6 @@ vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
vim.api.nvim_set_hl(0, "EndOfBuffer", { bg = "none" }) vim.api.nvim_set_hl(0, "EndOfBuffer", { bg = "none" })
require("nvim-tree").setup({
view = {
float = {
enable = true,
open_win_config = function()
local screen_w = vim.opt.columns:get()
local screen_h = vim.opt.lines:get()
local window_w = math.floor(screen_w * 0.6)
local window_h = math.floor(screen_h * 0.7)
local center_x = math.floor((screen_w - window_w) / 2)
local center_y = math.floor((screen_h - window_h) / 2)
return {
border = "rounded",
relative = "editor",
row = center_y,
col = center_x,
width = window_w,
height = window_h,
}
end,
},
width = 30,
},
actions = {
open_file = {
quit_on_open = true, -- closes tree when opening a file
},
},
renderer = {
highlight_git = true,
icons = {
show = {
git = true,
folder = true,
file = true,
folder_arrow = true,
},
},
},
})
-- require("nvim-tree").setup({
-- view = {
-- side = "left",
-- This is the key setting for sharing across tabs
-- },
-- actions = {
-- open_file = {
-- quit_on_open = false,
-- Prevent nvim-tree from closing when opening a file
-- },
-- },
-- hijack_directories = {
-- enable = false,
-- },
-- sync_root_with_cwd = true,
-- respect_buf_cwd = true,
-- update_focused_file = {
-- enable = true,
-- update_root = false,
-- },
-- })
vim.diagnostic.config({
severity_sort = true,
virtual_text = true,
})
local cmp = require('cmp')
cmp.setup({
sources = {
{ name = 'nvim_lsp' },
},
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
})
require('lspconfig').pyright.setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})
require('lspconfig').lua_ls.setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})
require('lspconfig').rust_analyzer.setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})
--Enable (broadcasting) snippet capability for completion
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.html.setup {
capabilities = capabilities,
}
require('lspconfig').gopls.setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
settings = {
gopls = {
analyses = {
unusedparams = true,
nilness = true,
unusedwrite = true,
useany = true,
},
staticcheck = true,
gofumpt = true,
},
},
})
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration)
vim.keymap.set("n", "gr", vim.lsp.buf.references)
vim.keymap.set("n", "K", vim.lsp.buf.hover)
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
-- Git signs -- Git signs
require('gitsigns').setup() require('gitsigns').setup()
@@ -167,3 +26,35 @@ require('flash').setup()
vim.keymap.set({"n","x","o"}, "s", function() vim.keymap.set({"n","x","o"}, "s", function()
require("flash").jump() require("flash").jump()
end) end)
require("nvim-treesitter").setup({
ensure_installed = {
"lua",
"python",
"c",
"cpp",
"go",
"bash",
"json",
"yaml",
"html",
"css",
"javascript",
"markdown",
"markdown_inline"
},
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
indent = {
enable = true,
},
})
require("rakshit")

2
lua/rakshit/init.lua Normal file
View File

@@ -0,0 +1,2 @@
require("rakshit.plugins")
require("rakshit.lsp")

1
lua/rakshit/lsp/init.lua Normal file
View File

@@ -0,0 +1 @@
require("rakshit.lsp.main")

74
lua/rakshit/lsp/main.lua Normal file
View File

@@ -0,0 +1,74 @@
-- diagnostics
vim.diagnostic.config({
severity_sort = true,
virtual_text = true,
})
-- cmp setup
local cmp = require('cmp')
cmp.setup({
sources = {
{ name = 'nvim_lsp' },
},
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
})
-- shared capabilities (cmp + snippet support)
local capabilities = require('cmp_nvim_lsp').default_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- shared keymaps when LSP attaches
local on_attach = function(_, bufnr)
local map = function(mode, lhs, rhs)
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr })
end
map("n", "gd", vim.lsp.buf.definition)
map("n", "gD", vim.lsp.buf.declaration)
map("n", "gr", vim.lsp.buf.references)
map("n", "K", vim.lsp.buf.hover)
end
-- helper to setup servers
local lspconfig = require('lspconfig')
local function setup(server, opts)
opts = opts or {}
opts.capabilities = capabilities
opts.on_attach = on_attach
lspconfig[server].setup(opts)
end
-- servers
setup("pyright")
setup("rust_analyzer")
setup("lua_ls", {
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
})
setup("html")
setup("gopls", {
settings = {
gopls = {
analyses = {
unusedparams = true,
nilness = true,
unusedwrite = true,
useany = true,
},
staticcheck = true,
gofumpt = true,
},
},
})

View File

@@ -0,0 +1,5 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })

View File

@@ -0,0 +1,45 @@
require("nvim-tree").setup({
view = {
float = {
enable = true,
open_win_config = function()
local screen_w = vim.opt.columns:get()
local screen_h = vim.opt.lines:get()
local window_w = math.floor(screen_w * 0.6)
local window_h = math.floor(screen_h * 0.7)
local center_x = math.floor((screen_w - window_w) / 2)
local center_y = math.floor((screen_h - window_h) / 2)
return {
border = "rounded",
relative = "editor",
row = center_y,
col = center_x,
width = window_w,
height = window_h,
}
end,
},
width = 30,
},
actions = {
open_file = {
quit_on_open = true, -- closes tree when opening a file
},
},
renderer = {
highlight_git = true,
icons = {
show = {
git = true,
folder = true,
file = true,
folder_arrow = true,
},
},
},
})

View File

@@ -0,0 +1,2 @@
require("rakshit.plugins.filemanager")
require("rakshit.plugins.filefinder")