diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua new file mode 100644 index 0000000..e7d5894 --- /dev/null +++ b/.config/nvim/after/ftplugin/c.lua @@ -0,0 +1,7 @@ +vim.api.nvim_create_autocmd({ 'VimLeave' }, + { + command = '!cclear' + }) + +vim.o.textwidth = 80 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/after/ftplugin/java.lua b/.config/nvim/after/ftplugin/java.lua new file mode 100644 index 0000000..a3b127f --- /dev/null +++ b/.config/nvim/after/ftplugin/java.lua @@ -0,0 +1,4 @@ +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 +vim.o.textwidth = 100 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/after/ftplugin/javascript.lua b/.config/nvim/after/ftplugin/javascript.lua new file mode 100644 index 0000000..a3b127f --- /dev/null +++ b/.config/nvim/after/ftplugin/javascript.lua @@ -0,0 +1,4 @@ +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 +vim.o.textwidth = 100 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/after/ftplugin/lua.lua b/.config/nvim/after/ftplugin/lua.lua new file mode 100644 index 0000000..a3b127f --- /dev/null +++ b/.config/nvim/after/ftplugin/lua.lua @@ -0,0 +1,4 @@ +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 +vim.o.textwidth = 100 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/after/ftplugin/markdown.lua b/.config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..265c4f9 --- /dev/null +++ b/.config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,9 @@ +vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, + { + callback = function() vim.o.foldenable = false end + }) + +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 +vim.o.textwidth = 100 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/after/ftplugin/nim.lua b/.config/nvim/after/ftplugin/nim.lua new file mode 100644 index 0000000..dda63ad --- /dev/null +++ b/.config/nvim/after/ftplugin/nim.lua @@ -0,0 +1,4 @@ +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 +vim.o.textwidth = 80 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua new file mode 100644 index 0000000..dda63ad --- /dev/null +++ b/.config/nvim/after/ftplugin/python.lua @@ -0,0 +1,4 @@ +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 +vim.o.textwidth = 80 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/after/ftplugin/tex.lua b/.config/nvim/after/ftplugin/tex.lua new file mode 100644 index 0000000..8b74cda --- /dev/null +++ b/.config/nvim/after/ftplugin/tex.lua @@ -0,0 +1,9 @@ +vim.api.nvim_create_autocmd({ 'VimLeave' }, + { + command = '!texclear %' + }) + +vim.o.shiftwidth = 2 +vim.o.softtabstop = 2 +vim.o.textwidth = 80 +vim.o.colorcolumn = "-0" diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index feb1971..89f756f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -73,15 +73,28 @@ vim.o.foldenable = true vim.o.conceallevel = 0 vim.g.markdown_folding = 1 +-- read files correctly +vim.filetype.add({ + extension = { + c = 'c', + h = 'c', + html = 'html', + java = 'java', + js = 'javascript', + lua = 'lua', + md = 'markdown', + nim = 'nim', + py = 'python', + tex = 'tex', + } +}) + -- load general mapped keys require('style') -- load plugins (autoload all files in plugin folder) require('loadplugins') --- set filetypes correctly by extension -require('autocmd') - -- load general mapped keys require('keymap') diff --git a/.config/nvim/lua/autocmd.lua b/.config/nvim/lua/autocmd.lua deleted file mode 100644 index fb5069f..0000000 --- a/.config/nvim/lua/autocmd.lua +++ /dev/null @@ -1,116 +0,0 @@ --- read files correctly -vim.filetype.add({ - extension = { - c = 'c', - h = 'c', - html = 'html', - java = 'java', - js = 'javascript', - lua = 'lua', - md = 'markdown', - nim = 'nim', - py = 'python', - tex = 'tex', - } -}) - - --- settings for filetype: c - -vim.api.nvim_create_autocmd({ 'VimLeave' }, - { - pattern = { '*.c' }, - command = '!cclear' - }) - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'c' }, - command = 'set colorcolumn=80' - }) - --- settings for filetype: java - -vim.api.nvim_create_autocmd({ 'FileType' }, - { - pattern = { 'java' }, - command = 'setlocal shiftwidth=2 softtabstop=2', - }) - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'java' }, - command = 'set colorcolumn=100' - }) - --- settings for filetype: javascript - -vim.api.nvim_create_autocmd({ 'FileType' }, - { - pattern = { 'javascript' }, - command = 'setlocal shiftwidth=2 softtabstop=2', - }) - --- settings for filetype: lua - -vim.api.nvim_create_autocmd({ 'FileType' }, - { - pattern = { 'lua' }, - command = 'setlocal shiftwidth=2 softtabstop=2', - }) - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'lua' }, - command = 'set colorcolumn=100' - }) - --- settings for filetype: markdown - -vim.api.nvim_create_autocmd({ 'FileType' }, - { - pattern = { 'markdown' }, - command = 'setlocal shiftwidth=2 softtabstop=2', - }) - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'markdown' }, - command = 'set colorcolumn=100' - }) - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'markdown' }, - command = 'set nofoldenable' - }) - --- settings for filetype: nim - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'nim' }, - command = 'set colorcolumn=80' - }) - --- settings for filetype: python - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'python' }, - command = 'set colorcolumn=80' - }) - --- settings for filetype: tex - -vim.api.nvim_create_autocmd({ 'VimLeave' }, - { - pattern = { '*.tex' }, - command = '!texclear %' - }) - -vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { 'tex' }, - command = 'set colorcolumn=80' - })