# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# Copyright (C) 2024 Zane Zakraisek <zz@eng.utah.edu>
# SPDX-License-Identifier: GPL-2.0-only
# LOGPROF-SUGGEST: no

  abi <abi/4.0>,

  include <abstractions/nameservice-strict>
  include <abstractions/consoles>

  @{sh_path}                  rix,
  @{bin}/nvim                 mix,
  @{bin}/sensible-editor       mr,
  @{bin}/vim{,.*}             mix,
  @{bin}/which{,.debianutils}  ix,

  /usr/share/nvim/{,**} r,
  /usr/share/terminfo/** r,
  /usr/share/vim/{,**} r,

  /etc/vim/{,**} r,
  /etc/vimrc r,
  /etc/xdg/nvim/* r,

  owner @{HOME}/.selected_editor r,
  owner @{HOME}/.viminf@{c}{,.tmp} rw,
  owner @{HOME}/.vimrc r,

  owner @{HOME}/ r,
  owner @{user_cache_dirs}/ r,
  owner @{user_cache_dirs}/vim/{,**} rw,
  owner @{user_config_dirs}/vim/{,**} r,
  owner @{user_state_dirs}/nvim/{,**} rw,
  owner @{user_config_dirs}/nvim/{,**} rw,

  owner @{run}/user/@{uid}/nvim.* rw,

  include if exists <abstractions/app/editor.d>

# vim:syntax=apparmor
