style: enforce consistent quote style and add netrw settings

This commit is contained in:
sankalp committed 2025-09-29 12:56:48 +05:45
1 parent e2ac7d5455
commit 3055e5d3b9
5 files changed
+111 -105

No files matched your search

+5 -5
View File
@@ -1,7 +1,7 @@
-- load config -- load config
require("core.options") require('core.options')
require("core.functions") require('core.functions')
require("core.keys") require('core.keys')
require('core.autocmd') require('core.autocmd')
require("core.lsp") require('core.lsp')
require("core.lazy") require('core.lazy')
+1
View File
@@ -7,6 +7,7 @@
"conform.nvim": { "branch": "master", "commit": "3bad87250ed85246fe8c5bc10005ab5a6289ae4c" }, "conform.nvim": { "branch": "master", "commit": "3bad87250ed85246fe8c5bc10005ab5a6289ae4c" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "23ae90a2a52fdc9b8c50dc61d6c30ebb18521343" }, "gitsigns.nvim": { "branch": "main", "commit": "23ae90a2a52fdc9b8c50dc61d6c30ebb18521343" },
"grug-far.nvim": { "branch": "main", "commit": "50d9ee2b5a19634670441948e7e4afaa042f1059" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
+90 -90
View File
@@ -1,129 +1,129 @@
local function augroup(name) local function augroup(name)
return vim.api.nvim_create_augroup("nvim" .. name, { clear = true }) return vim.api.nvim_create_augroup('nvim' .. name, { clear = true })
end end
-- Strip trailing spaces before write -- Strip trailing spaces before write
vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup("strip_space"), group = augroup('strip_space'),
pattern = { "*" }, pattern = { '*' },
callback = function() callback = function()
vim.cmd([[ %s/\s\+$//e ]]) vim.cmd([[ %s/\s\+$//e ]])
end, end,
}) })
-- Check if we need to reload the file when it changed -- Check if we need to reload the file when it changed
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, {
group = augroup("checktime"), group = augroup('checktime'),
command = "checktime", command = 'checktime',
}) })
-- Highlight on yank -- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", { vim.api.nvim_create_autocmd('TextYankPost', {
group = augroup("highlight_yank"), group = augroup('highlight_yank'),
callback = function() callback = function()
vim.highlight.on_yank() vim.highlight.on_yank()
end, end,
}) })
-- resize splits if window got resized -- resize splits if window got resized
vim.api.nvim_create_autocmd({ "VimResized" }, { vim.api.nvim_create_autocmd({ 'VimResized' }, {
group = augroup("resize_splits"), group = augroup('resize_splits'),
callback = function() callback = function()
vim.cmd("tabdo wincmd =") vim.cmd('tabdo wincmd =')
end, end,
}) })
-- go to last loc when opening a buffer -- go to last loc when opening a buffer
vim.api.nvim_create_autocmd("BufReadPost", { vim.api.nvim_create_autocmd('BufReadPost', {
group = augroup("last_loc"), group = augroup('last_loc'),
callback = function() callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"') local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0) local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark) pcall(vim.api.nvim_win_set_cursor, 0, mark)
end end
end, end,
}) })
-- close some filetypes with <q> -- close some filetypes with <q>
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd('FileType', {
group = augroup("close_with_q"), group = augroup('close_with_q'),
pattern = { pattern = {
"Jaq", 'Jaq',
"PlenaryTestPopup", 'PlenaryTestPopup',
"Avante", 'Avante',
"AvanteInput", 'AvanteInput',
"AvanteSelectedFiles", 'AvanteSelectedFiles',
"fugitive", 'fugitive',
"git", 'git',
"help", 'help',
"lir", 'lir',
"lspinfo", 'lspinfo',
"man", 'man',
"netrw", 'netrw',
"notify", 'notify',
"qf", 'qf',
"spectre_panel", 'spectre_panel',
"startuptime", 'startuptime',
"tsplayground", 'tsplayground',
}, },
callback = function(event) callback = function(event)
vim.bo[event.buf].buflisted = false vim.bo[event.buf].buflisted = false
vim.keymap.set("n", "q", "<cmd>close<cr>", { buffer = event.buf, silent = true }) vim.keymap.set('n', 'q', '<cmd>close<cr>', { buffer = event.buf, silent = true })
end, end,
}) })
-- wrap and check for spell in text filetypes -- wrap and check for spell in text filetypes
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd('FileType', {
group = augroup("wrap_spell"), group = augroup('wrap_spell'),
pattern = { "gitcommit", "markdown" }, pattern = { 'gitcommit', 'markdown' },
callback = function() callback = function()
vim.opt_local.wrap = true vim.opt_local.wrap = true
vim.opt_local.spell = true vim.opt_local.spell = true
end, end,
}) })
-- Auto create dir when saving a file, in case some intermediate directory does not exist -- Auto create dir when saving a file, in case some intermediate directory does not exist
vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup("auto_create_dir"), group = augroup('auto_create_dir'),
callback = function(event) callback = function(event)
local file = vim.loop.fs_realpath(event.match) or event.match local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p") vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p')
end, end,
}) })
-- Set arb filetype -- Set arb filetype
vim.api.nvim_create_autocmd({ "BufEnter" }, { vim.api.nvim_create_autocmd({ 'BufEnter' }, {
group = augroup("set_file_type"), group = augroup('set_file_type'),
pattern = { "*.arb" }, pattern = { '*.arb' },
command = "setfiletype arb", command = 'setfiletype arb',
}) })
-- Disable format options -- Disable format options
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd('FileType', {
group = augroup("disable_formatoptions"), group = augroup('disable_formatoptions'),
pattern = "*", pattern = '*',
callback = function() callback = function()
vim.opt_local.formatoptions:remove({ "c", "r", "o" }) vim.opt_local.formatoptions:remove({ 'c', 'r', 'o' })
end, end,
}) })
local function enable_autoformat() local function enable_autoformat()
vim.api.nvim_create_autocmd({ "BufWritePre" }, { vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
group = augroup("autoformat"), group = augroup('autoformat'),
pattern = { "*" }, pattern = { '*' },
callback = function() callback = function()
vim.lsp.buf.format() vim.lsp.buf.format()
end, end,
}) })
end end
enable_autoformat() enable_autoformat()
vim.api.nvim_create_user_command("WriteNoFormat", function() vim.api.nvim_create_user_command('WriteNoFormat', function()
-- Temporarily disable the autoformat autocmd -- Temporarily disable the autoformat autocmd
vim.api.nvim_del_augroup_by_name("keycodex_autoformat") vim.api.nvim_del_augroup_by_name('keycodex_autoformat')
vim.cmd("write") vim.cmd('write')
-- Re-enable the autoformat autocmd -- Re-enable the autoformat autocmd
enable_autoformat() enable_autoformat()
end, {}) end, {})
+5
View File
@@ -60,6 +60,11 @@ for k, v in pairs(options) do
vim.opt[k] = v vim.opt[k] = v
end end
-- netrw file explorer settings
vim.g.netrw_winsize = 20
vim.g.netrw_banner = 0
vim.g.netrw_liststyle = 1
vim.opt.path:append({ '**' }) vim.opt.path:append({ '**' })
vim.opt.shortmess:append({ W = true, I = true, c = true }) -- disable greeting vim.opt.shortmess:append({ W = true, I = true, c = true }) -- disable greeting
+10 -10
View File
@@ -86,7 +86,7 @@ return {
shell = vim.o.shell, shell = vim.o.shell,
float_opts = { float_opts = {
border = 'curved', -- 'single', 'double', 'shadow', etc. border = 'curved', -- 'single', 'double', 'shadow', etc.
winblend = 0, -- Set to 0 for full transparency winblend = 0, -- Set to 0 for full transparency
highlights = { highlights = {
border = 'Normal', border = 'Normal',
background = 'Normal', background = 'Normal',
@@ -117,16 +117,16 @@ return {
picker_integration = true, picker_integration = true,
keymaps = { keymaps = {
prefix = '<leader>u', -- Main prefix for uv commands prefix = '<leader>u', -- Main prefix for uv commands
commands = true, -- Show uv commands menu (<leader>x) commands = true, -- Show uv commands menu (<leader>x)
run_file = true, -- Run current file (<leader>xr) run_file = true, -- Run current file (<leader>xr)
run_selection = true, -- Run selected code (<leader>xs) run_selection = true, -- Run selected code (<leader>xs)
run_function = true, -- Run function (<leader>xf) run_function = true, -- Run function (<leader>xf)
venv = true, -- Environment management (<leader>xe) venv = true, -- Environment management (<leader>xe)
init = true, -- Initialize uv project (<leader>xi) init = true, -- Initialize uv project (<leader>xi)
add = true, -- Add a package (<leader>xa) add = true, -- Add a package (<leader>xa)
remove = true, -- Remove a package (<leader>xd) remove = true, -- Remove a package (<leader>xd)
sync = true, -- Sync packages (<leader>xc) sync = true, -- Sync packages (<leader>xc)
sync_all = true, -- Sync all packages, extras and groups (<leader>xC) sync_all = true, -- Sync all packages, extras and groups (<leader>xC)
}, },
}, },
}, },