Comments (8)
Thanks for the report. I've actually run into this myself but never managed to track down what is causing it even as far as you have. I don't have the bandwidth to sit and mess with it right now, but if anybody does have ideas and finds this a PR would be welcome!
I don't typically turn Pencil on or off except once based on the file type on open so this is rare, but I have noted that g
prefixed motions are occasionally getting screwed up.
from vim-pencil.
I have always had this problem as well. The only nuance I have:
If you enter pencil mode :PencilSoft
and then leave :PencilOff
… if you enter it again :PencilSoft
the mappings are broken… if you leave the second time and re-enter a third time… the mappings are restored!
It's always alternate… the solution has been for me to quickly "restart" it, but I've never been able to track down why the mappings break the second time.
from vim-pencil.
No worries!
For me, the use case is that I want to have a "Prose Mode" in vim that is tied to when I enter/leave the Goyo mode from goyo.vim
And when using Goyo, there are a lot of reasons to switch in and out, so Pencil was getting toggled a lot.
For anyone else who might be wanting to do the same, my solution was to drop pencil and manually set up/tear down the mappings and settings I want, like so:
function! StartProse()
setlocal linebreak
setlocal wrap
nnoremap <buffer> j gj
nnoremap <buffer> k gk
inoremap <buffer> . .<c-g>u
inoremap <buffer> ! !<c-g>u
inoremap <buffer> ? ?<c-g>u
inoremap <buffer> , ,<c-g>u
inoremap <buffer> ; ;<c-g>u
inoremap <buffer> : :<c-g>u
endfunction
function! StopProse()
setlocal nolinebreak
setlocal nowrap
unmap <buffer> j
unmap <buffer> k
iunmap <buffer> .
iunmap <buffer> !
iunmap <buffer> ?
iunmap <buffer> ,
iunmap <buffer> ;
iunmap <buffer> :
endfunction
autocmd! User GoyoEnter nested call StartProse()
autocmd! User GoyoLeave nested call StopProse()
from vim-pencil.
Related Issues (20)
- View list of things concealed (or change) HOT 7
- Enable smoothscroll for soft wrap mode
- Disable <cr> mapping HOT 3
- Underline title
- Vim pencil hides/removes colorcolumn HOT 4
- Normal Mode unexpected cursor behavior HOT 6
- In soft mode, map k and j to gj and gk
- vim-pencil applies 'set nolist' in soft wrap mode?
- Why is textwidth not used for soft wrap? HOT 2
- Cleanup key remapping technique HOT 1
- blacklist for rst (restructured text) missing various highlight groups
- g:pencil#textwidth setting not applied
- SoftPencil seems doesn't work HOT 3
- Suspending autoformatting doesn't work? HOT 3
- How disable line wrap in front matter (for Hugo or Jekyll) HOT 6
- Pencil and Markdown issue with lists HOT 8
- Respect indentation of lists in Markdown
- Can't enter newline when editing vimwiki markdown
- "Undefined variable" and "Invalid arguments" errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-pencil.