Przeglądaj źródła

Added new features and fixed bugs:

+ added Makefile functionality to not compile a file if it haven't
    changed
    + you don't have to enter extension of the file in both create.sh
    and run.sh. You also can enter a filename with
    extension(works only with .cpp files)
    + fixed color.sh bug not printing the last line
master
RinRi 3 lat temu
rodzic
commit
ef53c92c4f
3 zmienionych plików z 26 dodań i 9 usunięć
  1. +10
    -0
      Makefile
  2. +4
    -3
      README.md
  3. +12
    -6
      setup.sh

+ 10
- 0
Makefile Wyświetl plik

@@ -0,0 +1,10 @@
CXX = g++
CXXFLAGS = -Wall -Werror -std=c++14

all: $(patsubst %.cpp, %.out, $(wildcard *.cpp))

%.out: %.cpp Makefile
$(CXX) $(CXXFLAGS) $< -o $@

clean:
rm *.out

+ 4
- 3
README.md Wyświetl plik

@@ -13,15 +13,16 @@ First, you have to write template which will be used to create new files. Rememb

# Using

In order to create a new .cpp file, you have to run create.sh with filename argument without an extension:
In order to create a new .cpp file, you have to run create.sh with filename argument:

```shell
./create.sh 1234a
```

You will be automatically redirected to neovim.
It will create 1234a.cpp. You can enter 1234a.cpp instead of 1234a and you will get the same result.
Then you will be automatically redirected to neovim.

To compile&run file, you can just use run.sh with filename(this time with extension):
To compile and run file, you can use run.sh with filename as an argument(you can use both filename with extension and without):

```shell
./run.sh 1234a.cpp


+ 12
- 6
setup.sh Wyświetl plik

@@ -1,22 +1,28 @@
mkdir .config.d

# create.sh
echo $'cp template.cpp $1.cpp\nnvim -s .gg $1.cpp' > create.sh
echo $'cp .config.d/template.cpp ${1%.*}.cpp\nnvim -s .config.d/cursorpos ${1%.*}.cpp' > create.sh

# template
read -n 1 -r -s -p $'Press any key to create template file...\n'
nvim template.cpp
nvim .config.d/template.cpp

# start line
read -p $'Enter starting line of cursor:\n' line
((line=line-1))
echo "$line"gg > .gg
echo "$line"gg > .config.d/cursorpos

# color.sh
echo $'echo -en "\033[31m" ## red\neval $* | while read line; do\necho -en "\033[36m" ## blue\necho $line\necho -en "\033[31m" ## red\ndone\necho -en "\033[0m" ## reset color' > color.sh
echo $'echo -en "\033[31m" ## red\neval $* | while read line; do\necho -en "\033[36m" ## blue\necho $line\necho -en "\033[31m" ## red\ndone\necho -en "\033[0m" ## reset color' > .config.d/color.sh

# run.sh
echo $'g++ -std=c++14 -g $1\necho "Compiled..."\n./color.sh ./a.out\necho' > run.sh
echo $'make\necho "Compiled..."\n./.config.d/color.sh .config.d/.nl ./"${1%.*}.out"\necho' > run.sh

# .nl
echo $'./$1\necho' > .config.d/.nl

# make all executable
chmod +x create.sh
chmod +x run.sh
chmod +x color.sh
chmod +x .config.d/color.sh
chmod +x .config.d/.nl

Ładowanie…
Anuluj
Zapisz