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 all 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
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 clean all
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add words/words
git commit -m "BOT: Built Words File" || true
- name: Push changes to repo
uses: ad-m/github-push-action@master
with:
repository: ${{github.repository}}
github_token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 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/Avi-D-coder/fzf-wordnet.vim/actions/workflows/main.yml)

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

## Vim/NeoVim
Expand All @@ -9,6 +11,7 @@ Plug 'junegunn/fzf.vim'
Plug 'Avi-D-coder/fzf-wordnet.vim'

imap <C-S> <Plug>(fzf-complete-wordnet)
nmap <C-d> :DefineWord <C-R>=expand('<cword>')<CR><CR>
```
![ezgif-4-32dc75db6d68](https://user-images.githubusercontent.com/29133776/60706168-de395500-9ed6-11e9-996c-58d2996c59ba.gif)

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

if [ -z "$WORDS_FILE" ]; then
WORDS_FILE="$(realpath $(dirname $(dirname $0))/words/words)"
WORDS_FILE="$(dirname $(dirname $(realpath $0)))/words/words"
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()

let s:path = expand('<sfile>:p:h:h')
function! OpenSpell(word)
execute 'vsplit term://'.s:path.'/bin/spell'
# inserts word
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
12 changes: 12 additions & 0 deletions words/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Works on an ubuntu system
# Used to build the words file and save to repo via github action
all: words

words: $(shell ls /*/*/*/index.[anv]* | head -1) extract-wordnet.sh
./extract-wordnet.sh $(shell dirname $<) $@

.PHONY: clean
clean:
-rm -rf words

Loading