Tweak function and command output in Vim help printer to stand out more
authorGreg Hurrell <greg@hurrell.net>
Tue, 4 Dec 2018 14:11:51 +0000 (15:11 +0100)
committerGreg Hurrell <greg@hurrell.net>
Tue, 4 Dec 2018 14:11:51 +0000 (15:11 +0100)
Makes them into "subheading" style by moving the links onto the previous
line and using a trailing "~".

lib/Text/Docvim/Printer/Vim.hs
tests/fixtures/integration/ferret/golden/plaintext.golden
tests/fixtures/integration/loupe/golden/plaintext.golden

index 18e649ac9d11ad1c89579a5b18b886ca0740a583..c9353c1db0eba95a2a99b32841814b922da6e498 100644 (file)
@@ -206,11 +206,10 @@ toc t = do
 
 command :: Node -> Env
 command (CommandAnnotation name params) = do
-  lhs <- append $ concat [":", name, " ", fromMaybe "" params]
-  ws <- append " "
   target' <- linkTargets [":" ++ name] False
-  trailing <- append "\n"
-  return $ concat [lhs, ws, target', trailing]
+  lhs <- append $ concat [":", name, " ", fromMaybe "" params]
+  trailing <- append " ~\n\n"
+  return $ concat [target', lhs, trailing]
 -- TODO indent what follows until next annotation...
 -- will require us to hoist it up inside CommandAnnotation
 -- (and do similar for other sections)
@@ -219,11 +218,10 @@ command _ = invalidNode
 
 function :: Node -> Env
 function (FunctionAnnotation name) = do
-  lhs <- append $ name ++ "()"
-  ws <- append " "
   target' <- linkTargets [name ++ "()"] False
-  trailing <- append "\n"
-  return $ concat [lhs, ws, target', trailing]
+  lhs <- append $ name ++ "()"
+  trailing <- append " ~\n\n"
+  return $ concat [target', lhs, trailing]
 -- TODO indent what follows
 function _ = invalidNode
 
index 93ddf2bf46e94d058612abfc20f755249703c9e7..72b656bf1becf96875939e6a8f7629a857a05e22 100644 (file)
@@ -99,7 +99,8 @@ To generate help tags under Pathogen, you can do so from inside Vim with:
 <
 COMMANDS                                                       *ferret-commands*
 
-:Ack {pattern} {options}                                                  *:Ack*
+                                                                          *:Ack*
+:Ack {pattern} {options} ~
 
 Searches for {pattern} in all the files under the current directory (see
 |:pwd|), unless otherwise overridden via {options}, and displays the results
@@ -138,12 +139,14 @@ enter |Cmdline-mode| with `:Ack` inserted on the |Cmdline|. Likewise <leader>s
 (|<Plug>(FerretAckWord)|) is a shortcut for running |:Ack| with the word
 currently under the cursor.
 
-:Ack! {pattern} {options}                                                *:Ack!*
+                                                                         *:Ack!*
+:Ack! {pattern} {options} ~
 
 Like |:Ack|, but returns all results irrespective of the value of
 |g:FerretMaxResults|.
 
-:Lack {pattern} {options}                                                *:Lack*
+                                                                         *:Lack*
+:Lack {pattern} {options} ~
 
 Just like |:Ack|, but instead of using the |quickfix| listing, which is global
 across an entire Vim instance, it uses the |location-list|, which is a
@@ -152,12 +155,14 @@ per-window construct.
 Note that |:Lack| always runs synchronously via |:cexpr|, because dispatch.vim
 doesn't currently support the |location-list|.
 
-:Lack! {pattern} {options}                                              *:Lack!*
+                                                                        *:Lack!*
+:Lack! {pattern} {options} ~
 
 Like |:Lack|, but returns all results irrespective of the value of
 |g:FerretMaxResults|.
 
-:Back {pattern} {options}                                                *:Back*
+                                                                         *:Back*
+:Back {pattern} {options} ~
 
 Like |:Ack|, but searches only listed buffers. Note that the search is still
 delegated to the underlying |'grepprg'| (`rg`, `ag`, `ack` or `ack-grep`), which means
@@ -165,12 +170,14 @@ that only buffers written to disk will be searched. If no buffers are
 written to disk, then |:Back| behaves exactly like |:Ack| and will search all
 files in the current directory.
 
-:Back! {pattern} {options}                                              *:Back!*
+                                                                        *:Back!*
+:Back! {pattern} {options} ~
 
 Like |:Back|, but returns all results irrespective of the value of
 |g:FerretMaxResults|.
 
-:Black {pattern} {options}                                              *:Black*
+                                                                        *:Black*
+:Black {pattern} {options} ~
 
 Like |:Lack|, but searches only listed buffers. As with |:Back|, the search is
 still delegated to the underlying |'grepprg'| (`rg`, `ag`, `ack` or `ack-grep`), which
@@ -178,12 +185,14 @@ means that only buffers written to disk will be searched. Likewise, If no
 buffers are written to disk, then |:Black| behaves exactly like |:Lack| and will
 search all files in the current directory.
 
-:Black! {pattern} {options}                                            *:Black!*
+                                                                       *:Black!*
+:Black! {pattern} {options} ~
 
 Like |:Black|, but returns all results irrespective of the value of
 |g:FerretMaxResults|.
 
-:Acks /{pattern}/{replacement}/                                          *:Acks*
+                                                                         *:Acks*
+:Acks /{pattern}/{replacement}/ ~
 
 Takes all of the files currently in the |quickfix| listing and performs a
 substitution of all instances of {pattern} (a standard Vim search |pattern|)
@@ -197,7 +206,8 @@ directory:
     :Ack foo
     :Acks /foo/bar/
 <
-:Qargs                                                                  *:Qargs*
+                                                                        *:Qargs*
+:Qargs  ~
 
 This is a utility function that is used internally when running on older
 versions of Vim (prior to version 8) but is also generally useful enough to
index 937cfe4b992cff94f8d6a3d39215cc0f4d8a5952..05bd860288f9db80abcfd8340963de1574c3cd92 100644 (file)
@@ -205,7 +205,8 @@ when jumping (via |n|, |N| etc). To disable, set to 0:
 <
 FUNCTIONS                                                      *loupe-functions*
 
-loupe#hlmatch()                                                *loupe#hlmatch()*
+                                                               *loupe#hlmatch()*
+loupe#hlmatch() ~
 
 Apply highlighting to the current search match.