nvim: Remove pencil to fix relative cursor movement

Cursor movement works better for soft-wrapped prose files now:
When just using j/k to move vertically, the cursor will jump between the
different parts of a single wrapped line. That means you can easily move
anywhere you want on your lines, exactly as it's shown to you.

If, however, prefixing your j/k move with a number to move a relative
number of lines, it will no longer take wrapping into account. That
means you can not jump instantly to *any* part of a wrapped lines,
however on the other hand the relative line numbers on the side never
lie now: You will jump exactly as many lines as are shown on the side.
This is a tradeoff I am happily willing to make.

Additionally had to remove vim-pencil to get the movement to work, but
since it did not provide any visible pros anymore, this should not be a
big issue.
This commit is contained in:
Marty Oehme 2020-10-08 20:38:50 +02:00
parent ca692d30d0
commit 65df0fb91f
Signed by: Marty
GPG key ID: B7538B8F50A1C800
5 changed files with 14 additions and 13 deletions

View file

@ -1,9 +1,7 @@
" PROSE: function to automatically enables markdown plugins for md & txt files " PROSE: function to automatically enables markdown plugins for md & txt files
function! s:Prose() function! s:Prose()
call plug#load('vim-pencil')
call plug#load('goyo.vim') call plug#load('goyo.vim')
call plug#load('limelight.vim') call plug#load('limelight.vim')
call pencil#init()
" PLUGIN: vim-textobj-sentence " PLUGIN: vim-textobj-sentence
" enable extended sentence textobject use on md and plaintext files " enable extended sentence textobject use on md and plaintext files
call textobj#sentence#init() call textobj#sentence#init()

View file

@ -77,7 +77,6 @@ Plug 'kana/vim-textobj-user'
Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection Plug 'reedes/vim-textobj-sentence' " extends the capabilities of sentence detection
" and allows you to jump to the *end* of this <g)> or last <g(> sentence. " and allows you to jump to the *end* of this <g)> or last <g(> sentence.
Plug 'reedes/vim-pencil', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide md convenience functions like hard/softwrap
Plug 'junegunn/goyo.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing Plug 'junegunn/goyo.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide distraction free writing
Plug 'junegunn/limelight.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs) Plug 'junegunn/limelight.vim', { 'for': ['pandoc', 'markdown', 'txt'], 'on': 'Goyo' } " provide even distraction free-er writing (lowlight paragraphs)
" Language Integration " Language Integration

View file

@ -29,6 +29,13 @@ nnoremap Q @
nnoremap H ^ nnoremap H ^
nnoremap L $ nnoremap L $
" when in softwrapped files, allow moving through the visible lines with j/k
" but when prepending a number jump *exactly* as many lines, wrapped or not
" This makes relative linenumbers much more useful in prose docs since they
" are always exactly correct
nnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
" move around between matching brackets with tab " move around between matching brackets with tab
nnoremap <tab> % nnoremap <tab> %
nnoremap <tab> % nnoremap <tab> %
@ -254,12 +261,10 @@ vnoremap <leader>zt "ky:ThesaurusQueryReplace <cr>k<cr>
" o to open the resulting document (mostly for pdfs) " o to open the resulting document (mostly for pdfs)
" po to comPile *and* open a doc " po to comPile *and* open a doc
" and all the same in uppercase for verbose output " and all the same in uppercase for verbose output
nnoremap <localleader>pp :DocCompile<cr> nnoremap <localleader>dp :DocCompile<cr>
nnoremap <localleader>PP :DocCompile!<cr> nnoremap <localleader>dP :DocCompile!<cr>
nnoremap <localleader>po :DocCompileOpen<cr> nnoremap <localleader>do :DocOpen<cr>
nnoremap <localleader>PO :DocCompileOpen!<cr> nnoremap <localleader>dO :DocOpen!<cr>
nnoremap <localleader>o :DocOpen<cr>
nnoremap <localleader>O :DocOpen!<cr>
" PLUGIN: easy-align " PLUGIN: easy-align
" Start interactive EasyAlign in visual mode (e.g. vipga) " Start interactive EasyAlign in visual mode (e.g. vipga)

View file

@ -5,6 +5,9 @@ let g:pandoc#filetypes#pandoc_markdown = 1
let g:pandoc#filetypes#handled = [ "extra", "latex", "markdown", "pandoc", "rst", "textile" ] let g:pandoc#filetypes#handled = [ "extra", "latex", "markdown", "pandoc", "rst", "textile" ]
" disable all default keymaps " disable all default keymaps
let g:pandoc#keyboard#use_default_mappings=0 let g:pandoc#keyboard#use_default_mappings=0
" needs to be set for wrapping and unwrapping of lines to work when doing j/k
" or gj/gk respectively, to allow precise relative cursor jumping
let g:pandoc#keyboard#display_motions=0
let g:pandoc#hypertext#use_default_mappings=0 let g:pandoc#hypertext#use_default_mappings=0
" if there's a pdf and an html or similar, open the pdf " if there's a pdf and an html or similar, open the pdf
let g:pandoc#command#prefer_pdf=1 let g:pandoc#command#prefer_pdf=1

View file

@ -1,4 +0,0 @@
" PLUGIN: vim-pencil
" set default wrap mode to hard - TODO test which mode works better for
" me, it seems hardmode has trouble with markdown lists (see issue #31)
let g:pencil#wrapModeDefault = 'soft' " default is 'hard'