Skip to main content
deleted 14 characters in body
Source Link
Mike Pennington
  • 2.5k
  • 4
  • 32
  • 41

Solution is in fact, setting the option: change mouse=a to mouse=r in your local .vimrc.

Problem onThe problem with setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched for a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

LOCAL SOLUTION (flawed):
The Solution in first waysolution is to use local .vmrcvimrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc.vimrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeingbeing overwritten from defaults.vim.

GLOBAL SOLUTION (preferrable):
I did wantwanted a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let theload defaults being loaded, preventpreventing them from being loaded again (at the end) and then add your personal options:

If you also want to enable the "old copy/paste behaviour"behavior", add the following lines at the end of that file as well:

Solution is in fact, setting the option mouse=a to mouse=r.

Problem on setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

The Solution in first way is to use local .vmrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeing overwritten from defaults.vim.

I did want a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let the defaults being loaded, prevent them from being loaded again (at the end) and then add your personal options:

If you also want to enable the "old copy/paste behaviour", add the following lines at the end of that file as well:

Solution: change mouse=a to mouse=r in your local .vimrc.

The problem with setting this in /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched for a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

LOCAL SOLUTION (flawed):
The first solution is to use local .vimrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vimrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are being overwritten from defaults.vim.

GLOBAL SOLUTION (preferrable):
I wanted a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and load defaults, preventing them from being loaded again (at the end) and then add your personal options:

If you also want to enable the "old copy/paste behavior", add the following lines at the end of that file as well:

Modified `source` directive to be agnostic to the specific version of vim/debian in use.
Source Link

Solution is in fact, setting the option mouse=a to mouse=r.

Problem on setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

The Solution in first way is to use local .vmrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeing overwritten from defaults.vim.

I did want a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let the defaults being loaded, prevent them from being loaded again (at the end) and then add your personal options:

Please create the following file: /etc/vim/vimrc.local

" This file loads the default vim options at the beginning and prevents
" that they are being loaded again later. All other options that will be set,
" are added, or overwrite the default settings. Add as many options as you
" whish at the end of this file.
 
" Load the defaults
source $VIMRUNTIME/defaults.vim
 
" 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 whish
 
" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif
 

(Note that $VIMRUNTIME used in the above snippet has a value like /usr/share/vim/vim80/defaults.vim.)

If you also want to enable the "old copy/paste behaviour", add the following lines at the end of that file as well:

" 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

Solution is in fact, setting the option mouse=a to mouse=r.

Problem on setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

The Solution in first way is to use local .vmrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeing overwritten from defaults.vim.

I did want a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let the defaults being loaded, prevent them from being loaded again (at the end) and then add your personal options:

Please create the following file: /etc/vim/vimrc.local

" This file loads the default vim options at the beginning and prevents
" that they are being loaded again later. All other options that will be set,
" are added, or overwrite the default settings. Add as many options as you
" whish at the end of this file.
 
" Load the defaults
source $VIMRUNTIME/defaults.vim
 
" 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 whish
 
" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif
 

If you also want to enable the "old copy/paste behaviour", add the following lines at the end of that file as well:

" 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

Solution is in fact, setting the option mouse=a to mouse=r.

Problem on setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

The Solution in first way is to use local .vmrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeing overwritten from defaults.vim.

I did want a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let the defaults being loaded, prevent them from being loaded again (at the end) and then add your personal options:

Please create the following file: /etc/vim/vimrc.local

" This file loads the default vim options at the beginning and prevents
" that they are being loaded again later. All other options that will be set,
" are added, or overwrite the default settings. Add as many options as you
" whish at the end of this file.
 
" Load the defaults
source $VIMRUNTIME/defaults.vim
 
" 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 whish
 
" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif
 

(Note that $VIMRUNTIME used in the above snippet has a value like /usr/share/vim/vim80/defaults.vim.)

If you also want to enable the "old copy/paste behaviour", add the following lines at the end of that file as well:

" 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
Modified `source` directive to be agnostic to the specific version of vim/debian in use.
Source Link

Solution is in fact, setting the option mouse=a to mouse=r.

Problem on setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

The Solution in first way is to use local .vmrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeing overwritten from defaults.vim.

I did want a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let the defaults being loaded, prevent them from being loaded again (at the end) and then add your personal options:

Please create the following file: /etc/vim/vimrc.local

" This file loads the default vim options at the beginning and prevents
" that they are being loaded again later. All other options that will be set,
" are added, or overwrite the default settings. Add as many options as you
" whish at the end of this file.
 
" Load the defaults
source /usr/share/vim/vim80$VIMRUNTIME/defaults.vim
 
" 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 whish
 
" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif
 

If you also want to enable the "old copy/paste behaviour", add the following lines at the end of that file as well:

" 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

Solution is in fact, setting the option mouse=a to mouse=r.

Problem on setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

The Solution in first way is to use local .vmrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeing overwritten from defaults.vim.

I did want a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let the defaults being loaded, prevent them from being loaded again (at the end) and then add your personal options:

Please create the following file: /etc/vim/vimrc.local

" This file loads the default vim options at the beginning and prevents
" that they are being loaded again later. All other options that will be set,
" are added, or overwrite the default settings. Add as many options as you
" whish at the end of this file.
 
" Load the defaults
source /usr/share/vim/vim80/defaults.vim
 
" 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 whish
 
" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif
 

If you also want to enable the "old copy/paste behaviour", add the following lines at the end of that file as well:

" 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

Solution is in fact, setting the option mouse=a to mouse=r.

Problem on setting this in the /usr/share/vim/vim80/defaults.vim as the accepted answer says, is that it will be overwritten on every update. I searched a long time and ended up on this one: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=864074

The Solution in first way is to use local .vmrc files and set it there. So you could create a local .vimrc (~/.vimrc) for every user and set your options there. Or create one in /etc/skel so it will be automatically created for every new user you create.

But when you use local .vmrc files, you have to set all options there, because if there is a local .vimrc, the defaults.vim doesn't get loaded at all! And if there is no local .vimrc all your settings are beeing overwritten from defaults.vim.

I did want a global configuration for all users, which loads the default options and then adds or overwrites the defaults with my personal settings. Luckily there is an option for that in Debian: The /etc/vim/vimrc.local will be loaded after the /etc/vim/vimrc. So you can create this file and let the defaults being loaded, prevent them from being loaded again (at the end) and then add your personal options:

Please create the following file: /etc/vim/vimrc.local

" This file loads the default vim options at the beginning and prevents
" that they are being loaded again later. All other options that will be set,
" are added, or overwrite the default settings. Add as many options as you
" whish at the end of this file.
 
" Load the defaults
source $VIMRUNTIME/defaults.vim
 
" 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 whish
 
" Set the mouse mode to 'r'
if has('mouse')
  set mouse=r
endif
 

If you also want to enable the "old copy/paste behaviour", add the following lines at the end of that file as well:

" 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
Fixed typo that'll help a lot of confusion if copy pasted blindly. Needed 6 characters, therefore I added a "please", too.
Source Link
Loading
added 1 character in body
Source Link
Loading
Source Link
Loading