Commit graph

849 commits

Author SHA1 Message Date
Tomas Babej
47f7f24b17 SelectedTasks: Implement TaskWikiToggle 2021-06-21 19:13:40 -04:00
Tomas Babej
29bc9aa20c tests: Add test for TaskWikiToggle 2021-06-21 19:13:40 -04:00
Wojciech Francuzik
48e24b03c0 include info about pynvim
I was lost because TaskWiki would not work with my nvim. It turned out that my python3 provider was not available. Installing this dependency - pynvim, solved the issue. I hope I can save other nvm users time by providing this info.
2021-05-22 07:39:05 -04:00
salman69e27
ae28d398d5 Basic inspect functionality for preset headers 2021-05-22 07:38:48 -04:00
Tomas Babej
23a3c20a7d
LICENCE: Update copyright 2021-04-02 22:41:20 -04:00
Jonathan Dowland
67e5444cdf Only adjust conceallevel if taskwiki_disable_concealcursor unset
`g:taskwiki_disable_concealcursor` is used to control whether or not
Taskwiki sets `concealcursor`. Move the setting of `conceallevel` to
also dpend upon `g:taskwiki_disable_concealcursor`, the reasoning
being that if the user does not want Taskwiki to set `concealcursor`,
they most likely don't want `conceallevel` changed either.

Fixes #325.
2021-04-02 22:37:28 -04:00
Nikolaos Kakouros
a3ae9c52cd Adds count viewport setting 2021-01-28 20:54:48 -05:00
Tomas Janousek
72397a8c23 tests: Workaround for recent coveralls-python breaking GH Actions
https://github.com/TheKevJames/coveralls-python/issues/252
2021-01-14 15:10:17 -05:00
Tomas Janousek
b5094a70f2 tests: Update test matrix
There's no 2.5.x branch any more. Change the default to master, i.e. the
latest release, now that the branch actually reflects the release and
no longer includes patches accidentally merged to the wrong branch.

Keep v2.5.1 around just for safety as it probably is the most widely
used release around.

Would be nice if the 2.6.0 branch was named dev or devel and wasn't
about to disappear as soon as 2.6.0 is released... :-/
2021-01-14 15:10:17 -05:00
Ben Harris
b280e28ac8 Update README.md
Add a bit of explanation for the supported markdown syntax.
2020-12-30 08:17:25 -05:00
Tomas Janousek
4c7cc5f551 completion: Fix omni completion of non-ascii tasks
vim uses bytes as column offsets, so we need to work with encoded
strings instead.
2020-12-29 18:16:19 -05:00
Tomas Janousek
679e564194 cache: Empty preset cache on reset()
Forgotten in 4372d52298.
2020-12-26 20:52:04 -05:00
Tomas Janousek
57a5c405ea completion: Add omni completion for new task modstrings 2020-12-26 20:52:04 -05:00
Tomas Janousek
12d363df5e completion: Fix compatibility with taskwarrior 2.4.4 2020-12-26 20:52:04 -05:00
Tomas Janousek
6cedc13b58 completion: Add tab completion for TaskWikiMod 2020-12-26 20:52:04 -05:00
Tomas Janousek
a6907bac85 ftplugin: Avoid changing global viewoptions
As mentioned in an earlier commit, viewoptions is global, so it's
probably best to override it only temporarily for mkview.

(loadview is moved to autoload just for symmetry and in case we need to
do something more complex, like saving/restoring foldmethod, later)
2020-12-18 17:55:09 -05:00
Tomas Janousek
7b72ee47b9 syntax: Move setl foldtext to BufWinEnter autocmd
Vimwiki now resets fold{method,text} on BufWinEnter:

8d4cb7f11d/plugin/vimwiki.vim (L177)
8d4cb7f11d/plugin/vimwiki.vim (L325)

so we should do that as well otherwise we get overridden.

If the user actually configured vimwiki to use its folding, by setting
g:vimwiki_folding to something else than '' or 'custom', we should not
replace that. It would be nice if we could somehow augment
VimwikiFoldText and leave the rest intact, but we can't, so it's best to
keep off. Using foldmethod=syntax gets extremely laggy with just a few
hundreds of lines, so we must not force it.

Also, we now need to increase foldlevel in tests because the folding is
no longer being overridden in the default vimwiki configuration, so we'd
get closed folds in tests...
2020-12-18 17:55:09 -05:00
Tomas Janousek
792ca80a2b syntax: Move setl viewoptions to ftplugin
Doesn't belong in syntax, and shouldn't be set unless we need it for
mkview, so move it next to that mkview.

(BTW, it's a bit confusing that we use setlocal for a global option. Are
we hoping it's going to be made local one day? If not, we may as well
change it to `set` to avoid confusion.)
2020-12-18 17:55:09 -05:00
Tomas Janousek
2ab876a80a syntax: Move TaskwikiFoldText to autoload
Avoids useless reloading of the function. In practice, probably
harmless, but it doesn't belong there, and neither does setting
foldmethod/foldtext, and that is actually harmful (see further commits).
2020-12-18 17:55:09 -05:00
Tomas Janousek
94409fd372 requirements: Add six
None of our dependencies installs this for us any more.

