aboutsummaryrefslogtreecommitdiff
path: root/lua/filetype_handing.lua
diff options
context:
space:
mode:
authornathan11 <thenathansmithsmith@gmail.com>2023-07-25 00:52:07 -0600
committernathan11 <thenathansmithsmith@gmail.com>2023-07-25 00:52:07 -0600
commit0f8c62f2d18fd86e2bad01a33e5e9beb4e2ef77b (patch)
treee098cecfe770af08bd77eda320f8a0260c3c68c6 /lua/filetype_handing.lua
first commit
Diffstat (limited to 'lua/filetype_handing.lua')
-rw-r--r--lua/filetype_handing.lua57
1 files changed, 57 insertions, 0 deletions
diff --git a/lua/filetype_handing.lua b/lua/filetype_handing.lua
new file mode 100644
index 0000000..3cf00ca
--- /dev/null
+++ b/lua/filetype_handing.lua
@@ -0,0 +1,57 @@
+local autocmd = vim.api.nvim_create_autocmd
+
+-- Filetypes.
+vim.cmd("filetype on")
+vim.cmd("filetype plugin on")
+vim.cmd("filetype indent on")
+
+-- Python.
+autocmd("Filetype",
+{pattern="python", command="set nocindent tabstop=4 shiftwidth=4 expandtab softtabstop=4"
+})
+
+-- Text files.
+autocmd("Filetype",
+{pattern="*.txt", command="set formatoptions+=t textwidth=72 nocindent noexpandtab shiftwidth=8 tabstop=8 softtabstop=8"
+})
+
+-- C and c++.
+autocmd("Filetype",
+{pattern={"c", "cpp", "slang"},
+command="set cindent tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab"
+})
+
+-- Only c.
+autocmd("Filetype",
+{pattern="c", command="set formatoptions+=ro"
+})
+
+-- Assembly.
+autocmd("Filetype",
+{pattern="asm", command="set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab"
+})
+
+-- Lua.
+autocmd("Filetype",
+{pattern="lua", command="set cindent tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab"
+})
+
+-- css.
+autocmd("Filetype",
+{pattern="css", command="set smartindent"
+})
+
+-- html.
+autocmd("Filetype",
+{pattern="html", command="set formatoptions+=tl"
+})
+
+-- html and css.
+autocmd("Filetype",
+{pattern={"html", "css"}, command="set noexpandtab tabstop=2"
+})
+
+-- Make files.
+autocmd("Filetype",
+{pattern="make", command="set nocindent noexpandtab shiftwidth=8 tabstop=8 softtabstop=8"
+})