From e6d47b32a74f458a0ee3200844e29b1d820857c2 Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Sat, 25 May 2024 16:18:30 -0700 Subject: nvim config to open readonly if file already been opened --- home/xyz/.config/nvim/init.vim | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'home') diff --git a/home/xyz/.config/nvim/init.vim b/home/xyz/.config/nvim/init.vim index 64cdd4d9..fd368ebe 100644 --- a/home/xyz/.config/nvim/init.vim +++ b/home/xyz/.config/nvim/init.vim @@ -97,6 +97,15 @@ augroup mycmd autocmd FileType mail,gitcommit setlocal colorcolumn=72 " https://github.com/tinted-theming/base16-vim?tab=readme-ov-file#customization autocmd ColorScheme * call s:base16_customize() + " open file readonly if it already been open + " nvim seems change default from '' to 'e', but I prefer 'o' + " :h w325 e325 SwapExists swapchoice default-autocmds + " https://vi.stackexchange.com/questions/21784/vim-edit-anyway-without-prompting + " https://github.com/neovim/neovim/pull/25336 + " https://github.com/neovim/neovim/commit/29fe883aa9166bdbcae3f935523c75a8aa56fe45 + " remove nvim_swapfile autocmd is more correct, without also works but I think it change to 'e' then to 'o' which is not ideal, also it will echo "W325: ..." which is not what I want + autocmd! nvim_swapfile + autocmd SwapExists * let v:swapchoice = 'o' augroup END " :h markdown, for vim default tpope/vim-markdown -- cgit v1.2.3-70-g09d2