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.
- Host: GitHub
- URL: https://github.com/1chooo/dotfiles
- Owner: 1chooo
- Created: 2022-08-18T14:18:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T12:06:12.000Z (over 1 year ago)
- Last Synced: 2024-10-28T15:35:43.325Z (over 1 year ago)
- Topics: macos, shell, terminal
- Language: Shell
- Homepage:
- Size: 102 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
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
```