(We should get rid of it, too.)
2020-12-18 17:49:10 -05:00
Tomas Janousek
6c3c299118 tests: Update test matrix
Python 3.5 is EOL since Sep 2020.
Python 3.9 is out since Oct 2020.
taskwarrior 2.5.2 is out since Dec 2020 (released only on GitHub though).

It's a bit stupid to have to update it manually, but until we figure it
out something better...
2020-12-18 17:49:10 -05:00
Nikolaos Kakouros
4fd11afda1 Shows uuid for tasks with no id 2020-10-01 15:56:06 -04:00
Tomas Janousek
377aac68ba tests: Do not load vimwiki/taskwiki twice in TestSelectAfterBufferSwitch
This was forgotten in 7d5b902c89.
(Found when writing the test in the previous commit.)
2020-09-23 02:18:46 -04:00
Tomas Janousek
d66a7b5b94 cache: Mark buffer as modified on push
When a (task)wiki file is opened, viewports are refreshed but the buffer
is not marked as modified and therefore a subsequent :xa doesn't update
the file. This is, IMO, undesired.

vim documentation for the 'modified' option:

    This option is not set when a change is made to the buffer as the
    result of a BufNewFile, BufRead/BufReadPost, BufWritePost,
    FileAppendPost or VimLeave autocommand event.  See |gzip-example| for
    an explanation.
2020-09-23 02:18:46 -04:00
Tomas Janousek
1e3ccb16f8 vwtags: Distinguish (tag kinds) between header, preset and viewport
For tagbar to correctly nest the tags, we need to remember kinds of
parent scopes as well. This wasn't done in the original taskwiki
implementation.
2020-09-23 02:03:47 -04:00
Tomas Janousek
07dc2b8ceb vwtags: Viewports/presets shown using their name only
In other words hide the parts behind `|`. Handle vimwiki links
correctly.
2020-09-23 02:03:47 -04:00
Tomas Janousek
91f98d54b3 tests: Add basic tests for vwtags 2020-09-23 02:03:47 -04:00
Tomas Janousek
b48123fd58 vwtags: Drop help and import from __future__
We don't need the help message as g:tagbar_type_vimwiki is set by
taskwiki itself, and as we're going to refactor this, maintaining the
help is extra work that makes little sense here.

The import isn't needed in python3.
2020-09-23 02:03:47 -04:00
Tomas Janousek
3cbf59e8ea vwtags: Revert to current vimwiki/utils master
The implementation that was here had several limitations:

* headers containing `[[vimwiki|links]]` are incorrectly marked as
  viewports

* headers/viewports nested below such headers aren't correctly nested in
  tagbar as they use `header:` to refer to their parent scope

* presets are marked as viewports, and viewports nested under presets
  don't correctly nest for the same reason as above

* the logic for marking headers/viewports as `i:inside` is incorrect,
  and the motivation for it is unclear

Let's revert to
6c419fba6f/vwtags.py
and then we'll add tests and implement support for viewports and presets
in a way that actually works.
2020-09-23 02:03:47 -04:00
Tomas Janousek
da3a1bbd8b main: Pass correct markup_syntax to extra/vwtags.py
Hardcoding 'default' defeats the purpose of having the parameter,
doesn't it?
2020-09-18 11:31:49 -04:00
Tomas Janousek
7b67d510cc cache: Get markup_syntax from vimwiki, drop g:taskwiki_markup_syntax
I don't see the point of forcing the user to select this manually in
both vimwiki and taskwiki.
2020-09-18 11:31:49 -04:00
Tomas Janousek
5807945a40 cache: Drop unnecessary decode_bytes invocations
These were made redundant in 61d0d89be9
but never dropped. It's time.
2020-09-18 11:31:49 -04:00
Tomas Janousek
92785f10f7 ftplugin: Minor cleanup 2020-09-18 11:28:39 -04:00
Tomas Janousek
94fe6ed8e8 ftplugin: Postpone initial refresh to better preserve folds
Vim preserves folds by writing line jumps into the view script, so it's
better to load this script with the original file contents and only then
refresh from taskwarrior. The folding is still often broken when the
buffer is updated, but that can now be considered a vim bug and may
perhaps one day be fixed (or even worked around, if one is persistent
enough). Loading the view after modifying the buffer is simply wrong,
that can never ever work.
2020-09-18 11:28:39 -04:00
Tomas Janousek
f3fe7aca21 ftplugin: Only load the python plugin once
This makes opening wiki pages significantly faster and also prevents
clearing the entire cache every time.
2020-09-18 11:28:39 -04:00
Tomas Janousek
b722c29f9e ftplugin: Make commands buffer-local
Consistency with vimwiki, less confusion/clutter.
2020-09-18 11:28:39 -04:00
Tomas Janousek
2942ba776d ftplugin: Use buffer local autocmds
* simplifies code a bit
* avoids triggering autocmds on *.wiki files outside of registered vimwiki
* prevents reordering of autocmds when switching wiki pages

