fcqs

package module
v0.4.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 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 settings.

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_COPY_COMMAND="xclip -selection c"
export FCQS_COPY_WITH_TITLE=true
export FCQS_OPEN_COMMAND="open"
export FCQS_NOTES_FILE="~/fcnotes.md"

[!NOTE] --bash 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 (
	DefaultNotesFile = "fcnotes.md"
)

Variables

This section is empty.

Functions

func WriteBashScript added in v0.3.0

func WriteBashScript(w io.Writer)

WriteBashScript writes bash script to set up fcqs.

func WriteContents

func WriteContents(w io.Writer, r io.Reader, title *value.Title, isNoTitle bool) error

WriteContents writes the contents of the note.

func WriteFirstCmdLineBlock added in v0.3.0

func WriteFirstCmdLineBlock(w io.Writer, r io.Reader, title *value.Title) error

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

func WriteFirstURL

func WriteFirstURL(w io.Writer, r io.Reader, title *value.Title) error

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

func WriteNoteLocation

func WriteNoteLocation(w io.Writer, files []*os.File, title *value.Title) error

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

func WriteTitles

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

WriteTitles writes the titles of all notes.

Types

type NotesFiles added in v0.4.0

type NotesFiles struct {
	Reader io.Reader
	Files  []*os.File
}

func OpenNotesFiles added in v0.4.0

func OpenNotesFiles() (*NotesFiles, error)

NewNOtesFiles returns NotesFiles instance.

func (NotesFiles) Close added in v0.4.0

func (n NotesFiles) Close()

Directories

Path Synopsis
cmd
fcqs-cli command
internal

Jump to

Keyboard shortcuts

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