From f58dbe9264043ff8f1d6e31784387a8ea6e62983 Mon Sep 17 00:00:00 2001 From: randomuser Date: Sun, 2 Apr 2023 12:47:07 -0500 Subject: [PATCH] factor out tabbing thing --- nvim/init.lua | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 6c3132c..2af1d53 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -83,14 +83,28 @@ vim.api.nvim_create_autocmd({"BufWrite"}, { }) -- autocmds for python -vim.api.nvim_create_autocmd({"Filetype"}, { - pattern = {"python"}, - callback = function() - vim.bo.expandtab = true - vim.bo.tabstop = 4 - vim.bo.shiftwidth = 4 - end -}) +-- vim.api.nvim_create_autocmd({"Filetype"}, { +-- pattern = {"python"}, +-- callback = function() +-- vim.bo.expandtab = true +-- vim.bo.tabstop = 4 +-- vim.bo.shiftwidth = 4 +-- end +-- }) + +function setTabbing(lang, width) + vim.api.nvim_create_autocmd({"Filetype"}, { + pattern = {lang}, + callback = function() + vim.bo.expandtab = true + vim.bo.tabstop = width + vim.bo.shiftwidth = width + end + }) +end + +setTabbing("python", 4) +setTabbing("javascript", 2) -- }}} -- vim options {{{