Skip to content

Adds makefile and define single word command. #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Install dependences
run: sudo apt install wordnet
- name: tests build
run: make -C words
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
words/words
words/list_of_index.txt
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# fzf-wordnet
[![CI](https://github.com/CTHULHU-Jesus/fzf-wordnet.vim/actions/workflows/main.yml/badge.svg)](https://github.com/CTHULHU-Jesus/fzf-wordnet.vim/actions/workflows/main.yml)

Dictionary completion powered by FZF and Wordnet for vim and your terminal.

## Vim/NeoVim
Expand Down
6 changes: 5 additions & 1 deletion bin/spell
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ if [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
fi

if [ -z "$WORDS_FILE" ]; then
WORDS_FILE="$(realpath $(dirname $(dirname $0))/words/words)"
WORDS_FILE="$(dirname $(realpath $0))/../words/words"
# If words file does not exist, create it.
if [ ! -f $WORDS_FILE ]; then
make -C $(dirname $WORDS_FILE) words > /dev/null 2>&1
fi
fi

# Taken from https://ddrscott.github.io/blog/2017/fzf-dictionary/
Expand Down
8 changes: 8 additions & 0 deletions plugin/wordnet.vim
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
inoremap <expr> <plug>(fzf-complete-wordnet) fzf_wordnet#fn#Complete()

silent! system('make -C '.expand('<sfile>:p:h:h').'/words')

function! OpenSpell(word)
:vsplit term://~/.vim/plugged/fzf-wordnet.vim/bin/spell
call feedkeys("i".a:word)
endfunction
command! -nargs=1 DefineWord :call OpenSpell(<q-args>)
2 changes: 2 additions & 0 deletions words/extract-wordnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ fi

dir=$(realpath $1)

# Reset file if it already exists
echo > $2
# Derived from balta2ar's comments on https://ddrscott.github.io/blog/2017/fzf-dictionary/
echo 'collecting from data files'
tail -n +30 $dir/data.* | cut -f5 -d' ' | sed -e 's/_/ /g' >>$2
Expand Down
15 changes: 15 additions & 0 deletions words/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

all: words

list_of_index.txt:
ls /*/*/*/index.[anv]* > $@

words: list_of_index.txt extract-wordnet.sh
./extract-wordnet.sh $(shell head -1 $< | xargs dirname) $@


.PHONY: clean
clean:
-rm -rf list_of_index.txt
-rm -rf words

Loading