2

The vimrc template I used had the message "Ensure options work with the Vim-related packages available in Debian." for

runtime! debian.vim

Here is the contents of /usr/share/vim/vim81/debian.vim

" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible    " Use Vim defaults instead of 100% vi compatibility
set backspace=indent,eol,start  " more powerful backspacing

" Now we set some defaults for the editor
set history=50      " keep 50 lines of command line history
set ruler       " show the cursor position all the time

" modelines have historically been a source of security/resource
" vulnerabilities -- disable by default, even when 'nocompatible' is set
set nomodeline

" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc

" We know xterm-debian is a color terminal
if &term =~ "xterm-debian" || &term =~ "xterm-xfree86"
  set t_Co=16
  set t_Sf=[3%dm
  set t_Sb=[4%dm
endif

" Some Debian-specific things
if has('gui')
  " Must define this within the :if so it does not cause problems with
  " vim-tiny (which does not have +eval)
  function! <SID>MapExists(name, modes)
    for mode in split(a:modes, '\zs')
      if !empty(maparg(a:name, mode))
        return 1
      endif
    endfor
    return 0
  endfunction

  " Make shift-insert work like in Xterm
  autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "nvso") | execute "map <S-Insert> <MiddleMouse>" | endif
  autocmd GUIEnter * if !<SID>MapExists("<S-Insert>", "ic") | execute "map! <S-Insert> <MiddleMouse>" | endif
endif

" Set paper size from /etc/papersize if available (Debian-specific)
if filereadable("/etc/papersize")
  let s:papersize = matchstr(readfile('/etc/papersize', '', 1), '\p*')
  if strlen(s:papersize)
    exe "set printoptions+=paper:" . s:papersize
  endif
endif

So which vim debian packages is this really for? Vimtutor? I can't think of any vim-related packages other than vim/neovim itself I use on Ubuntu.

2
  • For example, the vim-tiny package. There are multiple GUI vim packages with different GUI toolkits, IIUC
    – D. Ben Knoble
    Sep 9, 2022 at 13:31
  • @D.BenKnoble I have never used vim-tiny though. So I wonder if it's necessary in my vimrc.
    – qwr
    Sep 9, 2022 at 14:37

1 Answer 1

0

Debian ships a command vam or vim-addon-manager which can be used to enable Vim plugins in a Debian system.

Plugins can either come from GitHub or a git repository, or they can come from the Debian package vim-scripts, which contains a curated list of Vim plugins that are maintained and shipped as a Debian package (vim-addon-manager defines a registry format to allow other packages that ship Vim plugins manage them via that tool.)

The reason why this used to require sourcing debian.vim was that this script would update 'runtimepath' to include /var/lib/vim/addons into the list of directories where to look for plugins. That directory is where vim-addon-manager will add symlinks or files or directories to enable or disable plugins managed by it, so including it in 'runtimepath' is a requirement to make the tool work as expected.

But Debian has switched from adding /var/lib/vim/addons to 'runtimepath' in debian.vim, instead passing it to the Vim build (as an argument to the --with-global-runtime= option) so that it gets actually hardcoded into the Vim binary itself. Therefore, the vim-addon-manager setup no longer depends on properly sourcing debian.vim, but it depends on a Vim binary compiled with that specific option, which is the case for the Vim binaries shipped by Debian.

You can see this commit (from November 2019) which introduced this change no longer depending on the 'runtimepath' setting in debian.vim, replacing it with the build time option, and Debian bug #943967 which motivated the change.

2
  • So if I don't use any of these debian vim plugins as I use Vundle, it's not necessary in my vimrc?
    – qwr
    Sep 9, 2022 at 14:36
  • @qwr Correct. In fact, even Debian's vim-addon-manager now should work without sourcing debian.vim as the runtimepath has been hardcoded into the binary through the build time configuration. But if you use Vundle/vim-plug/etc. to manage your plugins, you shouldn't need debian.vim at all.
    – filbranden
    Sep 9, 2022 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.