GithubHelp home page GithubHelp logo

agda-vim's People

Contributors

andrejtokarcik avatar anthonyquizon avatar derekelkins avatar diskshima avatar favonia avatar isovector avatar isti115 avatar jesyspa avatar jhenahan avatar louisswarren avatar mb64 avatar raichoo avatar rwe avatar sanderr avatar taqenoqo avatar victortaelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agda-vim's Issues

Python plugin

Sorry to be communicating through an issue, but I haven't been able to find another way to get ahold of you. I'm one of the developers of Idris, which has just gotten support for Agda-style semantic highlighting. I'd like to help the authors of the vim mode for Idris support semantic highlighting like you have for Agda, but I can't seem to find the Python code that does the highlighting.

Would it be possible to put it in the repo or link to it? Or am I just overseeing the code?

Make Agda usage (or at least Agsy usage) asynchronous

Using something like vimproc may(?) provide a mechanism to avoid the UI becoming unresponsive for long running commands (in particular auto).

Vim 8 has added some asynchronous I/O functionality, so it may be possible to do this without any plugin.

Extend the utf-8 file

I've come across this list of symbols: http://people.inf.elte.hu/divip/AgdaTutorial/Symbols.html
Would be nice to have them available.

I started searching for them because I needed the blackboard P. But this list lacks it, too.

Also, I think it would be nice to rewrite the file a bit, so it could be used for taking math notes. Similar to:
https://github.com/dpiponi/math-vim/blob/master/math.vim
The reason I want to use agda-vim's file is that I don't want to learn yet another set of mnemonics.

Right now, I can just :source the file, but there's no way of turning it off (besides exiting Vim).

How do you fill about these two things? If it continues bothering me, I might submit a patch.

(Seemingly) fail to handle multiple responses from Agsy

I noticed that when Agsy seems to synthesize solutions to multiple holes (possibly due to some hole being a parameter to the type of another hole), agda-vim appears no be surprised and may put the generated terms into wrong holes or ignore some of them. (Sorry I have not spent the time debugging, verifying the raw output from Agsy or studying the relevant code.)

Cannot resize buffers with C-w =

VIM - Vi IMproved 7.4

The special agda-vim buffers (where errors are shown, etc.) are not affected by C-w =, so I need to do C-w o followed by , l to resize them, which is very inconvenient.

Hangs on Windows when opening agda file

The plugin runs perfectly for me under linux, but when I install it under Windows (I tried with vim and neovim as well) it freezes as soon as I open an agda file. I tried to look into the logs, but it seems like the freeze is so sudden, that those do not even get written to disk completely.

Do you have any idea about how I could debug this?

Mixfix declaration gets rewritten as a prefix one

Agda version 2.4.2.4
VIM - Vi IMproved 7.4

Thanks for making it possible to write Agda in vim! Hitting a bunch of problems trying to follow the screencast tutorial, though. Here's one.

Before:

if_then_else : {A : Set} → Bool → A → A → A
if b then t else e = ?

After hitting ,c b:

if_then_else : {A : Set} → Bool → A → A → A
if_then_else true t e = {!   !}
if_then_else false t e = {!   !}

Note that in the screencast it does work correctly.

Error: First load the file.

I've installed agda-vim by cloning the repository to ~/.vim/bundle. I've also edited .vim/filetypes.vim and .vimrc as explained on the README. When I open an Agda file, it seems to recognize the extension: I'm able to type special characters and call the commands. But when I press, for example, ,t, and then enter an expression (such as ), I get the following error: Error: First load the file.. I'm using the following file:

module Hello where

  data ℕ : Set where
    zero :suc :_+_ : ℕ
  zero + m = m
  (suc n) + m = suc (n + m)

What does that mean?

Input problems: lags after pressing the spacebar, unicode input

Agda version 2.4.2.4
VIM - Vi IMproved 7.4

I can't figure out how to quickly type text while use agda-vim. In addition to that, I'm having trouble with unicode input.

