aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2021-08-20 01:12:35 +0800
committerjdhao <jdhao@hotmail.com>2021-08-20 01:12:35 +0800
commit42a0663184cb356d4e662956a2b8f04c3b38007b (patch)
treee9571d77549ac9252fd52c3c111a206b381e95a4
parent30774cac5bc02ab8638ac7667e5eee8e0f41a9a6 (diff)
Reduce timeout for nvim-notify
-rw-r--r--autoload/buf_utils.vim2
-rw-r--r--core/autocommands.vim6
-rw-r--r--core/mappings.vim2
-rw-r--r--core/ui.vim3
-rw-r--r--lua/config/lsp.lua1
5 files changed, 8 insertions, 6 deletions
diff --git a/autoload/buf_utils.vim b/autoload/buf_utils.vim
index 37e7a75..a9e58b6 100644
--- a/autoload/buf_utils.vim
+++ b/autoload/buf_utils.vim
@@ -15,7 +15,7 @@ function! buf_utils#GoToBuffer(count, direction) abort
" we are essentially mixing Lua and vim script. We need to make sure that
" args inside vim.notify() are valid vim values. The conversion from vim
" value to lua value will be done by Nvim. See also https://github.com/neovim/neovim/pull/11338.
- call v:lua.vim.notify('Invalid bufnr: ' . a:count, 'error', {'title': 'nvim-config'})
+ call v:lua.vim.notify('Invalid bufnr: ' . a:count, 'error', {'title': 'nvim-config', 'timeout': 2500})
return
endif
diff --git a/core/autocommands.vim b/core/autocommands.vim
index 5306b63..34a45a6 100644
--- a/core/autocommands.vim
+++ b/core/autocommands.vim
@@ -32,8 +32,8 @@ augroup END
" https://github.com/vim/vim/issues/4379
augroup non_utf8_file_warn
autocmd!
- " 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
+ " we can not use `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', 'timeout': 2500}) | endif
augroup END
" Automatically reload the file if it is changed outside of Nvim, see
@@ -43,7 +43,7 @@ augroup END
" https://vi.stackexchange.com/a/20397/15292.
augroup auto_read
autocmd!
- autocmd FileChangedShellPost * call v:lua.vim.notify("File changed on disk. Buffer reloaded!", 'warn', {'title': 'nvim-config'})
+ autocmd FileChangedShellPost * call v:lua.vim.notify("File changed on disk. Buffer reloaded!", 'warn', {'title': 'nvim-config', 'timeout': 2500})
autocmd FocusGained,CursorHold * if getcmdwintype() == '' | checktime | endif
augroup END
diff --git a/core/mappings.vim b/core/mappings.vim
index 19e6a10..ebd9d26 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>
- \ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config'})<cr>
+ \ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config', 'timeout': 2500})<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 a81a025..a1723f0 100644
--- a/core/ui.vim
+++ b/core/ui.vim
@@ -70,7 +70,8 @@ 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 v:lua.vim.notify('Invalid colorscheme function: ' . s:colorscheme_func, 'error', {'title': 'nvim-config'})
+ let s:msg = "Invalid colorscheme function: " . s:colorscheme_func
+ call v:lua.vim.notify(s:msg, 'error', {'title': 'nvim-config', 'timeout': 2500})
endif
"}}
"}
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
index 79f6091..cabe591 100644
--- a/lua/config/lsp.lua
+++ b/lua/config/lsp.lua
@@ -65,6 +65,7 @@ local custom_attach = function(client, bufnr)
local msg = string.format("Language server %s started!", client.name)
vim.api.nvim_echo({ { msg, "MoreMsg" } }, false, {})
+ -- vim.notify(msg, 'info', {title = 'Nvim-config', timeout = 2500})
end
local capabilities = vim.lsp.protocol.make_client_capabilities()