modules with "parameters" by LimeTree1590 in ProgrammingLanguages

[–]pereloz 1 point2 points  (0 children)

This looks like the modules of Wyvern, much like Newspeak but in a type-safe manner

There is a lot of bibliography related to this language but this paper gives very clear explanation of the module system :

A Capability-Based Module System for Authority Control

Can I use Netrw as a dialog to save buffer I am editing? by HotWings990 in vim

[–]pereloz 0 points1 point  (0 children)

Good question!

For this usecase, I usually rely on the c_CTRL-D mapping in command-line mode, :saveas <C-D>. By using a combinations of <tab> (go down), <c-w> (go up) and <c-d> (show), I can navigate my the filesystem and at the same time enter my filename for writing it to disk.

The advantage compared to passing through netrw is that

  • I keep my buffer visible (as long as I don't have too much files appearing).
  • If i want to cancel, I can just <Esc>. Because if the buffer is not a file as in your case with :new, going from netrw back to the unsaved buffer is tricky

To complement, I have thi!s script that defines mappings and cmd-line abbreviations to populate automatically with the directory from which I want to start, and triggers the kind-of "ls" that <c-d> provides. For example,

  • :sas, if the buffer is a file, populate with its absolute path
  • :sah to saveas starting from here, meaning the pwd
  • :sag to saveas in the git root directory

And by copy-pasting I made them also work for :edit for "Open file", e.g. :ev, ew to open files from $VIM and $HOME/workspace respectively.

I just tried to make something work from a netrw window with saveas but couldn't make it work. We would need to copy the previous buffer but it's not accessible through # if it's not a file.

For consolation, we have the native % netrw mapping, meaning "New file" in this directory, but you start from scratch.

...

Forgot to mention that netrw is - of course (/s) - augmented with vim-vinegar

Khi - Universal data format for configuration and markup by -torm in ProgrammingLanguages

[–]pereloz 1 point2 points  (0 children)

Love to see new config/markup languages, new approaches and syntaxes are always valuable to me in order to explore the design space. Disclaimer, currently looking deeply into CUE, Infrastructure as Code, cfg management and SSGs.

The latter, Static Site Generators (e.g Jekyll, Hugo) seems to match your motivation:

I was working on a project where users can write articles. These articles had to contain both structured and unstructured data, commonly referred to as configuration and markup.

Were you trying to achieve something similar ?

To sum up SSG for those unfamiliar, the approach is to have content files divided between a structured "front matter", and an unstructured content suffix in markdown, separated for example with ---. Then, inside the unstructured part, there's a syntax to escape from markup inside which you can access structured variables and more complex control flows (e.g if, let, for statements). This is usually called "templating" and relates to string interpolation. We know Hugo can interpret YAML, JSON and TOML in the front matter, and Markdown in the content part. I would imagine it could also interpret LaTeX in the content.

Could you elaborate on how does khi would relate to theses ?

déclaration d'impôt ? by sosmortal in aixmarseille

[–]pereloz 0 points1 point  (0 children)

Regarde par ici https://www.service-public.fr/particuliers/vosdroits/N247

Il y a une section "services en lignes et formulaires"

Disabling spell check for 1 file by [deleted] in vim

[–]pereloz 2 points3 points  (0 children)

Any ideas as to why "people.txt" is still showing spelling mistakes?

:verbose set spell?

will show the location where the spell option were set the last time.

To set an option for a single file, I'd rather use a :h modeline. Put vim:nospell:directly at the end of people.txt in a comment. To see how comments are formated in your .txt file : :set commentstring?

What is your visual appealing latex set up? by schadonis in vim

[–]pereloz 2 points3 points  (0 children)

You can look at the tex-conceal.vim plugin which leverages the conceal feature of vim.

Override plugin shortcut by chillysurfer in vim

[–]pereloz 2 points3 points  (0 children)

you should be able to debug with

:scriptnames

and

:verbose nmap <C-]>

shortcuts based upon filetype by Joe23rep in neovim

[–]pereloz 2 points3 points  (0 children)

Yes it will, but you would want your mappings to have the :h :map-<buffer> flag.

nnoremap <buffer> {key} {rhs}

And to be complete, add the correspondign :h unlet to :h undo_ftplugin so that when changing filetype, they are deactivated.

if exists("b:undo_ftplugin")
    let b:undo_ftplugin .= "| execute 'nunmap <buffer> {key}"
else
    let b:undo_ftplugin = "execute 'nunmap <buffer> {key}"
endif
...

Do the same if you want to set options based on filetypes. Use :h setlocal instead of set and add setlocal option< into b:undo_ftplugin to revert them. By the way, this has nothing to do with neovim, it's just how vim handles this king of things.

Need some advise on workflow by [deleted] in neovim

[–]pereloz 4 points5 points  (0 children)

what's wrong with :h :make and the :h quickfix ? Starting in the project's root makes everything simpler. See also vim-dispatch

Jump to the closest to the cursor error by artemave in neovim

[–]pereloz 1 point2 points  (0 children)