let mapleader      = ","
let maplocalleader = ","

For example, if I try to type

if_then_else_ : {A : Set} → Bool → A → A → A

normally (like I'd do in the usual Insert mode), I'll get something like this:

if_then_else_∶ {A∶Σet}→> Bool→> A→> A→> A

(the arrows are inserted as -> here).

It seems I need to wait for something to timeout to type normally, so if I try the same slowly while waiting a few seconds after each space, I get this:

if_then_else_ : {A : Set} -> Bool -> A -> A -> A

This looks better, but still unacceptable for normal usage. And the arrows are in plain text. Hitting space twice works sometimes, but it also may actually insert two spaces, e.g., between : and {A:

if_then_else_ ∶  {A

So my current way of doing it is to use double space while keeping in mind that the space character is inserted automatically before { and after \to. I still need to wait a bit while typing Set (or I'd get Σet), though. Can I do better?

Goal not loaded when {! !} in comments.

In the code:

{-
{! !}
-}

id :  {A : Set}  A  A
id = ?

If I try to refine or autocomplete ? (with <LocalLeader>r or <LocalLeader>a) I get "Goal not loaded".

(By the way, thanks for this mode. It's awesome!)

regexp bug, using spf13-vim

Hi,

I encountered the following issue which seems to be a bug in the regexp somehow? I am using spf13-vim as a vim distribution.

Error detected while processing /home/edward/.spf13-vim-3/.vim/bundle/vim-addon-agda/syntax/agda.vim:
line 23:
E874: (NFA) Could not pop the stack !
E475: Invalid argument: agdaOperator "\v(^|\s|[.(){};])@<=(let|in|forall|λ|→|->|:|∀|=|||)($|\s|[.(){};])@="

Kind Regards,
Edward.

Load times slower than emacs mode

Issue

After noticing that agda-vim has slower load times than the official emacs mode, I decided to try to figure out why. After some tests, I think the calls to make and AgdaLoad are doing duplicate work.

Tests

I originally posted an issue in the official agda repository with some tests, before I realized this issue was specific to agda-vim. When measuring the load time of one of the files (B.agda), I find that:

  • agda-vim takes about 6s for the initial load, and 3s for reloads (without changing the buffer).
  • agda2-mode.el takes about 3s for the initial load, and virtually no time for reloads.

When agda-vim initially loads, it calls AgdaReload near the bottom of ftplugin/agda.vim. This command calls make, after which the QuickfixCmdPost autocommand defined near the top of the file is triggered, which calls AgdaReloadSyntax, AgdaVersion, and AgdaLoad. By calling these commands manually, one by one, we get a sense of which commands are taking up time:

  • make (about 3s)
  • `AgdaReloadSyntax (fast)
  • AgdaVersion (fast)
  • AgdaLoad (about 3s)

On subsequent reloads (without changing the buffer), the AgdaLoad call takes virtually no time, so the call to make takes most of the time.

Workaround

I tried making the following adjustments:

  • At the bottom of ftplugin/agda.vim, replace AgdaReload with call AgdaVersion(1) | call AgdaLoad(1). (I am not sure why, but leaving out the call to AgdaVersion results in an error.)
  • To reload Agda, type :AgdaLoad(0) instead of using AgdaReload.

These result in load times comparable to the emacs mode, with the following tradeoffs:

  • The quickfix list is not populated.
  • The syntax highlighting information produced by agda is not used.

Thoughts

Could the make call be removed entirely without sacrificing features? It would be possible to populate the quickfix list just by scanning the buffer for patterns like {!!} and ?. (It wouldn't include the unresolved implicit arguments, but I personally don't like these appearing in the quickfix list anyway.) It might also be possible to recover the syntax highlighting.

If not, maybe it would make sense to include an option, so users can choose whether to sacrifice load times for these additional features.

Support Agda 2.6.0

FWIW, I've tried 2.6.0 from upstream, but agda-vim gives me

Error: Choose at most one: input file or --interaction.

Note that I'm on a weird system (NixOS/nixpkgs#15617), so it might work differently somewhere else.

As of Agda 2.5.3-alpha1, agda-vim doesn't work

I get "Goal not loaded" for everything after upgrading to 2.5.3-alpha1. I also tried HEAD which is 2.6.0-d1a6e83-dirty. That also doesn't work. Here's an example:

module Example where

data  : Set where
  zero :succ :f : ℕ
f a = ?

Is this an issue with Agda (their CHANGELOG doesn't mention changes to --vim option) or with the plugin?

Normalize doesn't seem to do anything (Agda 2.6.0.1)

Not sure if this is because the Agda version is too recent. When entering an expression for AgdaNormalize, nothing happens. Typing in gibberish doesn't return an error and entering a valid expression doesn't produce any output either.

Python 3 Support

Hi,
I tried to implement python3 support for your plugin as my vim has no python2. You can have a look at https://github.com/tc-0/agda-vim. I do not want to open a pull request as the code is only tested on a single example (a case distinction with unicode symbols) and I actually have no clue of agda whatsoever but wanted to learn a bit of it with your plugin.

I hope you can do something useful with the code.

Commands not loaded (neovim)

I am just starting to use Agda, so I appreciate your patience.

I am using neovim and packer, and packer shows that I've loaded the package and the file type is set to agda. However, none of the commands are loaded, i.e. I can't run :AgdaVersion or :AgdaLoad -- these all return E492: Not an editor command AgdaLoad or the equivalent.

However, unicode commands like \B return the beta character, etc. So it seems the translations work. Other releavant info:

Void Linux, Kernel 6.1.3_1
Neovim 0.8.2
Lua 5.2.4
Agda path: ~/.cabal/bin/agda
Agda 2.6.2.2

Thank you very much.

Filename not matching module name leads to obscure errors

I was following the example from your demonstration video (https://youtu.be/i7Btts-duZw?t=96). As my very first attempt to use this plugin, I entered the following text into a file:

module demo1A where

data Bool : Set where
  True : Bool
  False : Bool

if_then_else_ : {A : Set} → Bool → A → A → A
if b then t else e = ?

I reloaded Agda via \l, navigated my cursor to the ?, and typed \c. This gave me a Goal not loaded error. I tried a few other commands (\a, \r, \t) and they all failed with the same error. I was going to give up and assume that the passage of time had caused it to break, but on a whim I tried renaming the file from try.agda to demo1A.agda ... and then it worked.

Since I'm just starting to learn Agda, I didn't know about any assumptions it might make regarding mappings between module names and file names (but I guess I do now!) It would be nice if this plugin would give a more useful error message in the case of this kind of failure.

Any chance of some documentation?

With Agda 2.3.2 I tried making a hole with '?'. I can use "Metas" and it tells me "?0 : Set" (say) so it seems to have parsed it correctly as a hole. But if I use ",g" or ",a" while the cursor is above the hole I get "Goal not loaded". What did I do wrong? (It's all working in emacs but I'd prefer vim.)

Support for `*.lagda.md`?

Thank you for this awesome plugin. It saves vimmers like me from "evil" emacs 😃. It would be awesome if this plugin works with *.lagda.md as well. However my vimscript-fu is weak. I could not figure out how to make it coexist with other mardown plugins. Could you help me?

Unclear Instructions

Can you provide better instruction to use this :

After copying all files to the .vim folder add to filetypes.vim.
au BufNewFile,BufRead *.agda setf agda

This Link (http://wiki.portal.chalmers.se/agda/pmwiki.php?n=Main.VIMEditing
) says add to filetype.agda

filetype ?? filetypes ??

I have gone for automatic loading of syntax .

Error detected while processing /home/mokambo/.vim/syntax/agda.vim:
line 8:
E127: Cannot redefine function ReloadSyntax: It is in use
E127: Cannot redefine function ReloadSyntax: It is in use
E127: Cannot redefine function ReloadSyntax: It is in use
E127: Cannot redefine function ReloadSyntax: It is in use
E127: Cannot redefine function ReloadSyntax: It is in use
E127: Cannot redefine function ReloadSyntax: It is in use
E127: Cannot redefine function ReloadSyntax: It is in use

agda.vim :

function! ReloadSyntax()
syntax clear
runtime syntax/agda.vim
let f = expand('%:h') . "/." . expand('%:t') . ".vim"
if filereadable(f)
exec "source " . escape(f, '*')
endif
endfunction

call ReloadSyntax()

map ,rs :call ReloadSyntax()

Thanks.

Some commands don't work: "E129: Function name required"

Agda version 2.4.2.4
VIM - Vi IMproved 7.4

Trying the example for the screencast. Hitting ,g in normal mode while having the cursor on t (inside the {! !}), gives me E129: Function name required.

if_then_else_ : {A : Set} → Bool → A → A → A
if true then t else e = {! t !}
if false then t else e = {!   !}

agda stdlib permission errors

agda-vim appears to be trying to open stdlib files in the same way it does other source files. This means it tries to create .SomeLibrary.agda.vim files in a priviliged directory.
A line open import Data.Nat results in the below error:

/usr/share/agda/lib/stdlib/Data/Nat/Base.agda|9 col 8 error| /usr/share/agda/lib/stdlib/.Level.agda.vim: openFile: permission denied (Permission denied)

Normalize broken for Agda 2.5.3

The Normalise() function seems to be broken for Agda 2.5.3.

I've temporarily fixed this by changing the version number in line 459 (ftplugin/agda.vim) to

if compareVersion([2,5,3,0], agdaVersion, operators.lt):

This seems too small for a pull request, and might not be the best solution, so I've stuck it here.

Python being parsed as Vimscript

When I open up an Agda file in Neovim with agda-vim, I immediately get this:

"AgdaBasics.agda" 5L, 76C
Error detected while processing /home/tom/.vim/plugged/agda-vim/ftplugin/agda.vim:
line  121:
E488: Trailing characters: # start Agda
line  133:
E133: :return not inside a function
line  137:
E133: :return not inside a function
line  151:
E133: :return not inside a function
line  193:
E133: :return not inside a function
line  194:
E133: :return not inside a function
line  202:
E133: :return not inside a function
line  241:
E10: \ should be followed by /, ? or &
line  285:
E133: :return not inside a function
line  293:
E133: :return not inside a function
line  295:
E133: :return not inside a function
line  302:
E133: :return not inside a function
line  306:
E133: :return not inside a function
line  309:
E133: :return not inside a function
line  507:
E170: Missing :endfor

This lines of code are in the Python bit of agda.vim, so it looks like Neovim is parsing the Python as Vimscript. Do you know why?

Thanks,
Tom

warns when edit from other directories

For example, if there is already a written file localed at ~/foo/bar/name.agda and edit
with ~/foo/$ vim bar/name.agda, it complains

"~/foo/bar/name.agda" 5L, 80C
/home/user/foo/bar/name.agda:1,8-19
The name of the top level module does not match the file name. The
module name should be defined in one of the following files:
  /home/user/builds/agda-stdlib/src/name.agda
  /home/user/builds/agda-stdlib/src/name.lagda
  /usr/share/agda/lib/prim/name.agda
  /usr/share/agda/lib/prim/name.lagda

Ability to disable the insert-mode \ unicode entry

If this feature is already present, I have not found a way to disable it, but I am hoping to do some literate programming in agda (which uses latex). The result is that I will be typing regular old \ a lot and the unicode entry is incredibly bothersome for that.

I already have a very full XCompose set up and I would much prefer to use that. Is this feature already available? If so, how does one disable it? If not, any chance that you will see fit to add it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.