aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--documentation/content/en/books/fdp-primer/editor-config/_index.adoc84
1 files changed, 51 insertions, 33 deletions
diff --git a/documentation/content/en/books/fdp-primer/editor-config/_index.adoc b/documentation/content/en/books/fdp-primer/editor-config/_index.adoc
index d034d87737..bb3314bee6 100644
--- a/documentation/content/en/books/fdp-primer/editor-config/_index.adoc
+++ b/documentation/content/en/books/fdp-primer/editor-config/_index.adoc
@@ -52,13 +52,15 @@ Adjusting your text editor configuration can make working on document files quic
[[editor-config-vim]]
== Vim
-Install from package:editors/vim[], package:editors/vim-console[], or package:editors/vim-tiny[] then follow the configuration instructions in <<editor-config-vim-config>>.
+Install from package:editors/vim[], or package:editors/vim-console[], then follow the configuration instructions in <<editor-config-vim-config>>.
+More advanced users can use a proper linter like link:https://github.com/dense-analysis/ale[Ale] which can also act as a Vim link:https://langserver.org/[Language Server Protocol] client.
[[editor-config-vim-use]]
=== Use
-Press kbd:[P] to reformat paragraphs or text that has been selected in Visual mode.
-Press kbd:[T] to replace groups of eight spaces with a tab.
+Manual page writers can use the following keyboard shortcuts to reformat:
+* Press kbd:[P] to reformat paragraphs or text that has been selected in Visual mode.
+* Press kbd:[T] to replace groups of eight spaces with a tab.
[[editor-config-vim-config]]
=== Configuration
@@ -68,43 +70,59 @@ Edit [.filename]#~/.vimrc#, adding these lines to the end of the file:
[.programlisting]
....
if has("autocmd")
- au BufNewFile,BufRead *.sgml,*.ent,*.xsl,*.xml call Set_SGML()
- au BufNewFile,BufRead *.[1-9] call ShowSpecial()
+ au BufNewFile,BufRead *.adoc call Set_ADOC()
+ au BufNewFile,BufRead *.[1-9] call Set_MAN()
endif " has(autocmd)
function Set_Highlights()
- "match ExtraWhitespace /^\s* \s*\|\s\+$/
- highlight default link OverLength ErrorMsg
- match OverLength /\%71v.\+/
- return 0
-endfunction " Set_Highlights()
+ "match ExtraWhitespace /^\s* \s*\|\s\+$/
+ return 0
+endfunction " Set_Highlights_Adoc()
+
+function Set_Highlights_MAN()
+ highlight default link OverLength ErrorMsg
+ match OverLength /\%71v.\+/
+ return 0
+endfunction " Set_Highlights_MAN()
function ShowSpecial()
- setlocal list listchars=tab:>>,trail:*,eol:$
- hi def link nontext ErrorMsg
- return 0
+ setlocal list listchars=tab:>>,trail:*,eol:$
+ hi def link nontext ErrorMsg
+ return 0
endfunction " ShowSpecial()
-function Set_SGML()
- setlocal number
- syn match sgmlSpecial "&[^;]*;"
- setlocal syntax=sgml
- setlocal filetype=xml
- setlocal shiftwidth=2
- setlocal textwidth=70
- setlocal tabstop=8
- setlocal softtabstop=2
- setlocal formatprg="fmt -p"
- setlocal autoindent
- setlocal smartindent
- " Rewrap paragraphs
- noremap P gqj
- " Replace spaces with tabs
- noremap T :s/ /\t/<CR>
- call ShowSpecial()
- call Set_Highlights()
- return 0
-endfunction " Set_SGML()
+function Set_COMMON()
+ setlocal number
+ setlocal shiftwidth=2
+ setlocal tabstop=8
+ setlocal softtabstop=2
+ setlocal formatprg="fmt -p"
+ setlocal autoindent
+ setlocal smartindent
+ call ShowSpecial()
+ call Set_Highlights()
+ return 0
+endfunction " Set_COMMON()
+
+function Set_ADOC()
+ setlocal syntax=asciidoc
+ setlocal filetype=asciidoc
+ call Set_COMMON()
+ return 0
+endfunction " Set_ADOC()
+
+function Set_MAN()
+ setlocal syntax=man
+ setlocal filetype=man
+ setlocal textwidth=70
+ " Rewrap paragraphs
+ noremap P gqj
+ " Replace spaces with tabs
+ noremap T :s/ /\t/<CR>
+ call Set_COMMON()
+ call Set_Highlights_MAN()
+ return 0
+endfunction " Set_Man()
....
[[editor-config-emacs]]