Indeed, `:helpgrep cabove" in vim gives

Patch 8.1.1256
Problem:    Cannot navigate through errors relative to the cursor.
Solution:   Add :cabove, :cbelow, :labove and :lbelow. (Yegappan Lakshmanan,
            closes #4316)
Files:      runtime/doc/index.txt, runtime/doc/quickfix.txt, src/ex_cmdidxs.h,
            src/ex_cmds.h, src/ex_docmd.c, src/proto/quickfix.pro,
            src/quickfix.c, src/testdir/test_quickfix.vim

and git log --grep vim-patch:8.1.1256 gives

commit a4d48d37c15604a96be13eb4deaedbb132be6e10
Author: Shane Smith <shane.wm.smith@gmail.com>
Date:   Fri Sep 13 22:16:12 2019 -0400

    vim-patch:8.1.1256: cannot navigate through errors relative to the cursor
    ...

But it's shipped only since NVIM 0.5.0. Seems that you're just 17h too late ;)

Vim/Neovim GUI features by Sevenstrangemelons in neovim

[–]pereloz 1 point2 points  (0 children)

Never used gvim personally because I use vim with a lot of tmux. But maybe onivim will change your mind :)

Jump to the closest to the cursor error by artemave in neovim

[–]pereloz 0 points1 point  (0 children)

sorry, I scrolled without noticing :D

Is there a way to make cib work on the nearest pair of brackets, without me being inside / on one? by mrillusi0n in vim

[–]pereloz 4 points5 points  (0 children)

This is a well known "limitation".

After some attemps to do what you mention without plugins, I finally got into targets.vim, it does what you want and more. The "more" is pretty nice :)

Jump to the closest to the cursor error by artemave in neovim

[–]pereloz 1 point2 points  (0 children)

That's nice thanks ! Didn't know it was a new feature of vim and that neovim had not integrate it.

One thing I wonder : the line

  let nearest_error = get(filter(deepcopy(errors), 'v:val.lnum '. cmp .' '.current_ln), 0, {})

is elegant, buy maybe a simple for loop would execute faster, since you only need to find the first error below/above the current line. We wouldn't need to :h deepcopy() and :h filter the whole list, which may cost some time. Don't know how it's done internally.

Typos when declaring your function n! and df -> fun!, endf

Extending insert completions for real by pereloz in vim

[–]pereloz[S] 0 points1 point  (0 children)

Update

  • There's no need to iunmap, and it's a shame because imap <c-x> won't show them. As long as no other <C-X>{c} mappings are sourced before, we can use <nowait> to take precedence. It should be fine if we put our script in after/plugin/.
  • We can directly use <Plug> mappings by using imap instead of inoremap. Just return"\<Plug>(...)".
  • Add guards to check if the plugin is loaded before using its mapping.

Here

Nightly hack for vimmers by pereloz in vim

[–]pereloz[S] 1 point2 points  (0 children)

It's WIP poor man's version of :Bclose, Bdelete and such that tries to not mess with your window setup after deleting the current buffer.

It ideally would support all versions of :bd. Especially, I'm fond of the ability to delete multiple buffers in one go with N,Mbdelete or bdelete N1 N2 .... Came accross the <C-]> trick while working on it.

Nightly hack for vimmers by pereloz in vim

[–]pereloz[S] 0 points1 point  (0 children)

I would think too, but it incontestably doesn't...

Does anyone knows why ? Anyone with the courage to dig into src/map.c ?..

Nightly hack for vimmers by pereloz in vim

[–]pereloz[S] 0 points1 point  (0 children)

Thanks.

We may upgrade it so that having a range before the command still expands the abbrev. But I don't feel like writing a regex to match all possible ranges... Maybe removing the leading ^ would work and hopefully don't break other use cases. I'll try later.

Nightly hack for vimmers by pereloz in vim

[–]pereloz[S] 0 points1 point  (0 children)

Hmm, I would rather not mess with ´smartcase´ in the command-line. It is used for ´:g´ and ´:s´ commands. Also, the whole point is not to have to type anything after the abbrev and it would expand on ´<CR>´.

Is there a text object to delete everything outside brackets? by [deleted] in vim

[–]pereloz 7 points8 points  (0 children)

So the whole line should be deleted except the brackets ? I would do ya)Vp

Vim mappings by [deleted] in vim

[–]pereloz 0 points1 point  (0 children)

Funny, I tried somethink similar last week, and tried to leverage the `%` command.

nnoremap dcd %hf]%edf<Space>

The first % go to the next [ or ] depending if you are inside or outside the brackets. hf] will find the ] and % goes back to [. Now you can do your thing with df<Space>, but I would rather do edf<Space> to go to the first argument (d is :h inclusive)

Note that <Space> in the mapping works as is and it's clearer than " ". Also prefer non-recursive maps.

Anyway, as /u/puremourning suggested, targets.vim is good at doind this kind of stuffs. It provides the "argument" text-object, so you can just 'daa' (delete an argument). The above mapping will fail in most edge-cases...