aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2020-11-10 08:31:19 +0100
committerMatěj Cepl <mcepl@cepl.eu>2020-12-23 00:38:07 +0100
commite5d6b518c94b17c96968d04a17db810c7d05a1e9 (patch)
tree635f65cef15fbab4e824874fa10fc3dbe9de3508 /plugin
parent0117a7517a0484a882ab0e983aa3c9bce7b9e287 (diff)
downloadfountainwiki.vim-e5d6b518c94b17c96968d04a17db810c7d05a1e9.tar.gz
Don't fiddle with marks, use winsaveview()/winrestview() as intended.
Also, some cleanup (mostly unify indentation, remove trailing whitespaces and such).
Diffstat (limited to 'plugin')
-rw-r--r--plugin/fountainwiki.vim16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugin/fountainwiki.vim b/plugin/fountainwiki.vim
index 498bc12..80beeda 100644
--- a/plugin/fountainwiki.vim
+++ b/plugin/fountainwiki.vim
@@ -1,6 +1,6 @@
-" Vim plugin for Fountain screenplay files
+" Vim plugin for Fountain screenplay files
" Plugin Name: Fountainwiki & Indentation
-" Version: 1.3
+" Version: 1.3
" Last Change: 2012 Feb 24
" Reference: http://fountain.io/
" Maintainer: Carson Fire <carsonfire@gmail.com>
@@ -30,7 +30,7 @@ if !exists('FountainWiki_Centered_Indent')
let FountainWiki_Centered_Indent = '\t\t\t\t'
endif
exe 'au FileType fountain,spmd setlocal tw='.g:FountainWiki_Textwidth
-exe 'au FileType fountain,spmd setlocal tabstop='.g:FountainWiki_Tabstop
+exe 'au FileType fountain,spmd setlocal tabstop='.g:FountainWiki_Tabstop
" Wiki settings
if !exists('FountainWiki_Card_Extension')
@@ -61,7 +61,8 @@ endif
function FountainWikiIndent()
" When triggered, this function indents an entire Fountain doc.
- normal mvgg}mt
+ let position = winsaveview()
+ normal gg}mt
let g:Safety = "'t,$"
" We bookmark our current location, then bookmark the first blank
" line.
@@ -77,8 +78,7 @@ function FountainWikiIndent()
" Fix section headers mistaken for character names.
exe '%s/^\s*$//ge'
" Remove accidental tabs/spaces from otherwise blank lines.
- normal 'v
- " We return the user to the spot where he began.
+ call winrestview(position)
endfunction
function FountainHeaderDown()
@@ -162,7 +162,7 @@ function ScreenplayHome()
exe 'command! FW e '.g:FountainWiki_Home
exe 'command! FnScreenplay e '.g:FountainWiki_Home
" Command(s) for returning to the last screenplay doc, from anywhere.
- if g:FountainWiki_Card_Extension != "wiki" && g:FountainWiki_Card_Extension != "viki" && g:FountainWiki_Card_Extension != "fountain"
+ if g:FountainWiki_Card_Extension != "wiki" && g:FountainWiki_Card_Extension != "viki" && g:FountainWiki_Card_Extension != "fountain"
" We grant Vimwiki-like powers to text files
exe 'au BufRead,BufWrite,BufNewFile '.g:FountainWiki_Path.'/*.'.g:FountainWiki_Card_Extension.' nnoremap <buffer> <backspace> <c-o>'
exe 'au BufRead,BufWrite '.g:FountainWiki_Path.'/*.'.g:FountainWiki_Card_Extension.' map <buffer> <cr> <esc>:call SpecialLink()<cr>'
@@ -184,7 +184,7 @@ if g:FountainWiki_Card_Extension == "wiki"
if exists("g:wiki.path")
exe 'command! FnReset let g:wiki.path = "'.g:wiki.path.'"'
else
- command! FnReset echo "No wiki reset required."
+ command! FnReset echo "No wiki reset required."
endif
nnoremap <leader>ww <esc>:FnReset<cr>:VimwikiIndex<cr>
nnoremap <leader>wt <esc>:FnReset<cr>:VimwikiTabIndex<cr>