Language: en ja

Vim documentation: pass

main help file
pass.txt                                                      a summary

Version :
Author  : Tsuyoshi CHO <Tsuyoshi.CHO+develop@Gmail.com>
License : MIT license  {{{
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
    "Software"), to deal in the Software without restriction, including
    without limitation the rights to use, copy, modify, merge, publish,
    distribute, sublicense, and/or sell copies of the Software, and to
    permit persons to whom the Software is furnished to do so, subject to
    the following conditions:
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}}}

==============================================================================
CONTENTS                                        pass-contents

INTRODUCTION                                    pass-introduction
USAGE                                           pass-usage
INTERFACE                                       pass-interface
  VARIABLES                                       pass-variables
  COMMANDS                                        pass-commands
  FUNCTIONS                                       pass-functions
  AUTOCOMMANDS                                    pass-autocommands
TODO                                            pass-todo
CHANGELOG                                       pass-changelog


==============================================================================
INTRODUCTION                                    pass-introduction

pass is targeted Vim password-store API plugin.
see below:
  Pass: The Standard Unix Password Manager - https://www.passwordstore.org/

Currenlty get support. usable like auth-source at emacs.

Latest version:
https://github.com/tsuyoshicho/pass.vim

See also CtrlP plugin feature ctrlp-pass.
See also Clap plugin feature clap-pass.

==============================================================================
USAGE                                           pass-usage

Password and other setup.

 " in vimrc
 " configured at end of vim startup
 call pass#get_startup('g:test_gh_token','Develop/Github')
 call pass#get_startup('g:test_gh_username','Develop/Github','username')

 function! s:test() abort
   let password = pass#get('Service/foobar')
   " ...
 endfunction


Plugin password and other setup.

 # in plugin setting(dein's toml)
 [[plugins]]
 repo = 'tsuyoshicho/vim-pass'
 depends = ['ctrlp']
 hook_add = '''
   let g:ctrlp_extensions = get(g:, 'ctrlp_extensions', [])
         \ + ['pass']
 '''

 [[plugins]] # https://pixe.la/
 repo = 'mattn/vim-pixela'
 depends = ['open-browser.vim','vim-pass']
 hook_add = '''
   " let g:pixela_username = 'user'
   " let g:pixela_token    = 'token'

   call pass#get_startup('g:pixela_username','Develop/Pixela','username')
   " VimPixela work OK
   call pass#get_startup('g:pixela_token','Develop/Pixela')
   " startup-time countup do not correct work.
   " It work or does not work depending on the processing order of events
 '''

 [[plugins]]
 repo = 'tpope/vim-rhubarb'
 depends = ['vim-fugitive','vim-pass']
 # on_if= 'executable("hub")'
 hook_add = '''
   call pass#get_startup('g:RHUBARB_TOKEN','Develop/Github')
 '''

 [[plugins]]
 repo = 'kyoh86/vim-docbase'
 depends = ['vim-pass']
 hook_add = '''
   let g:docbase = []
   call pass#get_startup_funcall(
         \ { v ->
         \ add(g:docbase,
         \   {
         \     'domain': 'example1',
         \     'token' : v
         \   }
         \  )
         \ },
         \ 'Develop/DocBase1'
         \)
   call pass#get_startup_funcall(
         \ { v ->
         \ add(g:docbase,
         \   {
         \     'domain': 'example2',
         \     'token' : v
         \   }
         \  )
         \ },
         \ 'Develop/DocBase2'
         \)
 '''

 [[plugins]] # Slack
 repo = 'mizukmb/slackstatus.vim'
 depends = ['webapi-vim','vim-pass']
 hook_add = '''
   " let g:slackstatus_token = '<YOUR_SLACK_TOKEN>'
   " my hoge
   call pass#get_startup('g:slackstatus_token','Message/Slack/myhoge.legacy')
   " vim-jp
   " call pass#get_startup('g:slackstatus_token',
   "      \                'Message/Slack/vim-jp.legacy')

   function! s:slack_list(A,L,P) abort
     let slacklist = ['myhoge','vim-jp']
     return slacklist
   endfunction

   function s:slackstatus_change_token(team) abort
     let path = 'Message/Slack/' . a:team . '.legacy'
     let g:slackstatus_token = pass#get(path)
   endfunction

   command! -nargs=1 -complete=customlist,<SID>slack_list
      \ SlackStatusChange :call <SID>slackstatus_change_token(<f-args>)
 '''

 [[plugins]] # Mastodon
 repo = 'mattn/vim-mastodon'
 depends = ['webapi-vim','vim-pass']
 hook_add = '''
   " mstdn.jp
   " let g:mastodon_host = 'mstdn.jp'
   " call pass#get_startup('g:mastodon_access_token',
   "      \                'Message/Mastodon/mstdn.jp')

   function! s:mastodon_completion(A,L,P) abort
     let host_list = ['mstdn.jp']
     return join(host_list,"\n")
   endfunction

   function s:mastodon_change_hosttoken(host) abort
     let path = 'Message/Mastodon/' . a:host
     let g:mastodon_host = a:host
     let g:mastodon_access_token = pass#get(path)
   endfunction

   command! -nargs=1 -complete=custom,<SID>mastodon_completion
      \ MastodonHostChange :call <SID>mastodon_change_hosttoken(<f-args>)
 '''


==============================================================================
INTERFACE                                       pass-interface

------------------------------------------------------------------------------
VARIABLES                                         pass-variables

