Some vim-related things

Here are some things I have made, modified, or contributed to that make using Vim to edit Racket nicer:

I also wrote GitHub - benknoble/tmux-vim-demo: #lang for running scripted demos which is recommend by GitHub - countvajhula/qi-tutorial: An interactive tutorial for the Qi language. as a way to interact with the Qi tutorial, but can be used for just about any kind of CLI demo if you like tmux + Vim.

8 Likes

I would give you more than one like if I could!

vim-racket is one of the reasons I enjoy coding in Racket so much, and I'm also very thankful that you fix any issues so quickly. :slight_smile:

4 Likes

I should note that I'm standing on the shoulders of giants here: wlangstroth, the original author of vim-racket, did most of the work.

My contributions have been to update some mechanisms and keep the plugin active (the original repo hasn't seen any real activity, even on open issues and PRs, in some time). So if you're using vim and wlangstroth's version, consider switching, if only for a better support experience :slight_smile:

2 Likes

This is great. REPL support, asynchronous linting, syntax highlighting -- from the sounds of things, Racket support in Vim is quite mature! I'm curious about the features in vim-racket. Is that documented somewhere?

Btw, love this L33t ASCII logo but it overflows when the browser is a little zoomed in (am I the only one who zooms in on different applications? At this point I've reported zoom related issues on at least three different repos! Maybe I need to get my eyes checked.).

(And this right here is one of the many reasons I advocate using the term "symex" rather than "sexp" :man_facepalming:)

2 Likes

vim-racket isn't really well documented. It could use some, at least for the overridable variables.

1 Like

Uh, yes. That's from the original… I'll consider removing it. I don't think the original sees much activity, and I've diverged so much, that remaining "close enough" to aid merging upstream changes isn't really worth it.

1 Like

I love the overflow :smile: Concerning the word "sexp", I find it weirdly confusing and pleasing at the same time :smiley: It's the kind of word you feel free to use with friends and connoisseurs, but with which you aren't really comfortable with strangers.

1 Like

I was wondering what 'symex' meant. much less cumbersome than s-exp.

1 Like

Well, actually:

The "S" in "s-expression" does not stand for anything like "symbolic". It merely alludes to an open paren above a close paren, which resemble the shape of an "S".

(
)
S

-- The History of Lisp: Imaginary, Silly, and Terribly Wrong Edition

:grinning_face_with_smiling_eyes:

6 Likes

I have my own binding for ] which automatically chooses whether to insert ) ] or }, like in DrRacket. Do you have something like that already? If not, I could post mine.

3 Likes

@plane please share! I may incorporate something like that (gated behind an option); if I do, I'll credit you as the commit author (plane · GitHub, right?).

Do you use that mapping for all your languages or just Racket?

1 Like

I may incorporate something like that (gated behind an option); if I do, I'll credit you as the commit author (https://github.com/plane, right?)

Yep, that's me! As far as I'm concerned, you can do whatever you want with this file. Part of the function is taken from Bram Moolenaar's matchparen.vim, though, so it probably inherits his license.

Do you use that mapping for all your languages or just Racket?

I have it mapped globally, actually.

1 Like

Part of the function is taken from Bram Moolenaar's matchparen.vim , though, so it probably inherits his license.

Ah, yes, the Vim license. OK, I will link to this gist from vim-racket, then, and try it out :slight_smile:

I have it mapped globally, actually.

Fascinating! I'm considering trying it but with ), ], and } all mapped to it. I imagine it would get in the way if you ever wanted to type unbalanced parens (happens), but a simple <C-v>CLOSER should suffice there.

My own versions are Dotfiles/rparen.vim at master · benknoble/Dotfiles · GitHub, Dotfiles/rparen.vim at master · benknoble/Dotfiles · GitHub

1 Like

Anyone using Vim & Racket: your input on treat {} like () and [] when indenting lisp by benknoble · Pull Request #10833 · vim/vim · GitHub is appreciated. Share with me to pass along or directly on GitHub.

2 Likes

Using neovim with plugins

call plug#begin()
"--------------------------------------------------------------------
" Vim Script
Plug 'nvim-tree/nvim-web-devicons'

Plug 'benknoble/vim-racket'
Plug 'neovim/nvim-lspconfig'
Plug 'idanarye/vim-dutyl'
Plug 'landaire/deoplete-d'
Plug 'preservim/tagbar'
Plug 'ervandew/supertab'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }
Plug 'dense-analysis/ale'
Plug 'junegunn/vim-plug'
Plug 'nvim-lualine/lualine.nvim'
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
Plug 'preservim/nerdtree'
Plug 'Olical/conjure'
Plug 'airblade/vim-gitgutter'
Plug 'guns/vim-sexp'
Plug 'hylang/vim-hy'
Plug 'junegunn/fzf'
Plug 'liuchengxu/vim-better-default'
Plug 'norcalli/nvim-colorizer.lua'
Plug 'akinsho/toggleterm.nvim', {'tag' : '*'}
Plug 'nvim-tree/nvim-web-devicons'
Plug 'romgrk/barbar.nvim'
Plug 'ncm2/float-preview.nvim'
call plug#end()

While entering text in drracket errror message are shown during i type.
Not with neovim ?

I'm assuming you use ALE for Racket, since I don't know anything about "LanguageClient" or some of the other plugins, and I don't use NeoVim.

In that case, note that ALE works best when you have raco pkg install racket-langserver; otherwise, it checks code through raco expand (which can only be done for saved buffers). It's still not necessarily the speediest experience, though.

1 Like