Skip to content
Edward Brown edited this page Sep 26, 2016 · 3 revisions

###VIM

basic

vim is hard to get use to, here is a good web site for all commands http://www.tuxfiles.org/linuxhelp/vimcheat.html Just like .bashrc there is a .vimrc

user$ vim .vimrc

add these to the file

[i]	           # Press the I button to enter insert mode 
set ai	   # auto indent
set ts=4	   # set tab to 4 spaces
set et	   # save a tab as 4 spaces
set show mode  # show what mode you are in at the bottom (command, insert...)
set number	   # show line numbers
[Esc]	   # Press the Esc Key to enter command mode
[ZZ]           # Press SHIFT ZZ to save and exit

janus

Janus is a distribution of plug-ins and mappings for Vim, Gvim and MacVim. https://github.com/carlhuda/janus

curl -Lo- https://bit.ly/janus-bootstrap | bash

####Making shortcuts with alias

user$ vim .bash_aliases

Basic commands to add shortcuts for

alias ls='ls --color=always'	
alias ll='ls -l'	
alias la='ls -A'	
alias la='ls -lA	
alias c='clear'	
alias vi='vim'	
alias machinename='ssh [email protected]'	

Add this file to your .bashrc

user$ vim .bash_aliases

Add this to the end of the file

source .bash_aliases

Save file, source .bashrc

user$ source .bashrc

Copying file to and from another computer

  • Definitions
    • username - your username
    • computername - the hostname of the computer
    • shortcut-name - an abbreviated version of the host name
    • scp - secure copy
    • dir - directory
    • file - any .txt .cpp ....

####Long Way

Pushing to remote computer
scp file [email protected]:dir/file
Pulling from remote computer
scp [email protected]:dir/file file	
Logging into a remote computer

####Short Way

Edit your ssh config file
user$ vim ~/.ssh/config	

Add the following to the file

Host shortcut-name	
Hostname computername.llnl.gov
User username

Once you save and exit, source the file

user$ source ~/.ssh/config
Pushing to remote computer
scp file shortcut-name:dir/file
Pulling from remote computer
scp shortcut-name:dir/file file