-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for simultaneous lean3/lean4 (in separate windows/tabs) #35
Closed
Closed
Changes from 62 commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
d7e0685
Implement lean3 vs. lean4 filetype detection; remove lean.vim depende…
rish987 1de6b3b
Fix infoview.
rish987 cd18592
Fix 4-second lean4 updatetime.
rish987 d6ea036
Implement multi-tab infoview.
rish987 70dca5d
Fix infoview toggle.
rish987 5976501
Index infoviews by windows rather than buffers.
rish987 23522d4
Update README and add infoview server startup grace period.
rish987 f15f610
Merge remote-tracking branch 'upstream/main' into main
rish987 c2db67d
More README notes and add all remaining lean.vim files.
rish987 f9ac13a
README formatting.
rish987 edeaa70
Bring syntax files up-to-date, duplicate plugin files from lean to le…
rish987 81ab591
Remove some lean3 switch mappings from lean4.
rish987 e6c4656
Update indent file for lean4.
rish987 50953f9
Remove lean4 executable path stuff from README.
rish987 7a90e25
Implement dynamically configurable per-tab/per-window option.
rish987 b9e0576
Slight refactor of infoview.lua.
rish987 d3ebca1
Fix default one_per_tab setting.
rish987 0a9a20f
Merge remote-tracking branch 'upstream/main' into main
rish987 bcef288
Fix some remaining instances of indexing solely by nvim_get_current_w…
rish987 126690c
Rename src_winnr -> src_idx (readability).
rish987 5d45699
Get seemingly working auto-infoview-close functionality, but throws e…
rish987 adf970d
Fix closing single source with multiple source windows in tab in per-…
rish987 d039630
Refactor autocmds.
rish987 333c84a
Remove debug print, minor formatting.
rish987 12e14bd
Fix E855 (per-tab mode error mentioned above) by making an autocmd di…
rish987 8ade70b
Put back <afile> expansion on WinClosed to avoid any timing issues.
rish987 5138c58
Remove more begin/ends from Lean 4.
Julian ef93fa1
pre-commit
Julian 5d1e7a9
Make robust to manual infoview close by user.
rish987 27dda16
Relocate some refresh_infos() calls.
rish987 5e024be
Specify whether the infoview is already closed to close_win_wrapper().
rish987 ba3b226
Make 'lean' filetype refer to Lean 4 and 'lean3' refer to Lean 3.
rish987 fec293f
Make suggested keymappings buffer-local; make user commands for setti…
rish987 8e15a8f
Describe suggested mappings in README.
rish987 6eecae6
Fix abbreviations for lean3/lean4.
rish987 04d4f60
Revert snippets setting to previous format (accidentally overrode exi…
rish987 2836a3e
'Fix' compe abbreviations (not sure how to test this).
rish987 61ff2b6
Fix a minor typo in the README.
Julian 6fca73c
Document the current mappings.
Julian ff94cd4
Remove the note on LeanPlainGoal.
Julian 28b62d8
Fix automated tests.
rish987 3265d1b
Merge remote-tracking branch 'upstream/main' into main
rish987 0c29f2d
Pre-commit
rish987 bbf811a
Fix README typos.
rish987 1250a0a
Fix error message when closing infoview after closing source with CTR…
rish987 1689187
Fix autocmd use of '<buffer=0>'.
rish987 9f5b875
Add more details to README about new features.
rish987 22b873b
pre-commit
rish987 14fbe51
Fix bug where in per-tab mode, closing the 'original' window would ca…
rish987 7ec6249
Add source comments.
rish987 0e5d621
Support buffer-local suggested mapping application.
Julian 37be218
Add back the infoview mode-toggling mappings.
Julian 40666a2
Merge branch 'main' into rish
Julian 8885da7
Merge branch 'main' into rish
Julian e25e07e
Minor readme revert.
Julian ae3f0bc
Remove some less-relevant notes with the infoview.
Julian c0b6c0e
Merge branch 'main' into rish
Julian 01f7e35
Merge branch 'main' into rish
Julian 7540117
Minor ternary style, which Lua people seem to like.
Julian beef5e4
Merge remote-tracking branch 'upstream/main' into main
rish987 24a4137
Revert a couple ternary refactors and minor close_win_wrapper() fix.
rish987 d48c9f8
For now, always erase infoviews.
Julian e73cc6d
Pull in some upstream changes.
Julian c63b1eb
Remove dead code.
Julian f97b0a0
Remove some sections from the README.
Julian 1033ed2
Pull in the max_width change.
Julian 0e3e2f6
Pull in the augroup helper
Julian 01d6f99
Use is_lean3_project in _update to detect lean3 projects.
Julian e3b1063
Guard against lean3ls not existing yet until the PR is merged.
Julian 8604975
Partially pull in teardown.
Julian ac92804
Remove the note about Lean3 being removed in the future.
Julian 6cb1154
Use lspconfig.util to find leanpkg.toml
Julian 58da940
Get rid of lean3.detect if we already have ft.detect.
Julian 3cdad44
Properly detect leanpkg.toml relative to the lean file, not cwd.
Julian eb4cd45
Fix infoview closing.
rish987 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
autocmd BufRead,BufNewFile *.lean lua require'lean.lean3'.detect() | ||
autocmd BufRead,BufNewFile *.lean lua require'lean.ft'.detect(); require'lean.lean3'.detect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
if exists('b:did_ftplugin') | ||
finish | ||
endif | ||
let b:did_ftplugin = 1 | ||
|
||
set wildignore+=*.olean | ||
|
||
setlocal iskeyword=@,48-57,_,-,!,#,$,% | ||
|
||
setlocal comments=s0:/-,mb:\ ,ex:-/,:-- | ||
setlocal commentstring=/-\ %s\ -/ | ||
|
||
setlocal expandtab | ||
setlocal shiftwidth=2 | ||
setlocal softtabstop=2 | ||
|
||
function! lean#dotted2path(fname) | ||
return substitute(a:fname, '\.', '/', 'g') . '.lean' | ||
endfunction | ||
setlocal includeexpr=lean#dotted2path(v:fname) | ||
|
||
setlocal matchpairs+=⟨:⟩ | ||
|
||
" Matchit support | ||
if exists('loaded_matchit') && !exists('b:match_words') | ||
let b:match_ignorecase = 0 | ||
|
||
let b:match_words = | ||
\ ',\<\%(namespace\|section\)\s\+\(.\{-}\)\>:\<end\s\+\1\>' | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
" required for infoview | ||
setlocal updatetime=100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
if exists('b:did_ftplugin') | ||
finish | ||
endif | ||
let b:did_ftplugin = 1 | ||
|
||
set wildignore+=*.olean | ||
|
||
setlocal iskeyword=@,48-57,_,-,!,#,$,% | ||
|
||
setlocal comments=s0:/-,mb:\ ,ex:-/,:-- | ||
setlocal commentstring=/-\ %s\ -/ | ||
|
||
setlocal expandtab | ||
setlocal shiftwidth=2 | ||
setlocal softtabstop=2 | ||
|
||
function! lean#dotted2path(fname) | ||
return substitute(a:fname, '\.', '/', 'g') . '.lean' | ||
endfunction | ||
setlocal includeexpr=lean#dotted2path(v:fname) | ||
|
||
setlocal matchpairs+=⟨:⟩ | ||
|
||
" Matchit support | ||
if exists('loaded_matchit') && !exists('b:match_words') | ||
let b:match_ignorecase = 0 | ||
|
||
let b:match_words = | ||
\ '\<begin\>:\<end$' . | ||
\ ',\<\%(namespace\|section\)\s\+\(.\{-}\)\>:\<end\s\+\1\>' | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
" This possibly belongs in lean.vim or switch.vim itself but putting it here | ||
" for now. | ||
|
||
if !exists("g:loaded_switch") | ||
finish | ||
endif | ||
|
||
let b:switch_definitions = [ | ||
\ g:switch_builtins.true_false, | ||
\ ["#check", "#eval", "#reduce"], | ||
\ ['\(begin\n\s*\)\@<!sorry', 'begin\r sorry\rend'], | ||
\ ["tidy", "suggest", "hint", "linarith", "library_search"], | ||
\ ["rw", "simp", "simp?"], | ||
\ ["cases", "rcases", "obtain"], | ||
\ ["norm_cast", "push_cast"], | ||
\ ["inl", "inr"], | ||
\ ["tt", "ff"], | ||
\ ["=", "≠"], | ||
\ ["∈", "∉"], | ||
\ ["∪", "∩"], | ||
\ ["⋃", "⋂"], | ||
\ ["⊆", "⊂", "⊃", "⊇"], | ||
\ ["Σ", "∑"], | ||
\ ["∀", "∃"], | ||
\ ["∧", "∨"], | ||
\ ["⊔", "⊓"], | ||
\ ["⊥", "⊤"], | ||
\ ["⋀", "⋁"], | ||
\ ["×", "→"], | ||
\ ["0", "₀", "⁰"], | ||
\ ["1", "₁", "¹"], | ||
\ ["2", "₂", "²"], | ||
\ ["3", "₃", "³"], | ||
\ ["4", "₄", "⁴"], | ||
\ ["5", "₅", "⁵"], | ||
\ ["6", "₆", "⁶"], | ||
\ ["7", "₇", "⁷"], | ||
\ ["8", "₈", "⁸"], | ||
\ ["9", "₉", "⁹"], | ||
\ ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if exists("b:did_indent") | ||
finish | ||
endif | ||
let b:did_indent = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if exists("b:did_indent") | ||
finish | ||
endif | ||
let b:did_indent = 1 | ||
|
||
setlocal indentkeys+==end,==begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local util = require'lean.util' | ||
|
||
-- Ideally this obviously would use a TOML parser but yeah choosing to | ||
-- do nasty things and not add the dependency for now. | ||
local _MARKER = '.*lean_version.*\".*:3.*' | ||
|
||
|
||
local M = {} | ||
|
||
-- If a TOML file with a lean3 version string is found, use filetype "lean3". | ||
-- Otherwise use "lean" (lean4). | ||
function M.detect() | ||
local toml_file = util.find_toml(vim.api.nvim_buf_get_name(0)) | ||
if not toml_file then vim.bo.ft = "lean" return end | ||
local _, result = pcall(vim.fn.readfile, toml_file) | ||
for _, line in ipairs(result) do | ||
if line:match(_MARKER) then vim.bo.ft = "lean3" return end | ||
end | ||
vim.bo.ft = "lean" | ||
end | ||
|
||
return M |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remove line 37 here suggesting installing lean.vim I suppose