Skip to content

Instantly share code, notes, and snippets.

@k3karthic
Last active February 12, 2026 23:38
Show Gist options
  • Select an option

  • Save k3karthic/98d9b73090b4cdb44e6a9ae84318219f to your computer and use it in GitHub Desktop.

Select an option

Save k3karthic/98d9b73090b4cdb44e6a9ae84318219f to your computer and use it in GitHub Desktop.
Rudimentary Vim Config
syntax on
set number
set autoindent
set tabstop=4
set shiftwidth=4
" YAML - 2 space indent, no tabs
autocmd FileType yaml setlocal tabstop=2 shiftwidth=2 expandtab
" Lua - 2 space indent, no tabs
autocmd FileType lua setlocal tabstop=2 shiftwidth=2 expandtab
" Python - 4 space indent, no tabs
autocmd FileType python setlocal tabstop=4 shiftwidth=4 expandtab
-- Basic settings
vim.opt.syntax = 'on'
vim.opt.number = true
vim.opt.autoindent = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
-- YAML - 2 space indent, no tabs
vim.api.nvim_create_autocmd('FileType', {
pattern = 'yaml',
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.expandtab = true
end,
})
-- Lua - 2 space indent, no tabs
vim.api.nvim_create_autocmd('FileType', {
pattern = 'lua',
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.expandtab = true
end,
})
-- Python - 4 space indent, no tabs
vim.api.nvim_create_autocmd('FileType', {
pattern = 'python',
callback = function()
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
vim.opt_local.expandtab = true
end,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment