From 87ca18d78e837c12f528825f9f601a6cb27549b4 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 7 Jul 2021 12:03:48 -0500 Subject: [PATCH] Fix gitcommit starting in insert mode --- common/neovim/lua/keymap.lua | 2 +- common/neovim/lua/options.lua | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/common/neovim/lua/keymap.lua b/common/neovim/lua/keymap.lua index a318497..7db7ec9 100644 --- a/common/neovim/lua/keymap.lua +++ b/common/neovim/lua/keymap.lua @@ -13,7 +13,6 @@ local keymap = { ['h'] = {':b#', m.s}, ['k'] = {':bnext', m.s}, ['j'] = {':bprevious', m.s}, - ['m'] = {':lua print()', m.s}, ['/'] = {':let @/ = "":', m.s}, [''] = ':qa', [''] = 'Telescope git_files', @@ -26,6 +25,7 @@ local keymap = { [''] = ':TmuxNavigateRight', [' n'] = "'Nn'[v:searchforward]", [' N'] = "'nN'[v:searchforward]", + [''] = ':lua SynGroup()' }, t = {}, [''] = { diff --git a/common/neovim/lua/options.lua b/common/neovim/lua/options.lua index 2d58930..4c82096 100644 --- a/common/neovim/lua/options.lua +++ b/common/neovim/lua/options.lua @@ -67,21 +67,13 @@ end vim.api.nvim_command'colorscheme donokai' -vim.api.nvim_command[[ -function! SynGroup() - let l:s = synID(line('.'), col('.'), 1) - echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name') -endfun -nnoremap :call SynGroup() -]] +function SynGroup() + local s = vim.fn.synID(vim.fn.line('.'), vim.fn.col('.'), 1) + print(vim.fn.synIDattr(s, 'name') .. ' -> ' .. vim.fn.synIDattr(vim.fn.synIDtrans(s), 'name')) +end vim.api.nvim_command[[ + au! FileType gitcommit exec 'norm gg' | startinsert! + au! BufNewFile,BufRead *.slimleex set syntax=slim command! W write - command! X writequit - augroup gitcommit - au! VimEnter COMMIT_EDITMSG exec 'norm gg' | startinsert! - augroup END - augroup slime - au! BufNewFile,BufRead *.slimleex set syntax=slim - augroup END ]]