nvim: after: ftplugin: Fix various key mappings

Make sure we use <buffer> to make a local mapping just for the active
buffer.
This commit is contained in:
Sanchayan Maity 2021-05-02 19:18:49 +05:30
parent 5398b83200
commit e6397864d0
3 changed files with 21 additions and 21 deletions

View file

@ -1,9 +1,9 @@
" See https://github.com/neovim/neovim/blob/master/runtime/ftplugin/gitrebase.vim
nnoremap <buffer> <silent> <Leader>p :Pick<CR>
nnoremap <buffer> <silent> <Leader>s :Squash<CR>
nnoremap <buffer> <silent> <Leader>e :Edit<CR>
nnoremap <buffer> <silent> <Leader>r :Reword<CR>
nnoremap <buffer> <silent> <Leader>f :Fixup<CR>
nnoremap <buffer> <silent> <Leader>c :Cycle<CR>
nmap <buffer> <silent> <Leader>p :Pick<CR>
nmap <buffer> <silent> <Leader>s :Squash<CR>
nmap <buffer> <silent> <Leader>e :Edit<CR>
nmap <buffer> <silent> <Leader>r :Reword<CR>
nmap <buffer> <silent> <Leader>f :Fixup<CR>
nmap <buffer> <silent> <Leader>c :Cycle<CR>
setlocal bufhidden=delete

View file

@ -10,30 +10,30 @@ nmap <buffer> <LocalLeader>k :GhcidKill<CR>
" 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>
nmap <buffer> <script> <silent> ]f /^\w[^:=$]*\(::\\|\n\s*::\)<CR>
" Previous top-level type signature
nnoremap <script> <silent> [f ?^\w[^:=$]*::\(::\\|\n\s*::\)<CR>
nmap <buffer> <script> <silent> [f ?^\w[^:=$]*::\(::\\|\n\s*::\)<CR>
" Next type signature
nnoremap <script> <silent> ]l /^\s*\w[^:=$]*\(::\\|\n\s*::\)<CR>
nmap <buffer> <script> <silent> ]l /^\s*\w[^:=$]*\(::\\|\n\s*::\)<CR>
" Previous type signature
nnoremap <script> <silent> [l ?^\s*\w[^:=$]*\(::\\|\n\s*::\)<CR>
nmap <buffer> <script> <silent> [l ?^\s*\w[^:=$]*\(::\\|\n\s*::\)<CR>
" Next data declaration
nnoremap <script> <silent> ]t /^\(data \\|newtype \\|type \\|class\)<CR>
nmap <buffer> <script> <silent> ]t /^\(data \\|newtype \\|type \\|class\)<CR>
" Previous data declaration
nnoremap <script> <silent> [t ?^\(data \\|newtype \\|type \\|class\)<CR>
nmap <buffer> <script> <silent> [t ?^\(data \\|newtype \\|type \\|class\)<CR>
" Beginning of imports
nnoremap <script> <silent> [i gg/^import <CR>z<CR>
nmap <buffer> <script> <silent> [i gg/^import <CR>z<CR>
" End of imports
nnoremap <script> <silent> [I G?^import <CR>zb
nmap <buffer> <script> <silent> [I G?^import <CR>zb
" Beginning of module exports
nnoremap <script> <silent> [m gg/^module <CR>z<CR>
nmap <buffer> <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>
nmap <buffer> <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>
nmap <buffer> <script> <silent> ]n /^-- \$\w\+<CR>z<CR>
" Previous named chunk of documentation
nnoremap <script> <silent> [n ?^-- \$\w\+<CR>z<CR>
nmap <buffer> <script> <silent> [n ?^-- \$\w\+<CR>z<CR>
let g:haskell_classic_highlighting = 1
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`

View file

@ -12,6 +12,6 @@ setlocal nocursorline
setlocal nobuflisted
setlocal nospell
nnoremap <buffer> [- :colder<CR>
nnoremap <buffer> ]+ :cnewer<CR>
nnoremap <buffer> <Leader>g :Cfilter<SPACE>
nmap <buffer> [- :colder<CR>
nmap <buffer> ]+ :cnewer<CR>
nmap <buffer> <Leader>g :Cfilter<SPACE>