deprication, hide dot files and undotree

This commit is contained in:
2026-04-02 06:08:25 +05:30
parent 0c06be6f22
commit 80b614a0f3
4 changed files with 45 additions and 37 deletions

View File

@@ -7,7 +7,7 @@ vim.opt.shiftwidth = 2 -- Indent width
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.wrap = true
--vim.cmd.colorscheme("retrobox")
vim.cmd.colorscheme("retrobox")
vim.opt.termguicolors = true
vim.opt.clipboard = 'unnamedplus' -- System clipboard
@@ -59,13 +59,5 @@ require("nvim-treesitter").setup({
require("rakshit")
function _G.my_statusline()
local w = vim.api.nvim_win_get_width(0)
if w > 140 then
return "%F %y %m %= %l:%c %p%%"
else
return "%f %= %l:%c"
end
end
vim.o.statusline = "%!v:lua.my_statusline()"
vim.cmd("packadd nvim.undotree")
vim.keymap.set("n", "<leader>u", require("undotree").open)

View File

@@ -21,32 +21,29 @@ 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
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local map = function(mode, lhs, rhs)
vim.keymap.set(mode, lhs, rhs, { buffer = args.buf })
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
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')
-- shared config applied to all servers
vim.lsp.config('*', {
capabilities = capabilities,
})
local function setup(server, opts)
opts = opts or {}
opts.capabilities = capabilities
opts.on_attach = on_attach
lspconfig[server].setup(opts)
end
-- per-server config
vim.lsp.config('pyright', {})
vim.lsp.config('rust_analyzer', {})
-- servers
setup("pyright")
setup("rust_analyzer")
setup("lua_ls", {
vim.lsp.config('lua_ls', {
settings = {
Lua = {
diagnostics = {
@@ -56,9 +53,9 @@ setup("lua_ls", {
}
})
setup("html")
vim.lsp.config('html', {})
setup("gopls", {
vim.lsp.config('gopls', {
settings = {
gopls = {
analyses = {
@@ -73,6 +70,9 @@ setup("gopls", {
},
})
setup("clangd", {
cmd = { "clangd", "--background-index", "--query-driver=/usr/bin/gcc,/usr/bin/g++",},
vim.lsp.config('clangd', {
cmd = { "clangd", "--background-index", "--query-driver=/usr/bin/gcc,/usr/bin/g++"},
})
-- enable all configured servers
vim.lsp.enable({ 'pyright', 'rust_analyzer', 'lua_ls', 'html', 'gopls', 'clangd' })

View File

@@ -42,4 +42,8 @@ require("nvim-tree").setup({
},
},
},
filters = {
dotfiles = true,
},
})

View File

@@ -0,0 +1,12 @@
function _G.my_statusline()
local w = vim.api.nvim_win_get_width(0)
if w > 140 then
return "%F %y %m %= %l:%c %p%%"
else
return "%f %= %l:%c"
end
end
vim.o.statusline = "%!v:lua.my_statusline()"