Difference between revisions of "VIM"
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | |||
| − | |||
| − | |||
<pre>  | <pre>  | ||
| − | " Prevent the defaults from being loaded again later, if the user doesn't   | + | cat <<'EOF' > /etc/vim/vimrc.local  | 
| − | " have a local vimrc (~/.vimrc)   | + | " Prevent the defaults from being loaded again later, if the user doesn't  | 
| − | let skip_defaults_vim = 1   | + | " have a local vimrc (~/.vimrc)  | 
| + | let skip_defaults_vim = 1  | ||
| − | " Set more options (overwrites settings from /usr/share/vim/vim80/defaults.vim)   | + | " Set more options (overwrites settings from /usr/share/vim/vim80/defaults.vim)  | 
| − | " Add as many options as you wish   | + | " Add as many options as you wish  | 
| − | " Set the mouse mode to 'r'   | + | " Set the mouse mode to 'r'  | 
| − | if has('mouse')   | + | if has('mouse')  | 
| − | + |   set mouse=r  | |
| − | endif   | + | endif  | 
| − | " Toggle paste/nopaste automatically when copy/paste with right click in insert mode:   | + | " Toggle paste/nopaste automatically when copy/paste with right click in insert mode:  | 
| − | let &t_SI .= "\<Esc>[?2004h"   | + | let &t_SI .= "\<Esc>[?2004h"  | 
| − | let &t_EI .= "\<Esc>[?2004l"   | + | let &t_EI .= "\<Esc>[?2004l"  | 
| − | inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()   | + | inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()  | 
| − | function! XTermPasteBegin()   | + | function! XTermPasteBegin()  | 
| − | + |   set pastetoggle=<Esc>[201~  | |
| − | + |   set paste  | |
| − | + |   return ""  | |
| − | endfunction   | + | endfunction  | 
| + | EOF  | ||
</pre>  | </pre>  | ||
Latest revision as of 07:53, 22 October 2025
cat <<'EOF' > /etc/vim/vimrc.local
" Prevent the defaults from being loaded again later, if the user doesn't
" have a local vimrc (~/.vimrc)
let skip_defaults_vim = 1
" Set more options (overwrites settings from /usr/share/vim/vim80/defaults.vim)
" Add as many options as you wish
" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif
" Toggle paste/nopaste automatically when copy/paste with right click in insert mode:
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
  set pastetoggle=<Esc>[201~
  set paste
  return ""
endfunction
EOF
Commands:
Add string to the beginning of each line:
:%s/^/string/
Add string to the end of each line:
:%s/$/\string/g
Delete all text:
:%d