all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: guix-devel@gnu.org, Christina O'Donnell <cdo@mutix.org>,
	Steve George <steve@futurile.net>
Subject: Vim helper config for Guix
Date: Thu, 4 Apr 2024 09:43:02 +0300	[thread overview]
Message-ID: <Zg5L9nlWeBGXkjN9@3900XT> (raw)


[-- 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 --]

             reply	other threads:[~2024-04-04  6:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04  6:43 Efraim Flashner [this message]
2024-04-29 13:36 ` Vim helper config for Guix Andreas Enge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zg5L9nlWeBGXkjN9@3900XT \
    --to=efraim@flashner.co.il \
    --cc=cdo@mutix.org \
    --cc=guix-devel@gnu.org \
    --cc=steve@futurile.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.