sudo apt-get install vim
If vi worked in your command line, it is most likely the light version of vi which is installed by default in Ubuntu, and it lacks most functionality of the real vi.
You also need to install
curlgitCMakeI assume most of you have already installed it, if not then install it via
sudo apt-get install curl
sudo apt-get install git
sudo apt-get install build-essential cmake
sudo apt-get install python-dev python3-dev
Pathogen is a vim plugin which allows you to easily install other plugins, by just adding files into the ~/.vim/bundle (There are other alternatives, but pathogen is most commonly used)
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
~/.vimrcexecute pathogen#infect()
syntax on
filetype plugin indent on
cd ~/.vim/bundle
git clone https://github.com/rust-lang/rust.vim.git
YouCompleteMe - a code-completion engine for Vim with support for C-family languages and Rust
cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe
cd ~/.vim/bundle/YouCompleteMe
git submodule update --init --recursive
./install.py --rust-completer
~/Developer
mkdir -p ~/Developer/
cd ~/Developer/
git clone --depth 1 --branch master https://github.com/rust-lang/rust rust-master
Add this to your .vimrc
let g:ycm_rust_src_path="/home/<username>/Developer/rust-master/src/"
vim-numbertoggle adds line numbers to the code you are editing.
Line numbers can either show absolute position or position relative to your cursor location.
This will boost your productivity later, when you orchestrate vim commands such as moving 10 lines below the current cursor position: 10j.
cd ~/.vim/bundle
git clone git://github.com/jeffkreeftmeijer/vim-numbertoggle.git
NERDtree for displaying files in a tabNERDTree is a file manager, that most text editors have, such as sublime, atom, or eclipse where it lists the files in the directory you are editing from.
cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git
~/.vimrcautocmd VimEnter * NERDTree
autocmd BufEnter * NERDTreeMirror
"CTRL-t to toggle tree view with CTRL-t
nmap <silent> <C-t> :NERDTreeToggle<CR>
"Set F2 to put the cursor to the nerdtree
nmap <silent> <F2> :NERDTreeFind<CR>
CTRL-t - Open/Close the files tab
CTRL-n - Toggle relative / absolute numbering
CTRL-ww - Switch between the files tab and the main window
F2 - Focus cursor to files tab
<Enter> - Open the focused files/directory, duh!
h,j,k,l - Navigate the cursor left, down, up, right respectively
i - Insert mode, you can start typing in your code.
<ESC> - Back to default mode, where you can issue commands in vi
:w - Write/save the file, you are editing
:wqa - Save the file, then quit the editor closing vi including the files tab
:bp - Open previous file/buffer
:bn - Open next file/buffer
:b <filename-part> - Open the file you are looking for without typing the exact filename
:vsp - Vertically split the window
:vsp <filename> - Open the file in vertical split
:sp - Horizontal split
:sp <filename> - Open the file in horizontal split
wq whenever you want to build the project.
A convenient way is to open a new tab in a terminal via <CTRL>-<SHIFT>-t
and issue your command (cargo build --release) from there. That way, you don't lose the state of your editor,
i.e. you can undo u or redo <CTRL>-r your code changes when neededAlternatively, you can compile your project without opening another terminal instance by issuing the command directly from vim using :! <external terminal command>
:! cargo run --release
view some files
vi main.rs

If you want to use the mouse to point and click files and move the cursor around, add this to your ~/.vimrc
"enable mouse support
set mouse=a
Additionally, you can use arrow keys to move the cursor around.
However, if you are really serious about using vi and want to maximize your vi skills, you should minimize the use of the arrow keys or the mouse.

