# **42 Header**
42Lausanne (Switzerland)
### **Description**
42 standard header for vim editor.

### **Usage**
In **NORMAL** mode (ESC) you can simply press the shortcut F2 (or FN F2) or use `:FT` as command.
```
vim 42.c
:wq
vim Makefile
:FT
:wq
```
### **Quick Setup**
Below replace "marvin" with your 42 Network login.
```
USER="marvin" ./set_header.sh
```
If you want to setup the same email and username for all your git:
```
git config --global user.name gbaconni
git config --global user.email gbaconni@student.42lausanne.ch
```
Otherwise setup it on a case-by-case basic:
```
git clone git@... project
cd project
git config user.name "marvin"
git config user.email "marvin@student.42lausanne.ch"
```
### **Manual Setup**
Below replace "marvin" with your 42 Network login.
Copy `stdheader.vim` in your `~/.vim/plugin`.
```
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
cp -va vim/stdheader.vim ~/.vim/plugin
```
If you want to setup the same email and username for all your git:
```
git config --global user.name gbaconni
git config --global user.email gbaconni@student.42lausanne.ch
```
Otherwise setup it on a case-by-case basic:
```
git clone git@... project
cd project
git config user.name "marvin"
git config user.email "marvin@student.42lausanne.ch"
```
UNIX/BSD Distro (MacOS X, FreeBSD, OpenBSD, etc.) edit `~/.zshrc`:
```
vim ~/.zshrc
export MAIL="marvin@student.42lausanne.ch"
:wq
source ~/.zshrc
```
Linux/GNU Distro (Debian/Ubuntu, RedHat/SuSE, Arch, Gentoo, etc.) edit `~/.bashrc`:
```
vim ~/.bashrc
export MAIL="marvin@student.42lausanne.ch"
:wq
source ~/.bashrc
```
### **Note**
- Your git username and email will always have the priority over $USER and $MAIL variables.
- If you are outside a git repo tree, it will use the $USER and $MAIL environement variables.
- I none of the above, it will default to marvin@student.42lausanne.ch and marvin as username.
- Usually you don't want to overwrite $USER as is the logged user and is already defined.
Troubleshooting:
```
git config user.name
echo $USER
git config user.email
echo $MAIL
grep -e ' USER=' -e ' MAIL=' ~/.zshrc
```
The location of this alternative version of stdheader.vim:
- ~/.vim/plugin/stdheader.vim
- $HOME/.vim/plugin/stdheader.vim
The location of the official stdheader.vim in 42lausanne's clusters:
- /usr/share/vim/vim80/plugin/stdheader.vim
- /usr/share/vim/vim81/plugin/stdheader.vim (at the time of writing)
- /usr/share/vim/vim82/plugin/stdheader.vim
### **Credits**
- [@42Paris](https://github.com/42Paris)
- [@zazard](https://github.com/zazard)
### **Bonus**
- Swissair is gone? Have a look to [Airline](https://github.com/vim-airline/vim-airline) for a nice status for vim.
```
test -d ~/.vim/plugin || mkdir -p ~/.vim/plugin
test -d ~/.vim/autoload || mkdir -p ~/.vim/autoload
git clone https://github.com/vim-airline/vim-airline.git vim-airline
cd vim-airline
cp -va autoload/* ~/.vim/autoload/
cp -va plugin/* ~/.vim/plugin/
```
[RTFM](https://github.com/vim-airline/vim-airline/blob/master/doc/airline.txt)
### **License**
This work is published under the terms of **[42 Unlicense](https://github.com/gcamerli/42unlicense)**.