by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Shalabh Chaturvedi
@shalabhc
To get to the current buffer, you need to evaluate this expression howl.app.editor.buffer
image.png
Now you can type this expression in any buffer and eval it, you should see:
(For evaluating a single line, you don't need to select it)
Next step is to insert something at this buffer, this worked for me howl.app.editor.buffer\append('\nhello').
Of course this appends to the end of the buffer. If you want to insert at the cursor position, lets look at the Editor API
Shalabh Chaturvedi
@shalabhc
The Editor is the UI object that displays a Buffer (which represents the underlying document). The cursor and other edit controls are part of the editor. It has an insert method that inserts text at the cursor.

To get the editor you just need howl.app.editor, so this code works for me:

howl.app.editor\insert('hello')

This inserts text at the cursor position

OK, so to finally make it a command:

howl.command.register
  name: 'type-hello'
  description: 'types "hello" at cursor position'
  handler: -> howl.app.editor\insert('hello')

Note that you can just select this snippet in your editor and eval it, the command is immediately registered.

Type alt_x and press tab, start typing type-h and you should see the command. You can run it too.

Finally, let's give it a shortcut:

howl.bindings.push
  f3: 'type-hello'

Now f3 should invoke your new command. Hope this works.

To replace a registered command, just eval a new 'register' definition again with new code. Once you are happy with your snippets, move them to init.moon.
Shalabh Chaturvedi
@shalabhc
Side note: you can use the buffer API to insert text too using insert(text, pos). Since it takes the position, you need to get the cursor position howl.app.editor.cursor.pos and pass it in.
Clickability is not implemented yet but something I've wanted. You'd need to modify the Aullar View I think (which is the underlying implementation for the Editor API), but I haven't looked too much into it. Ideally it would be integrated with the marker API. Markers are segments of text in a buffer, that may be highlighted or decorated or just have hidden data attached to them. I don't think the API has docs but you can see test code examples here: https://howl.io/doc/spec/buffer_markers_spec.html
So the idea would be: have markers be clickable and let the API accept a handler function function.
(Aullar View is here lib/aullar/view.moon)
Shalabh Chaturvedi
@shalabhc
Python autocomplete is not in any repo. I have a half finished implementation of the lang server protocol which would be very useful for Python and other languages.
Thanks for the kind words on HN!
tastyminerals
@tastyminerals
Hey, I am looking into howl/bundles and see a great collection of supported languages. However, D is not there, how come? There is rust, go -- understable, even nim and zig but no D makes me sad.
Shalabh Chaturvedi
@shalabhc
See also https://github.com/howl-editor/howl/wiki/Howl-Bundles#language-bundles - but you're right - no D there either. I think rust and go were mainly community contributions, IIRC? It's just that nobody has contributed D yet. A basic D mode for syntax only would not be that hard, but I'm not that familiar with D. I wonder if we can make it super easy to get the syntax highlighting going for a new language.
Wolf480pl
@Wolf480pl
Hello. Is there a way to make Howl treat newline as a word boundary for the purpose of cursor-word-left and editor-delete-back-word?
Wolf480pl
@Wolf480pl
nvm, I just monkey-patched howl.ui.Cursor.__base.word_{left,right}, seems to do the trick
Damian Gaweda
@dgaw
There hasn't been a lot activity around Howl lately. I hope you guys are well!
For anyone looking for a "Go to definition" command: howl-ctags. I'm the author of this bundle. Let me know your thoughts if you try it out!
Shalabh Chaturvedi
@shalabhc
Hi @dgaw I'm doing well. Just busy with staying at home with kids, etc. Sorry I know there's a long pending PR - the folder search.
Wolf480pl
@Wolf480pl
Question: if I'm gonna be monkey-patching more of howl's methods, should I work somehow on upstreaming my changes or making the behaviour configurable, so as to avoid future howl changes breaking my customizations?
Shalabh Chaturvedi
@shalabhc
What are you patching?
Wolf480pl
@Wolf480pl
eg. howl.ui.Cursor.__base.word_left
to make it not skip beginning of line
also, I'm replacing local instance_for_mode in howl.mode (by means of debug.setupvalue) to make word_pattern a config variable
it's cursed, but it works
TmpFinger2
@TmpFinger2

Is there an easy way to get Buffer- or Editor-local key bindings, like in other text editors?
I'm writing a language bundle, and its key bindings can only work for a few select languages.
Right now the keymap is global, and I get error messages when I use those keys in other files.
(The bundle "hijacks" keys like delete, backspace, enter...)
Even if I only push the keymap when a specific mode is activated, the issue will still be there if I have more than one file opened.

The only ways (that I can think of) to achieve similar effect is to either

  • inspect Editor.buffer.file.extension from within the key handlers and, if not the right one, let the key event propagate further , or
  • register handlers for the *-buffer-switch and editor-*focused events, and proactively push/remove the keymap from the bindings stack.

One of these will probably get me what I want, but it looks like too much work, compared to what I've used in other editors.

I read the modes docs, and it seems like they can't help either.

So, again, is there an easier way?

TmpFinger2
@TmpFinger2
Paul Cooper
@lucidmotifs_gitlab
Hi guys I'm having an issue getting bundles to work currently
I made 3 themes for work when i was using fedora a month ago, I'm on manjaro now and the themes simply won't appear when using alt+x + set theme
i have placed the files in in ~/.config/howl/custom_themes AND ~/.howl/bundles/custom_themes/
Damian Gaweda
@dgaw
@lucidmotifs_gitlab The correct path is ~/.howl/bundles/custom_themes. Make sure your bundle contains an init.moon file where you register your themes.
Paul Cooper
@lucidmotifs_gitlab
just in case anyone is curious, the problem I mentioned above can be caused by using a Flatpak version of Howl and then having bundles in both ~/.config/howl/ and ~/.howl/
Ignoring /home/paul/.config/howl in favour of /home/paul/.howl
Ignoring /home/paul/.config/howl in favour of /home/paul/.howl
stack overflow
etc
Cristian Molina
@megatux
Hi! could someone help me to configure the comment command key binding?
Ctrl+/ don't work here
can't find it on describe-key command neither
Damian Gaweda
@dgaw
@megatux That's strange. Ctrl+/ should work by default. Try adding this to your ~/.howl/init.moon file:
bindings.push {
   editor:
      ctrl_slash: 'editor-toggle-comment'
}
Cristian Molina
@megatux
oh, that "editor:" was the thing it was missing, this works howl.bindings.push { editor: ctrl_shift_slash: 'editor-toggle-comment', ctrl_7: 'editor-toggle-comment' } ctrl_slash is not recognized
Thanks!
Cristian Molina
@megatux
Another question: how do I configure line wrap (for current buffer or globally) ?
Cristian Molina
@megatux
Found it, set line_wrapping ... :+1:
Cristian Molina
@megatux
Is there any bookmark support? maybe with a plugin?
Cristian Molina
@megatux
Hi again...is there a way to do multi-line edit? I think it's not possible and there is an issue #272 for this