g:pass_store_path                                   g:pass_store_path
        default value: "~/.password-store"

Store path as password-store like saved data.

g:pass_gpg_path                                    g:pass_gpg_path
        default value: "gpg"

gpg(gnupg) execution path.
Simply, command name write.

g:pass_use_agent                                    g:pass_use_agent
        default value:
                0 (SSH remote or non-Windows/Mac without GUI system)
                1 (otherwise)

Usable gpg-agent setting.
1 as passphrase request use gpg-agent's pinentry;
0 as passphrase request on Vim.

If remote or non-GUI system has gpg-agent enabled, the following shell script
is useful:
        !/bin/bash
        vim_with_gpg_check () {
          local result=0
          # Run test decoding and use gpg-agent
          local output=$(<gpg password-store decode test using same key>) || result=$?
          if [[ "$result" == "0" ]]; then
            export VIM_PASS_AGENT=1
          else
            export VIM_PASS_AGENT=0
          fi

          # run vim
          vim "$@"

          # delete environment variable
          export -n VIM_PASS_AGENT
        }

        if type vim_with_gpg_check &>/dev/null; then
          alias vim='vim_with_gpg_check'
        fi


The following Vim script that is received these value:
        " Check gpg-agent support
        if exists('$VIM_PASS_AGENT')
            " When '1', using agent enabled
            let g:pass_use_agent = ($VIM_PASS_AGENT ==? '1') ? 1 : 0
        endif


The shell script is used because the plugin cannot pass the passphrase to
gpg-agent from within Vim. If you enter the gpg-agent passphrase with
pinentry-curses etc. in advance, it will be used for other operations.

g:pass_entry_altmap                                 g:pass_entry_altmap
        default value:
  {
  \ 'password' : ['password', 'secret'],
  \ 'username' : ['user', 'username', 'id', 'account'],
  \ 'host'     : ['host', 'url',      'uri'          ],
  \},


Entry's alternative name Dictionary, key as label, value as List that is
alternative entry name list. "password" is special entry label. This mean as
default password info. "password" label entry use inner defined value. "otp"
is special entry label. only use OTP param; alternative name nothing. Define
g:pass_entry_altmap at before loading, add above setting

------------------------------------------------------------------------------
COMMANDS                                          pass-commands

:PassGet {entry} ...                                :PassGet

Password check command, password-store entry name set to arg.
This command need {entry}, You can use <tab> to auto-complete the {entry} when
typing it.

:PassGetOtp {entry} ...                             :PassGetOtp

OTP check command, password-store entry name set to arg.
This command need {entry}, You can use <tab> to auto-complete the {entry} when
typing it.

:PassGetRegister {entry} ...                        :PassGetRegister

Password save ad register command, password-store entry name set to arg.
Currently only work unnamed register and eternaly.
This command need {entry}, You can use <tab> to auto-complete the {entry} when
typing it.

:PassGetOtpRegister {entry} ...                     :PassGetOtpRegister

OTP save ad register command, password-store entry name set to arg.
Currently only work unnamed register and eternaly.
This command need {entry}, You can use <tab> to auto-complete the {entry} when
typing it.

------------------------------------------------------------------------------
FUNCTIONS                                         pass-functions

pass#get({entry}, {...})                            pass#get()

Password get API, return value.
entry is password-store style.
Optionally item name.

pass#get_otp({entry})                               pass#get_otp()

Password get API, return otp value.
entry is password-store style.

pass#get_register({entry}, {...})                   pass#get_register()

Password get API, value set to register.
entry is password-store style.
Optionally item name.
Currently limited work, copy to unnamed register.
{NOT WORK BELOW}
It will disappear from the register as time passes.

pass#get_otp_register({entry})                      pass#get_otp_register()

Password get API, otp value set to register.
entry is password-store style.
Currently limited work, copy to unnamed register.
{NOT WORK BELOW}
It will disappear from the register as time passes.

                                                    pass#get_startup()
pass#get_startup({set-variable},{entry}, {...})

Password get API, startup specific; value set to set-variable
entry is password-store style.
Optionally item name.
set-variable is scoped-variable string.(ex. 'g:hoge_fuga')
Note: StartUp API is autoload function that is callable at before other plugin
sourced support (using adaptive autoload loading).

                                                    pass#get_startup_scope()
pass#get_startup_scope({scope},{set-variable},{entry}, {...})

Password get API, startup specific; value set to set-variable
entry is password-store style.
Optionally item name.
scope is value of g:, w: or other scope signature like as get()
set-variable is non-scoped-variable string.(ex. 'hoge_fuga')
Note: StartUp API is autoload function that is callable at before other plugin
sourced support (using adaptive autoload loading).

                                                    pass#get_startup_funcall()
pass#get_startup_funcall({funcref},{entry}, {...})

Password get API, startup specific; call {funcref} with value.
entry is password-store style.
Optionally item name.
{funcref} call with one arg, that value as resolved Password entry.
Note: StartUp API is autoload function that is callable at before other plugin
sourced support (using adaptive autoload loading).

------------------------------------------------------------------------------
AUTOCOMMANDS                                      pass-autocommands

User VimPassStartUpResolve                          VimPassStartUpResolve

Invoke event when processed pass#resolve_startup() was done(multiple).

==============================================================================
TODO                                            pass-todo

see Ja help.

==============================================================================
CHANGELOG                                       pass-changelog

see gitlog

==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl:noet:

top - main help file - tag index
Language: en ja