Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Google docs integration for vim

License

NotificationsYou must be signed in to change notification settings

Aadv1k/gdoc.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google docs integration for vim/neovim.

Features

  • Sync a local file to google docs
  • Delete the google doc from google drive
  • Download the contents of the document to your local file
  • Upload the contents of your local file to it's google doc
  • Fetch remote document by their IDs and save them locally

Installation

Make sure you have the following

  • python >= 3.6 (including pip)
  • vim 8+ with python3+
  • for neovim users pynvim (pip install pynvim)

vim-plug

Plug'aadv1k/gdoc.vim', {'do':'./install.py'}" For the dev branchPlug'aadv1k/gdoc.vim', {'do':'./install.py','branch':'dev'}

packer.nvim

use {'aadv1k/gdoc.vim',run='./install.py'}-- For the dev branchuse {'aadv1k/gdoc.vim',run='./install.py',branch='dev'}

Initializing the app

For this to work, you need to have a google account, then you need to create a new google cloud project.Creating a google cloud project

Then to use the app, you have to activatedrive api (to create documents) andgoogle docs (to edit/write documents) api fromGoogle api dashboard

After this, you need to download credentials, do the steps necessary to setup a consent screen and anoAuth login, then download the credentials and place them anywhere you like. Then put the path ofthe credentials in theg:path_to_creds.

In the example below,credentials.json is placed in~/.vim you can use any valid credential file, and put it's path here.

letg:path_to_creds='/some-path/some-credentials-file.json'" Defaults to '~/.vim/credentials.json'letg:gdoc_file_path='/some-directory'" Defaults to '~/.vim/'letg:token_directory='/some-directory'" Defaults to '~/.vim/'

[NOTE]: Directories specified must exist - they will not be created by this plugin.

These paths will be valid both on windows and unix as they are passed throughos.path.expanduser() in python.

  • g:token_directory is where token for your api should live, if you don'twant the oAuth screen to pop-up everytime, you should set a standard directoryto place the token.

  • g:gdoc_file_path is the directory where the.gdoc file is placed, this fileis used to map local files to their corresponding document in the drive

Usage

This plugin creates a file called.gdoc which is placed in a folder you can specify viag:gdoc_file_path by default it is made in every directory you execute:Gdoc write..gdoc is used to keep track of the local files and their documents(ids). It does so using the following format{full_file_path} -> {file_id}\n

CommandFunctionDescription
:Gdoc fetch-doc <id>gdoc#FetchDoc(doc_id)Tries to find a document with the specified id, if found then saves it to the current buffer and adds an entry to.gdoc
:Gdoc writegdoc#WriteDoc()Write your current file to a google doc with the same name
:Gdoc syncgdoc#Sync()Upload the changes in your local file to google doc
:Gdoc sync-docgdoc#SyncDoc()Download the changes in google doc to local file
:Gdoc rmgdoc#RmDoc()Delete the google document associated with the local file from google drive.

[8]ページ先頭

©2009-2025 Movatter.jp