Hongli SHEN && Ximing ZHENG
This project initializes the core functionalities of Vim on a Linux system using C++. It leverages <ncurses.h> to enhance its usability and interface.
- Basic parts
- Normal mode: file and mode commands, cursor movement, line navigation, basic editing.
- Insert mode: direct text insertion, new line creation, backspace support, real-time display update, cursor movement with typed text, exit to normal mode.
- Bonus parts
- undo and redo
- line numbers and jumping
- Search and replace
- switch through multiple files by command line, as well as editing them simultaneously
- UI improvements:
- better color
- mode display
- background color change
- warning messages display
- words underline
- font bold
- Hongli SHEN: Basic parts without overflow content, undo and redo, line numbers and jumping, background color, document.
- Ximing ZHENG: bug fixed, overflow content, background color change, search and replace, warning display, switch through multiple files, simultaneously editing, words underline, font bold.
CS219_Advanced_Programming_Project/ # The root directory
├── build/ # Build directory containing intermediate and binary files
│ ├── CMakeFiles/ # Auxiliary files generated by CMake
│ ├── cmake_install.cmake # CMake installation configuration file
│ ├── CMakeCache.txt # CMake cache file
│ ├── Makefile # Makefile generated by the build tool
│ └── MiniVim # The compiled executable file
│
├── files/ # files to edit, containing .txt files
│
├── include/ # Header file directory for storing declarations
│ └── MiniVim.h # Header file for the MiniVim module
│
├── src/ # Source code directory for implementation files
│ └── MiniVim.cpp # Implementation file for the MiniVim module
│
├── CMakeLists.txt # CMake build configuration file for defining build rules
├── main.cpp # Entry point of the program
├── README.md # Documentation providing an overview and usage instructions for the project
The project initialize the vim functions through a C++ class MiniVim. It include a head file <ncurses.h> for terminal-based capabilities. http://tldp.org/HOWTO/NCURSES-Programming-HOWTO
mkdir build #create a build folder
cd build #change directory to build
cmake ..
make
./minivim #run the programShould work for Linux.
you need to input a file name to enter the specific file.
#example: suppose you want to enter a file named text.txt
text We start with normal mode when enter mini-vim.
Normal mode
h,j,k,l: move the cursor(left,down,up,right)- Arrow keys to move the cursor
0: jump the cursor to the beginning of the current line$: jump the cursor to the end of the current linegg: move the cursor to the first line at the beginningG: move the cursor to the last line at the beginningdd: delete the current lineyy: copy the linep: paste the copied line below the cursorufor undo andCtrl+Rfor redoi: move to the insert modeCtrl+B: font boldCtrl+U: words underline
Insert mode
- type characters for insertion
enter: create a new linebackspace: delete characters- move cursor operations are the same as in normal mode
esc: exit to normal mode
we press : to enter command line mode when we are in the normal mode.
command line mode
:q: exit the program:w: save the file:wq: save the file and enter the program:+number: jump the cursor to the specific line at the beginning:background: change background color (light and black):cd/file_name: change directory to another files/old/new: replace the first old word in the current line to new wordss/old/new/g: replace all the old words in the file to new words