modifs de l'installation automatique et ajouts configs files autofill cpp

This commit is contained in:
Hugo LAMY
2022-03-01 18:37:48 +01:00
parent 308b4c4fdc
commit 9af0f4b1ad
23 changed files with 603 additions and 197 deletions

47
config_files/.screenrc Normal file
View File

@@ -0,0 +1,47 @@
#hugogogo#
startup_message off
chdir $HOME/
#pour augmenter le scrollback de l'ecran
defscrollback 10000
#pour afficher une ligne avec des infos
hardstatus on
#pour qu'elle s'affiche en bas
hardstatus alwayslastline
#tout ce qui n'est pas precede de % s'affiche tel quel
#tout ce qui est entre {} formate le texte
# = format texte inchange
# KW couleur arriere bright black, couleur texte bright white
# %n numero de windows
# %t title de windows
# %= remplis les espaces vides
# %c current time
# %d day
# %m month
# %y year
hardstatus string "%{= KW}%n %t %=%c %D %d-%m-%y"
#hide hardstatus: ctrl-a f
bind f eval "hardstatus ignore"
#show hardstatus: ctrl-a f
bind F eval "hardstatus alwayslastline"
#screen open a new windows
# -t assigne un titre
# vim appel vim avec l'option -n pour eviter les .swp
screen -t shell vim -n $HOME/huhuhu_config/tutos/shell.txt
screen -t git vim -n $HOME/huhuhu_config/tutos/git.txt
screen -t screen vim -n $HOME/huhuhu_config/tutos/screen.txt
screen -t node vim -n $HOME/huhuhu_config/tutos/node.txt
screen -t react vim -n $HOME/huhuhu_config/tutos/react.txt
screen -t php vim -n $HOME/huhuhu_config/tutos/php.txt
screen -t sites vim -n $HOME/huhuhu_config/tutos/sites.txt
screen -t vim vim -n $HOME/huhuhu_config/tutos/vim.txt
screen
#hugogogo#

222
config_files/.vimrc Normal file
View File

