4

Neovim 在選擇檔案名稱時的操作按鍵

 3 years ago
source link: https://blog.gslin.org/archives/2021/07/11/10235/neovim-%e5%9c%a8%e9%81%b8%e6%93%87%e6%aa%94%e6%a1%88%e5%90%8d%e7%a8%b1%e6%99%82%e7%9a%84%e6%93%8d%e4%bd%9c%e6%8c%89%e9%8d%b5/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Neovim 在選擇檔案名稱時的操作按鍵

Neovim 時操作檔案名稱時會是下拉選單,在 insert mode 時的畫面是這樣 (進到 insert mode 後 Ctrl-X + F):

這時候可以用上下鍵選擇檔案名稱。

在 command mode 下也有類似的功能,像是 :sp 後按 tab 選擇檔案名稱:

問題在於只能用 Ctrl-N 與 Ctrl-P 移動,而不能用上下鍵操作,兩者的 UI 類似但是操作的方式不一樣,於是就翻了翻 manual,找出對應的模式,得到是 command mode,然後用 <expr> + pumvisible() 判斷是否是在 popup menu,接著把上下鍵對應到 Ctrl-N 與 Ctrl-P:

cnoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
cnoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"

這樣就搞定了...

Related

在 Mac 上用鍵盤操作的 Vimac

前幾天在 Hacker News 上看到 Vimac 這個專案,程式碼在 GitHub 的 dexterleng/vimac 上可以看到,而 Hacker News 上的討論則是在「Show HN: Vimac – Productive macOS keyboard-driven navigation (vimacapp.com)」這邊,因為是作者發表的,所以下面也有一些作者的回應。 作者是受到瀏覽器上 Vimium 啟發,利用 macOS 的 Accessibiltiy API 實做類似的想法,讓使用者可以使用鍵盤操作 (所以會需要授權開啟 Accessibility API)。 官方預設啟動 Hint Mode 的快速鍵是 Ctrl-Space,但這對中文使用者來說剛好卡到,所以我把他改成 Option-Space 了,按下去後畫面上會將可以點選的地方都加上快速鍵資訊,像是官方提供的樣式: 另外一個重點是捲動的功能,不過我目前還用的不多,不知道好不好用...

September 14, 2020

In "Computer"

試用 HP Cloud (Compute 部分)

剛剛註冊了 HP Cloud 測試 Compute 的部分 (相對於 AWS 就是 EC2)。 先就公開的資訊來看,其實還不錯?最小的 instance 是 Extra Small,規格是 1GB RAM + 30GB Disk,收費 USD$0.04/hour,如果是 Small 則是 2GB RAM + 60GB Disk,另外在 Public Beta 期間是 50% off (半價)。 頻寬部分與 AWS 美國區的價錢相同,Inbound 不收費,Outbound 與 AWS 階梯式相同。 有提供網頁介面操作外,也有提供 CLI 可以用:「Unix Command Line Interface」,看起來是 Ruby... (沒裝起來測) 實際註冊完成後可以由從…

July 20, 2012

In "Cloud"

在 VirtualBox 內安裝 ArchLinux 的紀錄

Debian 用一陣子後,發現 Python 2.6 在 lenny 的 backports 也沒有,一定得到 squeeze (目前的 testing) 找出來用,但如此一來就會有很多問題 (像是 testing 的 python library 使用 stable 的 C library),所以一直在覺得很煩... 另外,自己架設 APT 的熟練程度一直卡在沒有自動化工具,所以一直想要試試 Linux 上其他的 package system,但又不想要用 RPM,所以就挑上 ArchLinux 了... 不過在 VirtualBox 內裝 ArchLinux 遇到一些怪問題,總算是弄的差不多,紀錄起來讓其他人有機會少踩一些雷... 首先是抓 ISO image,最新的版本可以在 http://ftp.tku.edu.tw/Linux/ArchLinux/iso/latest/ (這是淡江大學的 mirror) 這邊抓到,我在寫這篇時是抓 archlinux-2009.08-netinstall-i686.iso,抓完之後先用工具確認檔案的 md5 與 sha1 有沒有問題,避免檔案壞掉造成安裝過程或結果異常。…

March 22, 2010

In "Computer"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on July 11, 2021Categories Computer, Editor, Murmuring, Software, VimTags command, editor, expr, file, filename, insert, map, mode, name, neovim, selection, vim

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

Post navigation


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK