From a928b7f32f1fbb21f8ee895d7f47f513e3813af6 Mon Sep 17 00:00:00 2001 From: Jonatan Anauati Date: Mon, 27 Jun 2022 08:37:09 -0300 Subject: [PATCH 1/6] Ability to reveal current buffer in file browser. --- VimR/VimR/DefaultShortcuts.swift | 1 + VimR/VimR/MainWindow+Actions.swift | 4 ++++ VimR/VimR/MainWindow.swift | 4 ++++ VimR/VimR/RpcEvents.swift | 2 ++ VimR/VimR/com.qvacua.VimR.vim | 6 ++++++ 5 files changed, 17 insertions(+) diff --git a/VimR/VimR/DefaultShortcuts.swift b/VimR/VimR/DefaultShortcuts.swift index a32d30fb..fd78449b 100644 --- a/VimR/VimR/DefaultShortcuts.swift +++ b/VimR/VimR/DefaultShortcuts.swift @@ -72,4 +72,5 @@ let legacyDefaultShortcuts = [ "com.qvacua.vimr.menuitems.window.bring-all-to-front", "com.qvacua.vimr.menuitems.window.minimize", "com.qvacua.vimr.menuitems.window.zoom", + "com.qvacua.vimr.file-browser.tools.reveal-current-buffer" ] diff --git a/VimR/VimR/MainWindow+Actions.swift b/VimR/VimR/MainWindow+Actions.swift index 69a96fe3..2bd47409 100644 --- a/VimR/VimR/MainWindow+Actions.swift +++ b/VimR/VimR/MainWindow+Actions.swift @@ -23,6 +23,10 @@ extension MainWindow { let params = Array(rawParams.suffix(from: 1)) switch event { + + case .revealCurrentBufferInFileBrowser: + self.revealCurrentBufferInFileBrowser() + case .makeSessionTemporary: self.emit(self.uuidAction(for: .makeSessionTemporary)) diff --git a/VimR/VimR/MainWindow.swift b/VimR/VimR/MainWindow.swift index 3e49592f..dc423ec1 100644 --- a/VimR/VimR/MainWindow.swift +++ b/VimR/VimR/MainWindow.swift @@ -595,6 +595,10 @@ final class MainWindow: NSObject, Swift.print("fdsfd") } } + + func revealCurrentBufferInFileBrowser() { + self.fileBrowser?.scrollToSourceAction(nil) + } } // NvimViewDelegate diff --git a/VimR/VimR/RpcEvents.swift b/VimR/VimR/RpcEvents.swift index 32712c51..5e7f7a0a 100644 --- a/VimR/VimR/RpcEvents.swift +++ b/VimR/VimR/RpcEvents.swift @@ -17,4 +17,6 @@ enum RpcEvent: String, CaseIterable { case setFont = "com.qvacua.vimr.rpc-events.set-font" case setLinespacing = "com.qvacua.vimr.rpc-events.set-linespacing" case setCharacterspacing = "com.qvacua.vimr.rpc-events.set-characterspacing" + + case revealCurrentBufferInFileBrowser = "com.qvacua.vimr.rpc-events.reveal-current-buffer-in-browser" } diff --git a/VimR/VimR/com.qvacua.VimR.vim b/VimR/VimR/com.qvacua.VimR.vim index c95e6b42..54746518 100644 --- a/VimR/VimR/com.qvacua.VimR.vim +++ b/VimR/VimR/com.qvacua.VimR.vim @@ -20,6 +20,12 @@ command! -nargs=0 VimRShowTools call s:VimRToggleTools(1) function! s:VimRToggleToolButtons(value) abort call rpcnotify(0, 'com.qvacua.NvimView', 'toggle-tool-buttons', a:value) endfunction + +function! s:VimRRevealCurrentBufferInFileExplorer() abort + " case revealCurrentBufferInFileBrowser = "com.qvacua.vimr.rpc-events.reveal-current-buffer-in-browser" + call rpcnotify(0, 'com.qvacua.NvimView', 'reveal-current-buffer-in-browser') +endfunction +command! -nargs=0 VimRRevealCurrentBuffer call s:VimRRevealCurrentBufferInFileExplorer() command! -nargs=0 VimRHideToolButtons call s:VimRToggleToolButtons(-1) command! -nargs=0 VimRToggleToolButtons call s:VimRToggleToolButtons(0) command! -nargs=0 VimRShowToolButtons call s:VimRToggleToolButtons(1) From 03d431fe8d41edd57613dd62e0fd1a2285962c1d Mon Sep 17 00:00:00 2001 From: Jonatan Anauati Date: Wed, 29 Jun 2022 19:38:01 -0300 Subject: [PATCH 2/6] Add refresh-file-brower command. --- VimR/VimR/DefaultShortcuts.swift | 1 - VimR/VimR/MainWindow+Actions.swift | 3 +++ VimR/VimR/MainWindow.swift | 4 ++++ VimR/VimR/RpcEvents.swift | 3 ++- VimR/VimR/com.qvacua.VimR.vim | 15 ++++++++++----- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/VimR/VimR/DefaultShortcuts.swift b/VimR/VimR/DefaultShortcuts.swift index fd78449b..a32d30fb 100644 --- a/VimR/VimR/DefaultShortcuts.swift +++ b/VimR/VimR/DefaultShortcuts.swift @@ -72,5 +72,4 @@ let legacyDefaultShortcuts = [ "com.qvacua.vimr.menuitems.window.bring-all-to-front", "com.qvacua.vimr.menuitems.window.minimize", "com.qvacua.vimr.menuitems.window.zoom", - "com.qvacua.vimr.file-browser.tools.reveal-current-buffer" ] diff --git a/VimR/VimR/MainWindow+Actions.swift b/VimR/VimR/MainWindow+Actions.swift index 2bd47409..fc9a0230 100644 --- a/VimR/VimR/MainWindow+Actions.swift +++ b/VimR/VimR/MainWindow+Actions.swift @@ -24,6 +24,9 @@ extension MainWindow { switch event { + case .refreshFileBrowser: + self.refreshFileBrowser() + case .revealCurrentBufferInFileBrowser: self.revealCurrentBufferInFileBrowser() diff --git a/VimR/VimR/MainWindow.swift b/VimR/VimR/MainWindow.swift index dc423ec1..308ce403 100644 --- a/VimR/VimR/MainWindow.swift +++ b/VimR/VimR/MainWindow.swift @@ -599,6 +599,10 @@ final class MainWindow: NSObject, func revealCurrentBufferInFileBrowser() { self.fileBrowser?.scrollToSourceAction(nil) } + + func refreshFileBrowser() { + self.fileBrowser?.refreshAction(nil) + } } // NvimViewDelegate diff --git a/VimR/VimR/RpcEvents.swift b/VimR/VimR/RpcEvents.swift index 5e7f7a0a..dc562612 100644 --- a/VimR/VimR/RpcEvents.swift +++ b/VimR/VimR/RpcEvents.swift @@ -18,5 +18,6 @@ enum RpcEvent: String, CaseIterable { case setLinespacing = "com.qvacua.vimr.rpc-events.set-linespacing" case setCharacterspacing = "com.qvacua.vimr.rpc-events.set-characterspacing" - case revealCurrentBufferInFileBrowser = "com.qvacua.vimr.rpc-events.reveal-current-buffer-in-browser" + case revealCurrentBufferInFileBrowser = "com.qvacua.vimr.rpc-events.reveal-current-buffer-in-file-browser" + case refreshFileBrowser = "com.qvacua.vimr.rpc-events.refresh-file-browser" } diff --git a/VimR/VimR/com.qvacua.VimR.vim b/VimR/VimR/com.qvacua.VimR.vim index 54746518..56e96af8 100644 --- a/VimR/VimR/com.qvacua.VimR.vim +++ b/VimR/VimR/com.qvacua.VimR.vim @@ -21,15 +21,20 @@ function! s:VimRToggleToolButtons(value) abort call rpcnotify(0, 'com.qvacua.NvimView', 'toggle-tool-buttons', a:value) endfunction -function! s:VimRRevealCurrentBufferInFileExplorer() abort - " case revealCurrentBufferInFileBrowser = "com.qvacua.vimr.rpc-events.reveal-current-buffer-in-browser" - call rpcnotify(0, 'com.qvacua.NvimView', 'reveal-current-buffer-in-browser') -endfunction -command! -nargs=0 VimRRevealCurrentBuffer call s:VimRRevealCurrentBufferInFileExplorer() command! -nargs=0 VimRHideToolButtons call s:VimRToggleToolButtons(-1) command! -nargs=0 VimRToggleToolButtons call s:VimRToggleToolButtons(0) command! -nargs=0 VimRShowToolButtons call s:VimRToggleToolButtons(1) +function! s:VimRRevealCurrentBufferInFileBrowser() abort + call rpcnotify(0, 'com.qvacua.NvimView', 'reveal-current-buffer-in-file-browser') +endfunction +command! -nargs=0 VimRRevealCurrentBuffer call s:VimRRevealCurrentBufferInFileBrowser() + +function! s:VimRRefreshFileBrowser() abort + call rpcnotify(0, 'com.qvacua.NvimView', 'refresh-file-browser') +endfunction +command! -nargs=0 VimRRefreshFileBrowser call s:VimRRefreshFileBrowser() + function! s:VimRToggleFullscreen() abort call rpcnotify(0, 'com.qvacua.NvimView', 'toggle-fullscreen') endfunction From f5575c85824331d3423a8568f2aa3427ec711e11 Mon Sep 17 00:00:00 2001 From: Jonatan Anauati Date: Wed, 29 Jun 2022 20:31:29 -0300 Subject: [PATCH 3/6] Check if file exists. --- VimR/VimR/com.qvacua.VimR.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/VimR/VimR/com.qvacua.VimR.vim b/VimR/VimR/com.qvacua.VimR.vim index 56e96af8..6adc8e1f 100644 --- a/VimR/VimR/com.qvacua.VimR.vim +++ b/VimR/VimR/com.qvacua.VimR.vim @@ -26,7 +26,9 @@ command! -nargs=0 VimRToggleToolButtons call s:VimRToggleToolButtons(0) command! -nargs=0 VimRShowToolButtons call s:VimRToggleToolButtons(1) function! s:VimRRevealCurrentBufferInFileBrowser() abort - call rpcnotify(0, 'com.qvacua.NvimView', 'reveal-current-buffer-in-file-browser') + if filereadable(expand('%')) + call rpcnotify(0, 'com.qvacua.NvimView', 'reveal-current-buffer-in-file-browser') + endif endfunction command! -nargs=0 VimRRevealCurrentBuffer call s:VimRRevealCurrentBufferInFileBrowser() From 34c551e03c763389904056692ecb3191e865b7b9 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Thu, 30 Jun 2022 21:24:29 +0200 Subject: [PATCH 4/6] Update reslease notes --- resources/release-notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/release-notes.md b/resources/release-notes.md index 3c9ae570..32efd788 100644 --- a/resources/release-notes.md +++ b/resources/release-notes.md @@ -1,6 +1,6 @@ # Next -* ... +* Add `VimRRefreshFileBrowser` and `VimRRevealCurrentBufferInFileBrowser` functions. Thanks @jaanauati for the PR! # 0.41.2-20220628.220813 From 2b3475fa3b23f1b01b78270818ded261bb3868cb Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Thu, 30 Jun 2022 21:27:20 +0200 Subject: [PATCH 5/6] Update DEVELOP --- DEVELOP.md | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/DEVELOP.md b/DEVELOP.md index cd6aaeea..9d5c4bed 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -1,32 +1,12 @@ ## How to develop -### No change in NvimServer - -If you did not change NvimServer, i.e. NvimServer, NvimServerTypes, and neovim, -then, do the following to run VimR: - -* `./bin/download_nvimserver.sh` -* Run VimR scheme in Xcode - -A development version of VimR will be built and run, -i.e. the bundle identifier will be `com.qvacua.VimR.dev` and the name of the app will be `VimR-dev`. -If you want to build a development version as a release build, then use the following: +To build NvimServer, do the following ```bash -clean=true ./bin/build_vimr_dev.sh +build_libnvim=true clean=false ./bin/build_nvimserver_for_local_dev.sh ``` -### Changes in NvimServer - -Since SwiftPM does not support a script phase, we have to copy some files manually, -e.g. `NvimServer` binary. -This can be done with the following: - -```bash -build_libnvim=true clean=true ./bin/build_nvimserver_for_local_dev.sh -``` - -See the `build_nvimserver_for_local_dev` script for default values of the env vars. +You can set `clean=true` if you want to clean the existing build. You can also use a watch script as follows (it uses `entr`): ```bash From a4b0a62b1fb604e8aca0e177f74517db81d385e4 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Thu, 30 Jun 2022 21:28:45 +0200 Subject: [PATCH 6/6] Update DEVELOP --- DEVELOP.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/DEVELOP.md b/DEVELOP.md index 9d5c4bed..c35afa26 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -16,6 +16,14 @@ clean_initial_build=true ./bin/watch_nvimserver_and_build When `clean_initial_build` is `true`, the script will clean and build, then continuously invoke the `build_nvimserver_for_local_dev` script. +## How to build nightly + +```bash +git tag -f neovim-nightly; git push -f origin neovim-nightly +``` + +Then, GitHub actions will build and re-create the release. + ## How to release * Set a new version of VimR via