Socket
Book a DemoInstallSign in
Socket

toolman.org/file/viminfo

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

toolman.org/file/viminfo

Go Modules
Version
v1.1.2
Version published
Created
Source

GoDoc Go Report Card Build Status

viminfo

import "toolman.org/file/viminfo"

  • Overview
  • Index

Overview

Package viminfo reads and parses Vim swap files into a well-formed structure.

Install

  go get toolman.org/file/viminfo

Index

Package files

block0.go cryptmethod.go format.go viminfo.go

type CryptMethod

type CryptMethod byte

CryptMethod is a vim crypto method

const (
    CMnone      CryptMethod = '0' // No encryption
    CMzip       CryptMethod = 'c' // Default encryption
    CMblowfish  CryptMethod = 'C' // Blowfish encryption
    CMblowfish2 CryptMethod = 'd' // Blowfish2 encryption
)

Supported Crypto Methods

func (CryptMethod) String

func (cm CryptMethod) String() string

type FileFormat

type FileFormat byte

FileFormat indicates the EOL token for an edited file

const (
    FFnone FileFormat = iota // Format is not known
    FFunix                   // Unix Format "\n"
    FFdos                    // DOS Format  "\r\n"
    FFmac                    // MAC Format  "\r"
)

Supported formats

func (FileFormat) String

func (ff FileFormat) String() string

type VimInfo

type VimInfo struct {
    // Version indicates which version of Vim wrote this swap file
    Version string
    // LastMod is the modification time for the file being edited
    LastMod time.Time
    // Inode is the filesystem inode of the file being edited
    Inode uint32
    // PID is the process ID for the vim session editing the file
    PID uint32
    // User is the username for the vim session's process owner (or, UID of username is unavailable)
    User string
    // Hostname is the hostname where the vim session is/was running
    Hostname string
    // Filename reflects the name of the file being edited
    Filename string
    // Encoding is the file encoding for the file being edited (or, the word "encrypted" if the file is encrypted)
    Encoding string
    // Crypto indicates the "cryptmethod" for the file being edited (or, "plaintext" if the file is not encrypted)
    Crypto CryptMethod
    // Format is the FileFormat for the edited file (e.g. unix, dos, mac)
    Format FileFormat
    // Modified indicates whether the edit session has unsaved changes
    Modified bool
    // SameDir indicates whether the edited file is in the same directory as the swap file
    SameDir bool
}

VimInfo reflects the meta-data stored in a vim swapfile

func Parse

func Parse(filename string) (*VimInfo, error)

Parse reads and parses the vim swapfile specified by filename and returns a populated *VimInfo, or an error if the file could not be parsed.

FAQs

Package last updated on 02 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts