aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2021-08-05 01:56:13 +0800
committerjdhao <jdhao@hotmail.com>2021-08-05 01:57:35 +0800
commitc4d050e99da5a10ebe83e9229dcbd2b21758f54d (patch)
treea9b6c65ef3d1ba494976febbe4e08d90a0c51176 /core
parent4d3c038cb500de307eb95e6b7c1ec21f075323c7 (diff)
Use nvim-notify for showing messages
Diffstat (limited to 'core')
-rw-r--r--core/autocommands.vim5
-rw-r--r--core/mappings.vim2
-rw-r--r--core/ui.vim2
3 files changed, 5 insertions, 4 deletions
diff --git a/core/autocommands.vim b/core/autocommands.vim
index 64b86f8..1cc207a 100644
--- a/core/autocommands.vim
+++ b/core/autocommands.vim
@@ -32,7 +32,8 @@ augroup END
" https://github.com/vim/vim/issues/4379
augroup non_utf8_file_warn
autocmd!
- autocmd BufRead * if &fileencoding != 'utf-8' | unsilent echomsg 'File not in UTF-8 format!' | endif
+ " we can not `lua vim.notify()`: it will error out E5107 parsing lua.
+ autocmd BufRead * if &fileencoding != 'utf-8' | call v:lua.vim.notify('File not in UTF-8 format!', 'warn', {'title': 'nvim-config'}) | endif
augroup END
" Automatically reload the file if it is changed outside of Nvim, see
@@ -42,7 +43,7 @@ augroup END
" https://vi.stackexchange.com/a/20397/15292.
augroup auto_read
autocmd!
- autocmd FileChangedShellPost * call utils#Log("File changed on disk. Buffer reloaded!", 'warning')
+ autocmd FileChangedShellPost * call v:lua.vim.notify("File changed on disk. Buffer reloaded!", 'warn', {'title': 'nvim-config'})
autocmd FocusGained,CursorHold * if getcmdwintype() == '' | checktime | endif
augroup END
diff --git a/core/mappings.vim b/core/mappings.vim
index a7712df..19e6a10 100644
--- a/core/mappings.vim
+++ b/core/mappings.vim
@@ -102,7 +102,7 @@ inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
" Edit and reload init.vim quickly
nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr>
nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar>
- \ echomsg "Nvim config successfully reloaded!"<cr>
+ \ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config'})<cr>
" Reselect the text that has just been pasted, see also https://stackoverflow.com/a/4317090/6064933.
nnoremap <expr> <leader>v printf('`[%s`]', getregtype()[0])
diff --git a/core/ui.vim b/core/ui.vim
index c29682f..f93c10e 100644
--- a/core/ui.vim
+++ b/core/ui.vim
@@ -64,7 +64,7 @@ let s:colorscheme_func = printf('s:my_theme_dict.%s()', s:theme)
if has_key(s:my_theme_dict, s:theme)
execute 'call ' . s:colorscheme_func
else
- call utils#Log('Invalid colorscheme function: ' . s:colorscheme_func, 'error')
+ call v:lua.vim.notify('Invalid colorscheme function: ' . s:colorscheme_func, 'error', {'title': 'nvim-config'})
endif
"}}
"}