diff options
| author | Brahmajit Das <listout@listout.xyz> | 2026-02-13 02:16:40 +0000 |
|---|---|---|
| committer | Brahmajit Das <listout@listout.xyz> | 2026-02-13 02:16:40 +0000 |
| commit | f1b3356689003abe9edb5a46d4a091b0a41d7306 (patch) | |
| tree | 3f94c38ddf7559f088c581b3270f62f99484477e | |
| parent | 7e35baacfdeeb7f834fa37841c9d3a2189a976d0 (diff) | |
| download | nvim-f1b3356689003abe9edb5a46d4a091b0a41d7306.tar.gz | |
moving vimscript configs to lua config
Signed-off-by: Brahmajit Das <listout@listout.xyz>
| -rw-r--r-- | after/ftplugin/mail.lua | 20 | ||||
| -rw-r--r-- | after/ftplugin/mail.vim | 5 | ||||
| -rw-r--r-- | after/ftplugin/markdown.lua | 32 | ||||
| -rw-r--r-- | after/ftplugin/markdown.vim | 22 | ||||
| -rw-r--r-- | filetype.lua | 20 | ||||
| -rw-r--r-- | lua/utils.lua | 17 | ||||
| -rw-r--r-- | plugin/filetypes.lua | 28 |
7 files changed, 72 insertions, 72 deletions
diff --git a/after/ftplugin/mail.lua b/after/ftplugin/mail.lua new file mode 100644 index 0000000..aa09b50 --- /dev/null +++ b/after/ftplugin/mail.lua @@ -0,0 +1,20 @@ +-- Detect mutt temporary files as mail +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { "/tmp/mutt-*", "/tmp/neomutt-*" }, + callback = function() + vim.bo.filetype = "mail" + end, +}) + +-- Set options for mutt temp files in /tmp +vim.api.nvim_create_autocmd("BufRead", { + pattern = { "/tmp/mutt-*", "/tmp/neomutt-*" }, + callback = function() + vim.opt_local.textwidth = 72 + end, +}) + +-- Mail ftplugin settings +vim.opt_local.textwidth = 72 +vim.opt_local.colorcolumn = "72" +vim.opt_local.spell = true diff --git a/after/ftplugin/mail.vim b/after/ftplugin/mail.vim deleted file mode 100644 index 1f7f8bd..0000000 --- a/after/ftplugin/mail.vim +++ /dev/null @@ -1,5 +0,0 @@ -autocmd BufRead,BufNewFile *mutt-* setfiletype mail -au BufRead /tmp/*mutt-* set tw=72 -set textwidth=72 -set colorcolumn=72 -set spell diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 0000000..f63e1ce --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,32 @@ +-- Table mode (buffer-local where appropriate) +vim.b.table_mode_corner = "|" +vim.b.table_mode_corner_corner = "|" +vim.b.table_mode_header_fillchar = "-" +vim.g.table_mode_align_char = ":" + +-- vim-markdown settings (globals expected by the plugin) +vim.g.vim_markdown_folding_disabled = 1 +vim.g.vim_markdown_conceal = 0 +vim.g.vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'" + +-- Spell + wrapping +vim.opt_local.spell = true +vim.opt_local.spelllang = { "en_us" } +vim.opt_local.textwidth = 72 +vim.opt_local.colorcolumn = "72" + +-- Do not highlight concealed text +vim.api.nvim_set_hl(0, "Conceal", { + ctermbg = "NONE", + ctermfg = "NONE", + bg = "NONE", + fg = "NONE", +}) + +-- Make `gf` create new files if not exists (buffer-local mapping) +vim.keymap.set("n", "gf", function() + vim.cmd.edit(vim.fn.expand("<cfile>")) +end, { buffer = true, silent = true }) + +-- Ignore Javadoc in Java (global) +vim.g.java_ignore_javadoc = 1 diff --git a/after/ftplugin/markdown.vim b/after/ftplugin/markdown.vim deleted file mode 100644 index 1306802..0000000 --- a/after/ftplugin/markdown.vim +++ /dev/null @@ -1,22 +0,0 @@ -" Table mode -let b:table_mode_corner='|' -let b:table_mode_corner_corner='|' -let b:table_mode_header_fillchar='-' -let g:table_mode_align_char=':' - -let g:vim_markdown_folding_disabled=1 -let g:vim_markdown_conceal=0 -let g:vim_markdown_anchorexpr="'<<'.v:anchor.'>>'" - -" Spell checking -set spell spelllang=en_us -set textwidth=72 -set colorcolumn=72 - -" Does not highlight conceal -highlight Conceal ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE - -" Make `gf` create new files if not exists -map gf :e <cfile><CR> - -let java_ignore_javadoc=1 diff --git a/filetype.lua b/filetype.lua new file mode 100644 index 0000000..5ec6e1d --- /dev/null +++ b/filetype.lua @@ -0,0 +1,20 @@ +-- +-- Mainly filetype settings +-- + +local cmd = vim.cmd + +-- Autoremove unwanted whitespaces +cmd [[ + au BufRead,BufNewFile *mutt-* setfiletype mail +]] + +vim.filetype.add { + extension = { + h = "c", + scheme = "scheme", + }, +} + +-- Add in the following like to auto remove empty lines +-- au BufWritePre * %s/\s\+$//e diff --git a/lua/utils.lua b/lua/utils.lua deleted file mode 100644 index 7c8a7bf..0000000 --- a/lua/utils.lua +++ /dev/null @@ -1,17 +0,0 @@ --- --- Auto group utilites --- - -local M = {} -local cmd = vim.cmd - -function M.create_augroup(autocmds, name) - cmd('augroup ' .. name) - cmd('autocmd!') - for _, autocmd in ipairs(autocmds) do - cmd('autocmd ' .. table.concat(autocmd, ' ')) - end - cmd('augroup END') -end - -return M diff --git a/plugin/filetypes.lua b/plugin/filetypes.lua deleted file mode 100644 index 438eeae..0000000 --- a/plugin/filetypes.lua +++ /dev/null @@ -1,28 +0,0 @@ --- --- Mainly filetype settings --- - -local cmd = vim.cmd -local u = require('utils') - -u.create_augroup({ - { 'BufRead,BufNewFile', '/tmp/nail-*', 'setlocal', 'ft=mail' }, - { 'BufRead,BufNewFile', '*s-nail-*', 'setlocal', 'ft=mail' }, - { 'BufRead,BufNewFile', '*mutt-*', 'setlocal', 'ft=mail' }, - { 'BufRead', '/tmp/*mutt-*', 'setlocal', 'tw=72' }, -}, 'ftmail') - --- Autoremove unwanted whitespaces -cmd [[ - au BufRead,BufNewFile *mutt-* setfiletype mail -]] - -vim.filetype.add { - extension = { - h = "c", - scheme = "scheme", - }, -} - --- Add in the following like to auto remove empty lines --- au BufWritePre * %s/\s\+$//e |
