From 61c6f7d249e39745a6b58cdaa0338837d3ad0735 Mon Sep 17 00:00:00 2001 From: EricKwok Date: Tue, 4 Dec 2018 11:08:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E5=BC=BA=E5=88=B6?= =?UTF-8?q?=E5=86=99=E5=85=A5=E7=9A=84=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 参照 [#138](https://github.com/wklken/k-vim/issues/138) 的建议,将 w!! 从 keymap 改成了 command,现在输入W或Wq即可强制保存(退出) --- vimrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vimrc b/vimrc index 2cc66df..3537b65 100644 --- a/vimrc +++ b/vimrc @@ -26,6 +26,9 @@ filetype on filetype plugin on filetype indent on +" save +command W :execute ':silent w !sudo tee % > /dev/null' | :edit! " sudo save and reload +command Wq :execute ':silent w !sudo tee % > /dev/null' | :edit! |:quit " sudo save and exit " base set nocompatible " don't bother with vi compatibility @@ -246,9 +249,6 @@ nnoremap ; : nnoremap H ^ nnoremap L $ -" save -cmap w!! w !sudo tee >/dev/null % - " command mode, ctrl-a to head, ctrl-e to tail cnoremap cnoremap