@@ -0,0 +1,222 @@
"#hugogogo#
"---------------------------------------------------------------
" base settings
"---------------------------------------------------------------
" Show (partial) command in status line.
"set showcmd
" Show matching brackets.
set showmatch
" Do case insensitive matching
set ignorecase
" Do smart case matching
set smartcase
" Incremental search
"set incsearch
" Automatically save before commands like :next and :make
"set autowrite
" Hide buffers when they are abandoned
set hidden
" Enable mouse usage (all modes)
set mouse=a
" turns on syntax hilighting
syntax on
" use coloration 'torte'
" and specify no coloration in the background
colo elflord
highlight Normal ctermbg=NONE
highlight nonText ctermbg=NONE
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" indent new line like the previous one
set autoindent
" show line number
set number
" whitespace characters are made visible
"set list
" don't allow wrap
set nowrap
"---------------------------------------------------------------
" pour pouvoir utiliser la norminette partout
"---------------------------------------------------------------
let g:norminette_exec = '~/.local/bin/norminette'
"---------------------------------------------------------------
" to move lines with Ctrl + arrow
"---------------------------------------------------------------
nnoremap <C-Down> :m+<CR>
nnoremap <C-Up> :m-2<CR>
nnoremap <C-Right> >><CR>k
nnoremap <C-Left> <<<CR>k
inoremap <C-Down> <Esc>:m+<CR>gi
inoremap <C-Up> <Esc>:m-2<CR>gi
inoremap <C-Right> <Esc>>><CR>gi
inoremap <C-Left> <Esc><<<CR>gi
vnoremap <C-Down> :m'>+<CR>gv
vnoremap <C-Up> :m-2<CR>gv
vnoremap <C-Right> ><CR>gv
vnoremap <C-Left> <<CR>gv
" move selection inside lines with Ctrl-Shift + left/right
vnoremap <C-S-Left> <Esc>`<<Left>i_<Esc>mz"_xgvx`zPgv<Left>o<Left>o
vnoremap <C-S-Right> <Esc>`><Right>gvxpgv<Right>o<Right>o
"---------------------------------------------------------------
" put swap files in a special directory
"---------------------------------------------------------------
" directory indique a vim où mettre les swap files a la place du
" dossier courrant, le double slash demande a vim de donner au
" swap file un nom avec son chemin d'acces pour eviter que deux
" fichiers du meme noms posent un probleme
set directory=~/.vim/swapfiles//
"---------------------------------------------------------------
" to autofill new files
"---------------------------------------------------------------
" to autofill a new Class.hpp file
function! HPPFile()
silent! 0r $HOME/.vim/templates/skeleton.hpp
%s/FileName/\=expand("%:t:r")/g
%s/FILENAME/\=toupper(expand("%:t:r"))/g
endfunction
" to autofill a new Class.cpp file
function! CPPFile()
silent! 0r $HOME/.vim/templates/skeleton.cpp
%s/FileName/\=expand("%:t:r")/g
endfunction
" to autofill a new main.cpp file
function! MAINCPPFile()
silent! 0r $HOME/.vim/templates/skeleton_main.cpp
endfunction
" to autofill a new Makefile file
function! MAKEFile()
silent! 0r $HOME/.vim/templates/skeleton_makefile
endfunction
" to autofill a new color.h file
function! COLORFile()
silent! 0r $HOME/.vim/templates/skeleton_color.h
endfunction
" autofill calls
autocmd BufNewFile *.hpp call HPPFile()
autocmd BufNewFile *.cpp if @% == 'main.cpp' | call MAINCPPFile() | else | call CPPFile()
autocmd BufNewFile Makefile call MAKEFile()
autocmd BufNewFile color.h call COLORFile()
"---------------------------------------------------------------
" pour mettre en gras dans des fichiers txt
"---------------------------------------------------------------
" BufEnter s'active quand un buffer est ouvert ou modifie
" setf = setfiletype defini un filetype text SI n'existe pas
" (!= 'set filetype=type') defini un new ft meme si existe
au BufEnter *.txt setf text
" conceal = hidden
" cocu (concealcursor) hidden in normal mode (v=visual i=insert)
" cole (conceallevel) hidden (0=not_hidden 1&2=replaced_by_smth)
au filetype text set cocu=n cole=3
" les trois lignes suivantes sont lancees par des auto commands
" pour declancher leur action malgre que les hilighting groups
" soient nettoyes par la commande 'hi clear' du fichier
" $VIMRUNTIME/color/default.vim
au filetype text hi AsteriskBold ctermfg=Green cterm=bold
au filetype text syn match Asterisks contained "**" conceal
au filetype text syn match AsteriskBold "\*\*.*\*\*" contains=Asterisks
"---------------------------------------------------------------
" remplis les elements de base d'un fichier html
"---------------------------------------------------------------
command! Html 0s/^/<!DOCTYPE html>\r<html lang="en" dir="ltr">\r\t<head>\r\t\t<meta charset="UTF-8">\r\t\t<meta name="viewport" content="width=device-width, initial-scale=1.0">\r\t\t<title><\/title>\r\t\t<meta name="description" content="description du site web">\r\t\t<meta name="keywords" content="truc, bidule, chouette">\r\t\t<link href=".\/style.css" type="text\/css" rel="stylesheet">\r\t\t<script type="text\/javascript" src="script.js" defer><\/script>\r\t<\/head>\r\t<body>\r\r\t<\/body>\r<\/html>
"---------------------------------------------------------------
" pour transformer un text html et/ou css en version affichable
"---------------------------------------------------------------
"remplace < et > par &lt; et &gt;
command! Compare %s/</\&lt;/g <bar> %s/>/\&gt;/g
"remplir les lignes vides avec des <br>
command! Ligne %s/^\n/<br>\r
"ajoute <p> et </p> en debut et fin de lignes
command! Paragraph %s/^/<p>/g <bar> %s/$/<\/p>/g
"remplace les indentations par deux espaces &nbsp
command! Indenta %s/\t/\&nbsp\&nbsp\&nbsp/g
"remplace les &lt; et &gt; autour des commentaires par CS et CE
command! Savecomment %s/&lt;!--/CS/g <bar> %s/--&gt;/CE/g
"entoure les tag apres < ou </ par <span id="tag"></span>
command! Tag %s#&lt[;/]*\zs[a-z0-9]*\ze#<span id=\"tag\">\0</span>#g
"entoure les signes < et > et / et { et } par <span id="sign"></span>
command! Sign %s#&lt;\zs/\ze#<span id=\"sign\">\0</span>#g <bar> %s#&[lg]t;#<span id=\"sign\">\0</span>#g <bar> %s#[{}]#<span id=\"sign\">\0</span>#g
"entoure les pseudos elements
command! Pseudo %s#:\zs[a-z]*\ze.<span id="sign">{#<span id=\"pseudo\">\0</span>#g
"entoure les selecteurs css avant les { par <span id="selec"></span>
command! Selec %s#<p>\zs[^:{]*\ze.*<span id="sign">{#<span id=\"selec\">\0</span>#g
"entoure les actions css avant les : par <span id="action"></span>
command! Action %s#&nbsp\zs[-a-zA-Z0-9]*\ze:#<span id=\"action\">\0</span>#g
"entoure toutes les specifications des tags html par <span id="special"><span>
command! Special %s#</span>\zs[^>]*\ze<span id="sign">&gt;#<span id=\"special\">\0</span>#g
"entoure les commentaires par <span id="comment"></span>
command! Comment %s#\(CS\)\(.*\)\(CE\)#<span id=\"comment\">\&lt;!--\2--\&gt;</span>#g <bar> %s#/\*.*\*/#<span id=\"comment\">\0</span>#g
function! Editax()
Compare
Ligne
Paragraph
Indenta
Savecomment
Tag
Sign
Pseudo
Selec
Action
Special
Comment
Start
End
endfunction
"ajoute toutes les lignes du debut
command! Start 0s/^/<!DOCTYPE html>\r<html>\r<head>\r<style>\r#cadre {\r position: fixed;\r top: 10vh;\r left: calc(50% - 250px);\r width: 500px;\r max-width: 80vw;\r height: 80vh;\r padding: 10px;\r overflow: hidden;\r border-radius: 10px;\r background-color: rgba(50, 50, 50, 0.9);\r}\r#scroll {\r height: 100%;\r width: calc(100% + 25px);\r box-sizing: border-box;\r padding-right: 10px;\r overflow-y: scroll;\r}\r#scroll p {\r margin: 0;\r padding: 0;\r color: #d3d3d3;\r}\r#tag {\r color: #669999;\r}\r#sign {\r color: white;\r}\r#action {\r color: #cc66cc;\r}\r#selec {\r color: #ff6633;\r}\r#pseudo {\r color: yellow;\r}\r#special {\r color: #8585ad;\r}\r#comment {\r color: #909090;\r}\r<\/style>\r<\/head>\r<body>\r<div id=\"cadre">\r<div id=\"scroll">\r\r<p>\&lt;!DOCTYPE html\&gt;<\/p>\r
"ajoute toutes les lignes de la fin
command! End $s/$/\r\r<\/div>\r<\/div>\r<\/body>\r<\/html>

77
config_files/.zshrc Normal file
View File

@@ -0,0 +1,77 @@
#hugogogo#
# ----------------------------------------------------
# aliases
# ----------------------------------------------------
alias open="xdg-open"
# ----------------------------------------------------
# configs from old file
# ----------------------------------------------------
#export ZSH="/mnt/nfs/homes/hulamy/.oh-my-zsh"
#plugins=(git)
#source $ZSH/oh-my-zsh.sh
#ZSH_THEME="robbyrussell"
# ----------------------------------------------------
# send the path of the working directory and action to
# screen as a title
# ----------------------------------------------------
# the preexec hook is run after "enter" is press and
# just before the command is run
#
# the precmd hook is executed just before each prompt
#
# a command confirmed on the prompt is then passed to
# preexec in three arguments, the first beeing the
# string typed (so "$1" is what was typed in prompt)
#
# variables are declared local to exist only in this hook
# there mustn't have space around the "=" to assign a value
#
# ps is a UNIX command that show informations about processes
# "-o stat" show only the status (T=sleeping and R=running)
# "-o cmd" show the command ("vim index.html")
# "h" hide the header
# "T" show all precesses (included the sleeping ones)
#
# "\ekTITLE\e\\" is a sequence recognised by GNU screen
# to set the title (see "info screen -n 'dynamyc titles'")
#
# "%~" is expanded into the current directory path
# "%1~" is expanded into the last argument of the path
# "-P" is an option of print that "turns on prompt expansions"
# DOCUMENTATION:
# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html
# preexec () {
# local isSleep=$(ps -o stat hT | grep T)
# local action=$1
# if [[ $isSleep == 'T' ]]; then
# action=$(ps -o stat -o cmd hT | sed -n 's/^T[ ]*//p')
# fi
# if [[ $TERM == screen* ]]; then
# print -Pn '\ek%2~/ $action\e\\'
# fi
# }
# precmd () {
# local isSleep=$(ps -o stat hT | grep T)
# local sleep=""
# local action=$(history | tail -1 | sed 's#[0-9 ]*##')
# if [[ $isSleep == 'T' ]]; then
# sleep="*$(ps -o stat -o cmd hT | sed -n 's/^T[ ]*//p')*"
# fi
# if [[ $TERM == screen* ]]; then
# print -Pn '\ek%2~/ $action $sleep\e\\'
# fi
# }

71
config_files/skeleton.cpp Normal file
View File

@@ -0,0 +1,71 @@
#include "FileName.hpp"
#define COPLIEN_COLOR B_CYAN
/*********************************************
* CONSTRUCTORS
*********************************************/
FileName::FileName( std::string foo = FileName::_bar ) : _foo(foo) {
// std::cout << COPLIEN_COLOR "FileName constructor" RESET "\n";
return;
}
FileName::FileName( FileName const & src ) {
// std::cout << COPLIEN_COLOR "FileName copy constructor" RESET "\n";
*this = src;
return;
}
/*********************************************
* DESTRUCTORS
*********************************************/
FileName::~FileName() {
// std::cout << COPLIEN_COLOR "FileName destructor" RESET "\n";
return;
}
/*********************************************
* OPERATORS
*********************************************/
FileName & FileName::operator=( FileName const & rhs ) {
// Base::operator=(rhs);
if ( this != &rhs )
{
// _foo = rhs.getFoo();
}
return *this;
}
//std::ostream & operator<<(std::ostream & o, FileName const & rhs)
//{
// o << rhs.getFoo();
// return (o);
//}
/*********************************************
* ACCESSORS
*********************************************/
//std::string FileName::getFoo() const {return _foo;}
/*********************************************
* PUBLIC MEMBER FUNCTIONS
*********************************************/
//void FileName::function(const std::string & foo) {}
/*********************************************
* NESTED CLASS
*********************************************/
//void FileName::Class::function() {}
/*********************************************
* STATICS
*********************************************/
//std::string const FileName::_bar = "bar";

31
config_files/skeleton.hpp Normal file
View File

@@ -0,0 +1,31 @@
#ifndef FILENAME_HPP
# define FILENAME_HPP
# include "color.h"
# include <iostream>
# include <string>
class FileName {
public:
FileName();
FileName( FileName const & src );
~FileName();
FileName & operator=( FileName const & rhs );
// std::string getFoo() const;
protected:
// std::string const _foo;
private:
// static std::string const FileName::_bar;
};
//std::ostream & operator<<(std::ostream & o, FileName const & rhs);
#endif

View File

@@ -0,0 +1,24 @@
#ifndef COLOR_H
# define COLOR_H
# define GRAY "\e[0;30m"
# define RED "\e[0;31m"
# define GREEN "\e[0;32m"
# define YELLOW "\e[0;33m"
# define BLUE "\e[0;34m"
# define PURPLE "\e[0;35m"
# define CYAN "\e[0;36m"
# define WHITE "\e[0;37m"
# define B_GRAY "\e[1;30m"
# define B_RED "\e[1;31m"
# define B_GREEN "\e[1;32m"
# define B_YELLOW "\e[1;33m"
# define B_BLUE "\e[1;34m"
# define B_PURPLE "\e[1;35m"
# define B_CYAN "\e[1;36m"
# define B_WHITE "\e[1;37m"
# define RESET "\e[0m"
#endif

View File

@@ -0,0 +1,6 @@
#include <iostream>
#include <string>
int main() {
return 0;
}

View File

@@ -0,0 +1,74 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . name = value \ . += append to a variable #
# VARIABLES . value . != set result of command #
# . name is case sensitive . ?= set if not already set #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
NAME = a.out
#TYPE = c
TYPE = cpp
ifeq "$(TYPE)" "c"
CC = c
EXT = c
else ifeq "$(TYPE)" "cpp"
CC = c++
EXT = cpp
endif
CFLAGS = -Wall -Wextra -Werror $(INCLUDES)
ifeq "$(TYPE)" "cpp"
CFLAGS += -std=c++98
endif
VPATH = $(D_SRCS)
LIBS =
INCLUDES = -I$(D_HEADERS)
D_SRCS = .
SRCS = main.cpp
D_HEADERS = .
HEADERS =
D_OBJS = builds
OBJS = $(SRCS:%.$(EXT)=$(D_OBJS)/%.o)
ifeq "$(D_OBJS)" "."
RM_OBJS = rm -f $(OBJS)
else
RM_OBJS = rm -rf $(D_OBJS)
endif
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# . target: prerequisites . $@ : target #
# RULES . recipe . $< : 1st prerequisite #
# . recipe . $^ : all prerequisites #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
all: $(NAME)
$(D_OBJS)/%.o: %.$(EXT) | $(D_OBJS)
$(CC) $(CFLAGS) -c $< -o $@
$(D_OBJS):
mkdir $@
$(OBJS): $(HEADERS:%=$(D_HEADERS)/%)
$(NAME): $(OBJS)
$(CC) $(OBJS) -o $@ $(LIBS)
clean:
$(RM_OBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY : all clean fclean re