Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Completed
Categories MongoDB Shell
Created by Guest
Created on Jun 29, 2020

Vi mode for MongoDB Shell

Please enable a 'vi' editing mode for the mongo shell. - Similar to vi mode in bash - Similar to https://www.npmjs.com/package/mongovi A first cut of key bindings would be: Basic command mode/editing mode toggling: i Insert before cursor Esc Toggle to command mode Cursor motion keys: h Move left j Move down k Move up l Move right w Move to next word b Move to the beginning of the word 0 Move to the beginning of the line $ Move to the end of the line And delete/change: x delete next character to the right d {motion} delete amount specified by {motion} c {motion} delete amount specified by {motion} and also put you in insert mode
  • Guest
    Oct 9, 2023
    You can use an external editor (see docs: https://www.mongodb.com/docs/mongodb-shell/reference/editor-mode/#using-an-external-editor). For vi specifically, you can run `config.set( "editor", "vi" )` in mongosh and launch a vi editor by subsequently running `edit` in mongosh.
  • Guest
    Jul 16, 2021
    Looking forward to external editor support by EDITOR environment.
  • Guest
    Jun 29, 2020
    The new MongoDB shell (built on the node REPL) includes an editor mode (activated with .editor) that provides multiline editing capabilities. Additionally, in the future, we will support using an external editor by setting the EDITOR environment variable similarly to how mongo does it. vi mode directly in the REPL is not something we will prioritize now but we'll definitely keep it in mind as a future usability improvement.