nvim: ftplugin: Drop cabal format and Haskell key mappings

We never really used these Haskell key mappings and the cabal
format support is not something we care about now (86be7efd5).
This commit is contained in:
Sanchayan Maity 2024-12-09 22:27:04 +05:30
parent 55a5e35d3d
commit 69ec6eb77c
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3
3 changed files with 0 additions and 85 deletions

View file

@ -1 +0,0 @@
vim.bo.commentstring = "-- %s"

View file

@ -1,55 +0,0 @@
" Taken from https://github.com/sdiehl/vim-cabalfmt
if !exists("g:cabalfmt_command")
let g:cabalfmt_command = "cabal-fmt"
endif
if !exists("g:cabalfmt_options")
let g:cabalfmt_options = [""]
endif
function! s:OverwriteBuffer(output)
if &modifiable
let l:curw = winsaveview()
try | silent undojoin | catch | endtry
let splitted = split(a:output, '\n')
if line('$') > len(splitted)
execute len(splitted) .',$delete'
endif
call setline(1, splitted)
call winrestview(l:curw)
else
echom "Cannot write to non-modifiable buffer"
endif
endfunction
function! s:RunCabal()
if exists("bufname")
let output = system(g:cabalfmt_command . " " . join(g:cabalfmt_options, ' ') . " " . bufname("%"))
else
let stdin = join(getline(1, '$'), "\n")
let output = system(g:cabalfmt_command . " " . join(g:cabalfmt_options, ' '), stdin)
endif
if v:shell_error != 0
echom output
else
call s:OverwriteBuffer(output)
if exists("bufname")
write
endif
endif
endfunction
function! s:CabalHaskell()
if executable(g:cabalfmt_command)
call s:RunCabal()
else
echom "cabal-fmt executable not found"
endif
endfunction
function! RunCabal()
call s:CabalHaskell()
endfunction
nnoremap <buffer> <silent> gq :call RunCabal()<CR>

View file

@ -1,29 +0,0 @@
" Taken from https://github.com/danidiaz/miscellany/blob/master/linux/.vim/ftplugin/haskell/movements.vim
" Next top-level type signature
nnoremap <script> <silent> ]f /^\w[^:=$]*\(::\\|\n\s*::\)<CR>
" Previous top-level type signature
nnoremap <script> <silent> [f ?^\w[^:=$]*::\(::\\|\n\s*::\)<CR>
" Next type signature
nnoremap <script> <silent> ]l /^\s*\w[^:=$]*\(::\\|\n\s*::\)<CR>
" Previous type signature
nnoremap <script> <silent> [l ?^\s*\w[^:=$]*\(::\\|\n\s*::\)<CR>
" Next data declaration
nnoremap <script> <silent> ]t /^\(data \\|newtype \\|type \\|class\)<CR>
" Previous data declaration
nnoremap <script> <silent> [t ?^\(data \\|newtype \\|type \\|class\)<CR>
" Beginning of imports
nnoremap <script> <silent> [i gg/^import <CR>z<CR>
" End of imports
nnoremap <script> <silent> [I G?^import <CR>zb
" Beginning of module exports
nnoremap <script> <silent> [m gg/^module <CR>z<CR>
" End of module exports (wonky)
nnoremap <script> <silent> [M gg/^\s*)\s*where\s*$<CR>zb<CR>
" Next named chunk of documentation
" https://www.haskell.org/haddock/doc/html/ch03s05.html
nnoremap <script> <silent> ]n /^-- \$\w\+<CR>z<CR>
" Previous named chunk of documentation
nnoremap <script> <silent> [n ?^-- \$\w\+<CR>z<CR>
" Disable vim-matchup
autocmd! BufEnter <buffer> :NoMatchParen