Sometimes some of your files might get edited outside of your current vi session, such as other editors/code generators, dropbox sync, git pulls.
~/.vimrc to refresh them automatically
" check file change every 4 seconds ('CursorHold') and reload the buffer upon detecting change
set autoread
au CursorHold * checktime
In Linux distros, you have to install vim-gtk to gain clipboard functionality.
sudo apt-get install vim-gtk
Then you can
Copy to + register, which is the global/OS clipboard
"+y
Paste from + register
"+p
Pasting is equivalent to <CTRL>-<SHIFT>-v in insert mode.
It is equivalent to pasting (<CTRL>-v) in terminal.
~/.vimrc and .vim, if you have one
sudo apt-get install curl
curl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/setup.sh | sh
curl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/setup.sh | sh
curl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/uninstall.sh | sh
sudo apt-get install vim
If vi worked in your command line, it is most likely the light version of vi which is installed by default in Ubuntu, and it lacks most functionality of the real vi.
You also need to install
curlgitCMakeI assume most of you have already installed it, if not then install it via
sudo apt-get install curl
sudo apt-get install git
sudo apt-get install build-essential cmake
sudo apt-get install python-dev python3-dev
Pathogen is a vim plugin which allows you to easily install other plugins, by just adding files into the ~/.vim/bundle (There are other alternatives, but pathogen is most commonly used)
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
~/.vimrcexecute pathogen#infect()
syntax on
filetype plugin indent on
cd ~/.vim/bundle
git clone https://github.com/rust-lang/rust.vim.git
YouCompleteMe - a code-completion engine for Vim with support for C-family languages and Rust
cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe
cd ~/.vim/bundle/YouCompleteMe
git submodule update --init --recursive
./install.py --rust-completer
~/Developer
mkdir -p ~/Developer/
cd ~/Developer/
git clone --depth 1 --branch master https://github.com/rust-lang/rust rust-master
Add this to your .vimrc
let g:ycm_rust_src_path="/home/<username>/Developer/rust-master/src/"
vim-numbertoggle adds line numbers to the code you are editing.
Line numbers can either show absolute position or position relative to your cursor location.
This will boost your productivity later, when you orchestrate vim commands such as moving 10 lines below the current cursor position: 10j.
cd ~/.vim/bundle
git clone git://github.com/jeffkreeftmeijer/vim-numbertoggle.git
NERDtree for displaying files in a tabNERDTree is a file manager, that most text editors have, such as sublime, atom, or eclipse where it lists the files in the directory you are editing from.
cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git
~/.vimrcautocmd VimEnter * NERDTree
autocmd BufEnter * NERDTreeMirror
"CTRL-t to toggle tree view with CTRL-t
nmap <silent> <C-t> :NERDTreeToggle<CR>
"Set F2 to put the cursor to the nerdtree
nmap <silent> <F2> :NERDTreeFind<CR>
CTRL-t - Open/Close the files tab
CTRL-n - Toggle relative / absolute numbering
CTRL-ww - Switch between the files tab and the main window
F2 - Focus cursor to files tab
<Enter> - Open the focused files/directory, duh!
h,j,k,l - Navigate the cursor left, down, up, right respectively
i - Insert mode, you can start typing in your code.
<ESC> - Back to default mode, where you can issue commands in vi
:w - Write/save the file, you are editing
:wqa - Save the file, then quit the editor closing vi including the files tab
:bp - Open previous file/buffer
:bn - Open next file/buffer
:b <filename-part> - Open the file you are looking for without typing the exact filename
:vsp - Vertically split the window
:vsp <filename> - Open the file in vertical split
:sp - Horizontal split
:sp <filename> - Open the file in horizontal split
wq whenever you want to build the project.
A convenient way is to open a new tab in a terminal via <CTRL>-<SHIFT>-t
and issue your command (cargo build --release) from there. That way, you don't lose the state of your editor,
i.e. you can undo u or redo <CTRL>-r your code changes when neededAlternatively, you can compile your project without opening another terminal instance by issuing the command directly from vim using :! <external terminal command>
:! cargo run --release
view some files
vi main.rs

If you want to use the mouse to point and click files and move the cursor around, add this to your ~/.vimrc
"enable mouse support
set mouse=a
Additionally, you can use arrow keys to move the cursor around.
However, if you are really serious about using vi and want to maximize your vi skills, you should minimize the use of the arrow keys or the mouse.

Sometimes some of your files might get edited outside of your current vi session, such as other editors/code generators, dropbox sync, git pulls.
~/.vimrc to refresh them automatically
" check file change every 4 seconds ('CursorHold') and reload the buffer upon detecting change
set autoread
au CursorHold * checktime
In Linux distros, you have to install vim-gtk to gain clipboard functionality.
sudo apt-get install vim-gtk
Then you can
Copy to + register, which is the global/OS clipboard
"+y
Paste from + register
"+p
Pasting is equivalent to <CTRL>-<SHIFT>-v in insert mode.
It is equivalent to pasting (<CTRL>-v) in terminal.
~/.vimrc and .vim, if you have one
sudo apt-get install curl
curl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/setup.sh | sh
curl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/setup.sh | sh
curl -sSf https://raw.githubusercontent.com/ivanceras/rustupefy/master/uninstall.sh | sh