The last bit is my main motivation: I need to add a BufEnter autocmd (to
~/.vim/after, not to taskwiki itself) and I'd love to rely on
`cache.load_current()` having been called already.
2020-09-18 11:28:39 -04:00
Tomas Janousek
d00234b60d ci: Don't hash TASK_DEVEL_SHA for tags (reuses old docker images)
This isn't really necessary but it seems cleaner anyway. :-)
2020-09-18 11:26:08 -04:00
Tomas Janousek
3498c51a46 ci: Simplify getting branch HEAD commit hash
This is simpler and more reliable/predictable:

"git ls-remote 'heads/'" doesn't return anything, while "grep 'heads/'"
returns all branches, so a taskwarrior push causes most docker images
(those that don't have any TASK_VERSION and fallback to the Dockerfile
default) to be rebuilt, not just the one that needs to be.
2020-09-18 11:26:08 -04:00
Tomas Babej
36652d1f9b
ci: Consider the HEAD commit hash for our cache test image tag
For the development branches of taskwarrior, caching 2.5.2 or 2.6.0 is
not sufficient since HEAD is still moving.

Build the tag hash based on the HEAD hash of the development branch in
question.
2020-09-18 02:19:40 -04:00
Tomas Babej
8353170200
util: Use tasklib.__version__ to determine module version
Importing pkg_resources module is notoriously slow, see [1,2]. Tasklib
module now provides __version__ attribute for an easy method of version
checking.

[1] https://github.com/pypa/setuptools/issues/510
[2] https://github.com/pypa/setuptools/issues/926
2020-09-17 23:04:33 -04:00
Tomas Babej
5032d0d74f
requirements: Bump required tasklib version 2020-09-17 23:04:32 -04:00
Tomas Janousek
a9af18203b tests: Fix build of psutil (required by pytest-xdist 2.0)
77e5fdfef9
2020-09-17 22:11:42 -04:00
Tomas Janousek
4b8ef36e69 README: Update GitHub URIs (fixes Coveralls badge)
Coveralls doesn't know that tools-life/taskwiki is the same repo as
tbabej/taskwiki so we need to update this. The rest redirects
automatically and is updated just for consistency.

Gitter room is still called tbabej/taskwiki.
landscape.io is probably dead but the badge still works so I'm not
touching that one either.
2020-09-17 21:58:54 -04:00
Tomas Babej
7a2b0d9ad1
docs: Add a note about spaces being mandatory around modstring operator 2020-08-02 18:17:43 -04:00
Tomas Janousek
29adb30f00 vwtask: Require spaces around --
There's -- in Google Drive URLs which I sometimes add to my task
descriptions.
2020-08-02 18:14:00 -04:00
Tomas Janousek
9d7d90192b syntax: Highlight priority in TaskWikTask{Active,Completed,…} as well
The more straightforward `containedin=@TaskWikiTaskContains`
unfortunately doesn't work as it actually means
`containedin=VimwikiListTodo,VimwikiTag,VimwikiEmoticons,…` and that
isn't what we want.
2020-08-02 17:56:21 -04:00
Tomas Janousek
8a8d22cd7a syntax: Allow regular vimwiki syntax in TaskWikTask{Active,…} as well 2020-08-02 17:56:21 -04:00
Tomas Janousek
30058188ac vwtask: Refactor apply_defaults
5bf0c89ae8 left a misleading comment in
the code:

                # If port was detected, break the search

            break

Refactor the code to make it clearer what's going on: we're looking for
the first parent header/preset/viewport of this task, and therefore we
always break. By separating the search and processing of the found
header/preset/viewport, we avoid the confusion.

Related: https://github.com/tools-life/taskwiki/pull/288
2020-08-02 17:52:55 -04:00
Tomas Janousek
13ee57540e tests: Refactor Dockerfile to multi-stage (more caching during development)
The previous refactor traded build step caching for smaller image size,
which in turn made fast caching of built images possible, and allowed us
to speed up CI builds. But almost any change in Dockerfile required full
rebuild of everything (vim & taskwarrior), so changes to the Dockerfile
became more painful.

This commit refactors the Dockerfile to use multi-stage builds, which
brings build caching back: vim & taskwarrior are built in separate
stages, which are cached step by step, and then the build artifacts are
copied into the main tests image and runtime dependencies are installed.

There's a catch, of course: --cache-from doesn't work with multi-stage
images unless the experimental BuildKit backend and its inline cache
export are enabled. This requires docker 19.03, which shouldn't be hard
to obtain but isn't installed by default on Travis CI.
2020-08-02 17:24:20 -04:00