From f924656eef871d95eb8ab148e13055f96930b054 Mon Sep 17 00:00:00 2001 From: Hwlhwlxyz Date: Sat, 20 May 2023 22:58:53 -0400 Subject: [PATCH 1/2] add windows support, and update the README.md --- README.md | 11 ++++++++++- autoload/jsdoc.vim | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 00503ac..b8dee40 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ make clean make install ``` -If you want install lehre manually, you can install from npm. +If you want to install lehre manually, you can install from npm. ```console $ yarn add -D lehre @@ -75,6 +75,15 @@ $ yarn add -D lehre Set installed `/path/to/node_modules/.bin/lehre` path to `g:jsdoc_lehre_path`. +#### Installing on Windows + +```console +# cd to /lib +npm install +``` + +If you want to set the path of [lehre](https://www.npmjs.com/package/lehre) manually on Windows, you should use the path with the file extension `.cmd`, such as `/path/to/node_modules/.bin/lehre.cmd`. + ## Usage 1. Move cursor on `function` keyword line diff --git a/autoload/jsdoc.vim b/autoload/jsdoc.vim index b7a9362..8348207 100644 --- a/autoload/jsdoc.vim +++ b/autoload/jsdoc.vim @@ -9,11 +9,19 @@ set cpo&vim let g:jsdoc_templates_path = get(g:, 'jsdoc_templates_path', '') let g:jsdoc_formatter = get(g:, 'jsdoc_formatter', 'jsdoc') -let g:jsdoc_lehre_path = get( - \ g:, - \ 'jsdoc_lehre_path', - \ printf('%s/lib/lehre', expand(':p:h:h')) - \ ) +if has("win64") || has("win32") || has("win16") + let g:jsdoc_lehre_path = get( + \ g:, + \ 'jsdoc_lehre_path', + \ printf('%s/lib/node_modules/.bin/lehre.cmd', expand(':p:h:h')) + \ ) +else + let g:jsdoc_lehre_path = get( + \ g:, + \ 'jsdoc_lehre_path', + \ printf('%s/lib/lehre', expand(':p:h:h')) + \ ) +endif let s:is_method_regex = '^.\{-}\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*(\s*\([^)]*\)\s*).*$' let s:is_declarelation = '^.\{-}=\s*\(\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*(\s*\([^)]*\)\s*)\|(\s*\([^)]*\)\s*\).*$' From c8d22b10de0bf4d7ddd5726508327862791583c2 Mon Sep 17 00:00:00 2001 From: Hwlhwlxyz Date: Sun, 21 May 2023 09:34:22 -0400 Subject: [PATCH 2/2] Update autoload/jsdoc.vim Co-authored-by: Shinya Ohyanagi --- autoload/jsdoc.vim | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/autoload/jsdoc.vim b/autoload/jsdoc.vim index 8348207..c65f5b5 100644 --- a/autoload/jsdoc.vim +++ b/autoload/jsdoc.vim @@ -10,17 +10,17 @@ set cpo&vim let g:jsdoc_templates_path = get(g:, 'jsdoc_templates_path', '') let g:jsdoc_formatter = get(g:, 'jsdoc_formatter', 'jsdoc') if has("win64") || has("win32") || has("win16") - let g:jsdoc_lehre_path = get( - \ g:, - \ 'jsdoc_lehre_path', - \ printf('%s/lib/node_modules/.bin/lehre.cmd', expand(':p:h:h')) - \ ) + let g:jsdoc_lehre_path = get( + \ g:, + \ 'jsdoc_lehre_path', + \ printf('%s/lib/node_modules/.bin/lehre.cmd', expand(':p:h:h')) + \ ) else - let g:jsdoc_lehre_path = get( - \ g:, - \ 'jsdoc_lehre_path', - \ printf('%s/lib/lehre', expand(':p:h:h')) - \ ) + let g:jsdoc_lehre_path = get( + \ g:, + \ 'jsdoc_lehre_path', + \ printf('%s/lib/lehre', expand(':p:h:h')) + \ ) endif let s:is_method_regex = '^.\{-}\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*(\s*\([^)]*\)\s*).*$'