From 0f8c62f2d18fd86e2bad01a33e5e9beb4e2ef77b Mon Sep 17 00:00:00 2001 From: nathan11 Date: Tue, 25 Jul 2023 00:52:07 -0600 Subject: first commit --- lua/filetype_handing.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lua/filetype_handing.lua (limited to 'lua/filetype_handing.lua') 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" +}) -- cgit v1.2.3