From e1f72640b039fcaaa0e0f44caa2edb7ff1bc42f8 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 18 May 2022 15:08:34 +0200 Subject: Updated nvim auto commands with lua callbacks instead of vimscript, Updated vim-argwrap to leave space in lua and go --- config/nvim/init.lua | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'config/nvim/init.lua') diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 4e050a9..faa3cf4 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -69,7 +69,11 @@ vim.api.nvim_create_autocmd( -- set filttype for *.sql.j2 files vim.api.nvim_create_autocmd( "BufReadPre", - { pattern = "*.sql.j2", command = "set ft=sql", group = augroup } + { + pattern = "*.sql.j2", + callback = function() vim.opt.filetype = "sql" end, + group = augroup, + } ) -- -- Format go files on save @@ -80,11 +84,29 @@ vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd( "FileType", - { pattern = "haskell", command = [[ set formatprg=stylish-haskell ]], group = augroup } + { + pattern = "haskell", + callback = function() vim.opt_local.formatprg = "stylish-haskell" end, + group = augroup, + } ) + vim.api.nvim_create_autocmd( "FileType", - { pattern = "lisp,html,css,htmldjango", command = [[ setlocal shiftwidth=2 ]], group = augroup } + { + pattern = "lisp,html,css,htmldjango", + callback = function() vim.opt_local.shiftwidth = 2 end, + group = augroup, + } +) + +vim.api.nvim_create_autocmd( + "FileType", + { + pattern = "go", + callback = function() vim.opt_local.expandtab = false end, + group = augroup, + } ) require("mappings") -- cgit