fcqs

package module
v0.3.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 11 Imported by: 0

README

fcqs

fcqs is a quick searcher for flashcards-like notes with fzf.

Usage

Press Ctrl+o (customizable) to launch fcqs on command-line.

You can search for the title of the note with fzf. The preview screen shows the contents of the note. The following key bindings are available.

  • Enter key: Output the note to standard output. If the notes has shell fenced code blocks, the first block is pasted to the command-line.
  • Ctrl+y: Copy the note to clip board.
  • Ctrl+o: Open the first URL in the note with a browser.
  • Ctrl+e: Edit the note

Installation

Install fzf which is required to use fcqs.

Download the fcqs archive from GitHub Releases and extract it.

Copy the command fcqs-cli to a directory with a path.

install fcqs-cli ~/.local/bin/

Add the following function for fcqs to ~/.bashrc for Bash & Unix users.

For Unix standard editor (Vim, Emacs, nano, gedit, etc.):

export VISUAL="vim"
eval "$(fcqs-cli --bash)"

For Visual Studio Code:

export FCQS_EDITOR="vscode"
eval "$(fcqs-cli --bash)"

You can customize default key bindings and clipboard command.

export FCQS_COPY_KEY="ctrl-y"
export FCQS_OPEN_KEY="ctrl-o"
export FCQS_EDIT_KEY="ctrl-e"
export FCQS_BASH_BIND_KEY="\C-o"
export FCQS_CLIP_COMMAND="xclip -selection c"

[!NOTE] -b option is only available in fcqs 0.3.0 or later. If you have an older version of fcqs, or want more control, you can use shell.bash.

Notes specification

File

The default notes file is ~/fcnotes.md. The file can be changed by the environment variable FCQS_NOTES_FILE.

Format

The format of notes is similar to Markdown. However, all you really need are the titles of each note in the heading and the content below it.

# title1

contents1

# title2

contents2

Develop

Build the command fcqs-cli:

make

Unit test:

make unit-test

Integration test:

make integration-test

Documentation

Index

Constants

View Source
const (
	Normal = iota
	Fenced
	Scoped
	ScopedFenced
)

State of text line.

View Source
const DefaultNotesFile = "fcnotes.md"

Variables

View Source
var BashTemplate string

Functions

func GetNotesFileName

func GetNotesFileName() (string, error)

GetNotesFileName returns the filename of the notes.

func WriteBashScript added in v0.3.0

func WriteBashScript(w io.Writer)

func WriteContents

func WriteContents(w io.Writer, r io.Reader, title string)

WriteContents writes the contents of the note.

func WriteFirstCmdLineBlock added in v0.3.0

func WriteFirstCmdLineBlock(w io.Writer, r io.Reader, title string)

WriteFirstCmdLineBlock writes the first command-line block in the contents of the note.

func WriteFirstURL

func WriteFirstURL(w io.Writer, r io.Reader, title string)

WriteFirstURL writes the first URL in the contents of the note.

func WriteNoteLocation

func WriteNoteLocation(w io.Writer, file *os.File, title string)

WriteNoteLocation writes the file name and line number of the note.

func WriteTitles

func WriteTitles(w io.Writer, r io.Reader)

WriteTitles writes the titles of all notes.

Types

type Filter added in v0.3.0

type Filter struct {
	WriteBuf     io.Writer
	IsRemoveHead bool
	// contains filtered or unexported fields
}

func NewFilter added in v0.3.0

func NewFilter(w io.Writer, isRemoveHead bool) Filter

func (*Filter) Write added in v0.3.0

func (f *Filter) Write(text string)

Write writes filtered lines.

Directories

Path Synopsis
cmd
fcqs-cli command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL