An open API service indexing awesome lists of open source software.

https://github.com/1chooo/dotfiles

Some scripts to enhance my DEV Env.
https://github.com/1chooo/dotfiles

macos shell terminal

Last synced: 11 months ago
JSON representation

Some scripts to enhance my DEV Env.

Awesome Lists containing this project

README

          

# My Shell Setting

```shell
my-dotfile
├── vim
│   └── bundle/
├── git
│   └── setup.sh
├── .shellScripts
│   └── runc
├── oh-my-zsh/
└── zsh
```

- [My Shell Setting](#my-shell-setting)
- [Vim](#vim)
- [press `` to execute the code](#press-f5-to-execute-the-code)
- [oh-my-zsh](#oh-my-zsh)
- [Shell Scripts](#shell-scripts)
- [Compile c/cpp](#compile-ccpp)

## Vim

### press `` to execute the code

Add this block of code in your `~/.vimrc`.
```vim
nmap :call CompileRun()
func! CompileRun()
exec "w"
if &filetype == 'python'
exec "!time python3 %"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java %<"
elseif &filetype == 'cpp'
exec "!runc %"
elseif &filetype == 'c'
exec "!runc %"
elseif &filetype == 'sh'
:!time bash %
endif
endfunc
```

## oh-my-zsh

## Shell Scripts

### Compile c/cpp
```SHELL
#!/bin/zsh

if [[ "$1" == *.cpp ]]; then
output="${1%.cpp}"
elif [[ "$1" == *.c ]]; then
output="${1%.c}"
else
output="$1"
fi

gcc "$output".c -o "$output".out 2> /dev/null || clang++ -std=c++17 -stdlib=libc++ "$output".cpp -o "$output".out 2> /dev/null

"$PWD/$output".out

exit 0
```