* Vim helper config for Guix
@ 2024-04-04 6:43 Efraim Flashner
2024-04-29 13:36 ` Andreas Enge
0 siblings, 1 reply; 2+ messages in thread
From: Efraim Flashner @ 2024-04-04 6:43 UTC (permalink / raw)
To: guix-devel, Christina O'Donnell, Steve George
[-- Attachment #1.1: Type: text/plain, Size: 1163 bytes --]
I've been meaning to upstream my guix.git specific vimrc config file,
like the .dir-locals.el in the repo. It is architected so that it also
works in git worktrees.
jump-to-definition works with C+]
If you have guix.vim installed then :Guix defaults to using
./pre-inst-env guix from that worktree.
opening new files ignores the .go files when tab completing
Most of the line indentation works pretty well. Vim, by default for lisp
languages, hardcodes an indent as 2 spaces, and I haven't gotten around
to learning how to write an indentexpr to make it work for guix. As a
result some of the indentation is close but not quite correct, and there
are some cases where the indentation is straight up ignored. I think
that's the case inside g-expressions, but I don't remember.
I've also included a link to my vimrc¹ if anyone wants to see what I
have there.
¹ https://git.sr.ht/~efraim/guix-config/tree/master/item/vim
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #1.2: vimrc.guix --]
[-- Type: text/plain, Size: 3927 bytes --]
" This file is a per-project '.exrc' file.
" To easily use this file to extend the global .vimrc place it in the root of
" your project and then run:
" ':source .exrc' from the root of your project.
" Add lispwords which occur in the Guix source tree.
" NB: Vim hardcodes 2 as the indentation. See get_lisp_indent in src/indent.c
setlocal lispwords+=add-after
setlocal lispwords+=add-before
setlocal lispwords+=case
setlocal lispwords+=call-with-input-file
setlocal lispwords+=define
setlocal lispwords+=define*
setlocal lispwords+=define*-public
setlocal lispwords+=define-configuration
setlocal lispwords+=define-deprecated
setlocal lispwords+=define-deprecated/public
setlocal lispwords+=define-deprecated/public-alias
setlocal lispwords+=define-gexp-compiler
setlocal lispwords+=define-module
setlocal lispwords+=define-public
setlocal lispwords+=define-record-type
setlocal lispwords+=define-record-type*
setlocal lispwords+=define-syntax
setlocal lispwords+=define-values
setlocal lispwords+=lambda
setlocal lispwords+=lambda*
setlocal lispwords+=let
setlocal lispwords+=let*
setlocal lispwords+=let*-values
setlocal lispwords+=let-syntax
setlocal lispwords+=let-values
setlocal lispwords+=letrec
setlocal lispwords+=letrec*
setlocal lispwords+=letrec-syntax
setlocal lispwords+=match-lambda
setlocal lispwords+=match-lambda*
setlocal lispwords+=match-record
setlocal lispwords+=mixed-text-file
setlocal lispwords+=modify-inputs
setlocal lispwords+=modify-phases
setlocal lispwords+=modify-services
setlocal lispwords+=parameterize
setlocal lispwords+=plain-file
setlocal lispwords+=program-file
setlocal lispwords+=replace
setlocal lispwords+=set!
setlocal lispwords+=strip-keyword-arguments
setlocal lispwords+=substitute*
setlocal lispwords+=substitute-keyword-arguments
setlocal lispwords+=syntax-rules
setlocal lispwords+=unless
setlocal lispwords+=when
setlocal lispwords+=while
setlocal lispwords+=with-directory-excursion
setlocal lispwords+=with-extensions
setlocal lispwords+=with-fluids
setlocal lispwords+=with-imported-modules
setlocal lispwords+=with-input-to-file
setlocal lispwords+=with-output-to-file
setlocal lispwords+=with-parameters
setlocal lispwords+=wrap-program
setlocal lispwords+=wrap-script
" In this repository .go files are compiled guile objects, not golang.
set wildignore+=*.go
" This is for the tie-in with guix.vim.
" TODO: guix.vim needs to correctly export autoloaded_guix.
if match(&runtimepath, 'guix') != -1
let g:guix_binary = expand('%:p:h') . "/pre-inst-env guix "
endif
" Editorconfig.vim has been distributed with vim since 9.0.1799.
if (has('syntax') && has('eval') &&
\ has("patch-9.0.1799") &&
\ filereadable('.editorconfig') &&
\ (match(&runtimepath, 'editorconfig') != -1))
packadd! editorconfig
endif
if (has("cscope") && executable('global') && executable('find'))
" These two lines could go in a gtags.conf file.
call setenv('GTAGSLABEL', 'pygments')
silent! call system("find {gnu,guix} -name '*\.scm' -print > gtags.files")
if !filereadable("GTAGS")
" This is a blocking operation, but it needs to complete before
" 'cscope add' is run. In addition, there needs to be a 'trigger' of
" some sort to cause vim to recognize the cscope database is ready if
" vim is already open.
" First run can be very slow.
call system("gtags")
"let tags_job = job_start("gtags", {'exit_cb': execute('cscope add GTAGS $PWD -a')})
else
call system('global --update')
"let tags_job = job_start('global --update', {'exit_cb': execute('cscope add GTAGS $PWD -a')})
endif
execute('cscope add GTAGS $PWD -a')
endif
" This should make sure gtags isn't still running.
if and(has("cscope"), executable('global'))
autocmd BufWritePost *.scm {
call system('global --update')
execute('cscope add GTAGS $PWD -a')
}
endif
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Vim helper config for Guix
2024-04-04 6:43 Vim helper config for Guix Efraim Flashner
@ 2024-04-29 13:36 ` Andreas Enge
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Enge @ 2024-04-29 13:36 UTC (permalink / raw)
To: guix-devel, Christina O'Donnell, Steve George
Hello Efraim,
Am Thu, Apr 04, 2024 at 09:43:02AM +0300 schrieb Efraim Flashner:
> Most of the line indentation works pretty well. Vim, by default for lisp
> languages, hardcodes an indent as 2 spaces, and I haven't gotten around
> to learning how to write an indentexpr to make it work for guix. As a
> result some of the indentation is close but not quite correct
actually I would suggest to change to a standard (such as "always 2 spaces")
that is easy to remember by a human; as far as I understood, almost nobody
knows how this Guix indentation works, one needs to either use Emacs or
copy-and-paste. Since mistakes in the current system seem to be unavoidable
without special tooling, maybe we should change the definition of "mistake"
instead of wasting time for the tooling.
I do not know whether there is a reason to sometimes indent only by 1.
Andreas
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-29 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04 6:43 Vim helper config for Guix Efraim Flashner
2024-04-29 13:36 ` Andreas Enge
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.