+++ /dev/null
-/*-----------------------------------------------------------------------------
-* File Name:
-* Purpose:
-* Creation Date:
-* Last Modified:
-* Created by:
------------------------------------------------------------------------------*/
+++ /dev/null
-# _ _ __ ____ __
-# (_)___ (_) /___________ / __/___ _____ _____ ____/ /__ _ __
-# / / __ \/ / __/ ___/ ___/ / /_/ __ \/ ___/ / ___/ / __ / _ \ | / /
-# / / / / / / /_/ / / /__ / __/ /_/ / / / /__ / /_/ / __/ |/ /
-#/_/_/ /_/_/\__/_/ \___/ /_/ \____/_/ \___/ \__,_/\___/|___/
-
-# tags generation
-tags() {
- find "${SRC_DIR}" \
- -type f -iname *.c -o -iname *.cpp -o -iname *.h -o -iname *.hpp | \
- xargs g++ -I${INC_DIR} -M | \
- sed -e 's/[\ ]/\n/g' | \
- sed -e '/^$/d' -e '/.o:[ \t]*$/d' | \
- xargs -n1 | \
- sort -u | \
- exctags -L - --c++-kinds=+p --c-kinds=+p --fields=+iaS --extras=+q
-}
-
-genmake() {
- MAKE_FILE="${PRJ_DIR}/Makefile"
- if [[ ! -f "${MAKE_FILE}" ]]; then
- echo -e "LINK_TARGET = \$(OUT_DIR)/\$(PRJ_NAME)" >> "${MAKE_FILE}"
- echo -e "OBJS = \$(shell find \$(SRC_DIR) -type f -iname *.cpp | xargs -n1 basename | sed 's/\.cpp/\.o/g')" >> ${MAKE_FILE}
- echo -e "" >> ${MAKE_FILE}
- echo -e "all : \$(LINK_TARGET)" >> ${MAKE_FILE}
- echo -e "\t@echo All done" >> ${MAKE_FILE}
- echo -e "" >> ${MAKE_FILE}
- echo -e "\$(LINK_TARGET) : \$(patsubst %,\$(OUT_DIR)/%,\$(OBJS))" >> ${MAKE_FILE}
- echo -e "\t\$(CMP) \$(CFLAGS) -o \$@ \$^ \$(LFLAGS)" >> ${MAKE_FILE}
- echo -e "" >> ${MAKE_FILE}
- echo -e "\$(OUT_DIR)/%.o : \$(SRC_DIR)/%.cpp" >> "${MAKE_FILE}"
- echo -e "\t\$(CMP) \$(CFLAGS) -o \$@ -c \$(IFLAGS) \$<" >> ${MAKE_FILE}
- echo -e "" >> ${MAKE_FILE}
- echo -e "run : \$(LINK_TARGET)" >> ${MAKE_FILE}
- echo -e "\t\$(LINK_TARGET)" >> ${MAKE_FILE}
- echo -e "" >> ${MAKE_FILE}
- echo -e "clean :" >> ${MAKE_FILE}
- echo -e "\trm -f \$(OUT_DIR)/*" >> ${MAKE_FILE}
- echo -e "\t@echo Rebuildables cleaned" >> ${MAKE_FILE}
- fi
-}
-
-build() {
- [[ ! -d "${OUT_DIR}" ]] && mkdir ${OUT_DIR}
- genmake && make
-}
-
-run() {
- make run
-}
-
-clean() {
- [[ -d "${OUT_DIR}" ]] && make clean
-}
-
-vpe() {
- vi -u "${CFG_DIR}/.vimrc" "${PRJ_DIR}"
-}
-
-lgdb() {
- tail -f "${PRJ_DIR}/gdb.txt"
-}
-
-srcp() {
- source "${CFG_DIR}/.initrc"
-}
-
-# Following project specific variables should be added by tmux session start script
+++ /dev/null
-" _ ____ __
-" _ __(_)___ ___ __________ / __/___ _____ _____ ____/ /__ _ __
-" | | / / / __ `__ \/ ___/ ___/ / /_/ __ \/ ___/ / ___/ / __ / _ \ | / /
-" _| |/ / / / / / / / / / /__ / __/ /_/ / / / /__ / /_/ / __/ |/ /
-"(_)___/_/_/ /_/ /_/_/ \___/ /_/ \____/_/ \___/ \__,_/\___/|___/
-
-source ~/.vimrc
-
-packadd termdebug
-
-set colorcolumn=80
-
-highlight ColorColumn ctermbg=darkgray
-
-augroup project
- autocmd!
- autocmd BufRead,BufNewFile *.h,*.c set filetype=c.doxygen
-augroup END
-
-let &path.="src/include,/usr/include/AL,/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include,/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9"
-
-let g:ycm_enable_diagnostic_signs = 0
-let g:ycm_enable_diagnostic_highlighting = 0
-let g:ycm_confirm_extra_conf = 0
-
-let g:ycm_warning_symbol = ''
-let g:ycm_error_symbol = ''
-
-let g:ycm_global_ycm_extra_conf = "$CFG_DIR/ycm_extra_conf.py"
-
-highlight YcmWarningLine guibg=#6C6C6C
-highlight YcmErrorLine guibg=#6C6C6C
-
-" TagBar configuration
-let g:tagbar_ctags_bin = "exctags"
-map <F8> :TagbarToggle<CR>
-map <leader>[ :pop<CR>
-map <leader>t :tnext<CR>
-
-" Termdebug configuration
-let g:exec_file_name = "$OUT_DIR/$PRJ_NAME"
-map <expr> <F9> ":Termdebug<CR><C-w>t<C-w>H:aunmenu WinBar<CR><C-w>bset trace-commands on<CR>set logging on<CR>file " . expand(g:exec_file_name) . "<CR>"
-map <leader>b :Break<CR>
-
-" File header insertion
-autocmd BufNewFile *.c,*.cpp,*.h,*.hpp 0r $CFG_DIR/header.txt
-autocmd BufNewFile *.c,*.cpp,*.h,*.hpp exe "1," . 7 . "g/.*File Name:.*/s//\* File Name: " . expand('%:t')
-autocmd BufNewFile *.c,*.cpp,*.h,*.hpp exe "1," . 7 . "g/.*Creation Date:.*/s//\* Creation Date: " . strftime("%d-%m-%Y")
-autocmd BufNewFile *.c,*.cpp,*.h,*.hpp exe "1," . 7 . "g/.*Created by:.*/s//\* Created by: " . system('whoami')
-autocmd Bufwritepre,filewritepre *.c,*.cpp,*.h,*.hpp execute "normal ma"
-
-autocmd Bufwritepre,filewritepre *.c,*.cpp,*.h,*.hpp exe "1," . 7 . "g/.*Last Modified:.*/s//\* Last Modified: " . strftime("%c")
-autocmd Bufwritepost,filewritepost *.c,*.cpp,*.h,*.hpp execute "normal `a"
+++ /dev/null
-import os
-import os.path
-import fnmatch
-import logging
-import ycm_core
-import re
-
-BASE_FLAGS = [
- '-Wall',
- '-Wextra',
- '-Werror',
- '-Wno-long-long',
- '-Wno-variadic-macros',
- '-fexceptions',
- '-ferror-limit=10000',
- '-DNDEBUG',
- '-std=c++1z',
- '-xc++',
- '-I/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9',
- '-I/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include',
- '-I/usr/include'
- ]
-
-SOURCE_EXTENSIONS = [
- '.cpp',
- '.cxx',
- '.cc',
- '.c',
- '.m',
- '.mm'
- ]
-
-SOURCE_DIRECTORIES = [
- 'src',
- 'lib'
- ]
-
-HEADER_EXTENSIONS = [
- '.h',
- '.hxx',
- '.hpp',
- '.hh'
- ]
-
-HEADER_DIRECTORIES = [
- 'include',
- 'src/include'
- ]
-
-BUILD_DIRECTORY = 'build';
-
-def IsHeaderFile(filename):
- extension = os.path.splitext(filename)[1]
- return extension in HEADER_EXTENSIONS
-
-def GetCompilationInfoForFile(database, filename):
- if IsHeaderFile(filename):
- basename = os.path.splitext(filename)[0]
- for extension in SOURCE_EXTENSIONS:
- # Get info from the source files by replacing the extension.
- replacement_file = basename + extension
- if os.path.exists(replacement_file):
- compilation_info = database.GetCompilationInfoForFile(replacement_file)
- if compilation_info.compiler_flags_:
- return compilation_info
- # If that wasn't successful, try replacing possible header directory with possible source directories.
- for header_dir in HEADER_DIRECTORIES:
- for source_dir in SOURCE_DIRECTORIES:
- src_file = replacement_file.replace(header_dir, source_dir)
- if os.path.exists(src_file):
- compilation_info = database.GetCompilationInfoForFile(src_file)
- if compilation_info.compiler_flags_:
- return compilation_info
- return None
- return database.GetCompilationInfoForFile(filename)
-
-def FindNearest(path, target, build_folder=None):
- candidate = os.path.join(path, target)
- if(os.path.isfile(candidate) or os.path.isdir(candidate)):
- logging.info("Found nearest " + target + " at " + candidate)
- return candidate;
-
- parent = os.path.dirname(os.path.abspath(path));
- if(parent == path):
- raise RuntimeError("Could not find " + target);
-
- if(build_folder):
- candidate = os.path.join(parent, build_folder, target)
- if(os.path.isfile(candidate) or os.path.isdir(candidate)):
- logging.info("Found nearest " + target + " in build folder at " + candidate)
- return candidate;
-
- return FindNearest(parent, target, build_folder)
-
-def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
- if not working_directory:
- return list(flags)
- new_flags = []
- make_next_absolute = False
- path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
- for flag in flags:
- new_flag = flag
-
- if make_next_absolute:
- make_next_absolute = False
- if not flag.startswith('/'):
- new_flag = os.path.join(working_directory, flag)
-
- for path_flag in path_flags:
- if flag == path_flag:
- make_next_absolute = True
- break
-
- if flag.startswith(path_flag):
- path = flag[ len(path_flag): ]
- new_flag = path_flag + os.path.join(working_directory, path)
- break
-
- if new_flag:
- new_flags.append(new_flag)
- return new_flags
-
-
-def FlagsForClangComplete(root):
- try:
- clang_complete_path = FindNearest(root, '.clang_complete')
- clang_complete_flags = open(clang_complete_path, 'r').read().splitlines()
- return clang_complete_flags
- except:
- return None
-
-def FlagsForInclude(root):
- try:
- include_path = FindNearest(root, 'include')
- flags = []
- for dirroot, dirnames, filenames in os.walk(include_path):
- flags = flags + ["-I" + dirroot]
- for dir_path in dirnames:
- real_path = os.path.join(dirroot, dir_path)
- flags = flags + ["-I" + real_path]
- return flags
- except:
- return None
-
-def FlagsForCompilationDatabase(root, filename):
- try:
- # Last argument of next function is the name of the build folder for
- # out of source projects
- compilation_db_path = FindNearest(root, 'compile_commands.json', BUILD_DIRECTORY)
- compilation_db_dir = os.path.dirname(compilation_db_path)
- logging.info("Set compilation database directory to " + compilation_db_dir)
- compilation_db = ycm_core.CompilationDatabase(compilation_db_dir)
- if not compilation_db:
- logging.info("Compilation database file found but unable to load")
- return None
- compilation_info = GetCompilationInfoForFile(compilation_db, filename)
- if not compilation_info:
- logging.info("No compilation info for " + filename + " in compilation database")
- return None
- return MakeRelativePathsInFlagsAbsolute(
- compilation_info.compiler_flags_,
- compilation_info.compiler_working_dir_)
- except:
- return None
-
-def FlagsForFile(filename):
- root = os.path.realpath(filename);
- compilation_db_flags = FlagsForCompilationDatabase(root, filename)
- if compilation_db_flags:
- final_flags = compilation_db_flags
- else:
- final_flags = BASE_FLAGS
- clang_flags = FlagsForClangComplete(root)
- if clang_flags:
- final_flags = final_flags + clang_flags
- include_flags = FlagsForInclude(root)
- if include_flags:
- final_flags = final_flags + include_flags
- return {
- 'flags': final_flags,
- 'do_cache': True
- }
+++ /dev/null
-"
-" _ __(_)___ ___ __________
-" | | / / / __ `__ \/ ___/ ___/
-" _| |/ / / / / / / / / / /__
-"(_)___/_/_/ /_/ /_/_/ \___/
-
-set nocompatible
-
-let mapleader =","
-
-" ----------------------------------------
-" Automatic installation of vim-plug, if it's not available
-" ----------------------------------------
-if empty(glob('~/.vim/autoload/plug.vim'))
- silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
- \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
-endif
-"-----------------------------------------
-
-"-----------------------------------------
-" Automatically install missing plugins on startup
-"-----------------------------------------
-autocmd VimEnter *
- \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
- \| PlugInstall --sync | q
- \| endif
-"-----------------------------------------
-
-silent! if plug#begin('~/.vim/plugged')
-Plug 'tpope/vim-surround'
-Plug 'scrooloose/nerdtree'
-Plug 'PotatoesMaster/i3-vim-syntax'
-Plug 'jreybert/vimagit'
-Plug 'LukeSmithxyz/vimling'
-Plug 'vimwiki/vimwiki'
-Plug 'terryma/vim-multiple-cursors'
-Plug 'bling/vim-airline'
-Plug 'tpope/vim-commentary'
-Plug 'vifm/vifm.vim'
-Plug 'kovetskiy/sxhkd-vim'
-Plug 'kien/ctrlp.vim'
-Plug 'ycm-core/YouCompleteMe'
-Plug 'majutsushi/tagbar'
-Plug 'preservim/nerdcommenter'
-call plug#end()
-endif
-
-augroup project
- autocmd!
- autocmd BufRead,BufNewFile *.mrc set filetype=sh
-augroup END
-
-let g:deoplete#enable_at_startup = 1
-
-set exrc
-set secure
-
-set bg=light
-set go=a
-set mouse=a
-set nohlsearch
-set clipboard=unnamedplus
-set tabstop=4 shiftwidth=4 expandtab
-set list
-set listchars=eol:↴,nbsp:_,tab:⇒⇒,trail:∙,extends:>,precedes:<
-set backspace=indent,eol,start
-set nowrap
-
-" Some basics:
- filetype plugin on
- syntax on
- set encoding=utf-8
- set number relativenumber
-
-" Enable autocomplete:
- set wildmode=longest,list,full
-
-" Disable automatic commenting newline:
- autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
-
-" Spell-check set to <leader>o, 'o' for 'orthography':
- map <leader>o :setlocal spell! spelllang=en_us<CR>
-
-" Splits open at the bottom and right, which is non-retarded:
- set splitbelow splitright
-
-" Shortcuts for ctrlp
- map <leader>r :CtrlPBuffer<CR>
-
-" Shortcuts for split navigation, saving a key press:
- map <C-h> <C-w>h
- map <C-j> <C-w>j
- map <C-k> <C-w>k
- map <C-l> <C-w>l
-
-" Check file in shellcheck:
- map <leader>s :!clear && shellcheck %<CR>
-
-" Atomatically deletes all trailing whitespaces on save:
- autocmd BufWritePre * %s/\s\+$//e
-
-" Some bindings for tabs
- map <leader>f :tabnew
- map <leader>> :tabn<CR>
- map <leader>< :tabp<CR>
-
-" Buffers bindings
- map <leader>x :bd %<CR>
-
-" Nerd tree
- map <leader>n :NERDTreeToggle<CR>
- autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
-
-" Openning a new buffer in a vertical split
- map <leader>vn :vnew<CR>
-
-" Default YCM config
-let g:ycm_global_ycm_extra_conf = '~/.dotfiles/vim/ycm_extra_conf_global.py'
-let g:ycm_enable_diagnostic_signs = 0
-let g:ycm_enable_diagnostic_highlighting = 0
-let g:ycm_confirm_extra_conf = 0
-
-" Some airlines configs
-let g:airline_powerline_fonts = 1
+++ /dev/null
-# This file is NOT licensed under the GPLv3, which is the license for the rest
-# of YouCompleteMe.
-#
-# Here's the license text for this file:
-#
-# This is free and unencumbered software released into the public domain.
-#
-# Anyone is free to copy, modify, publish, use, compile, sell, or
-# distribute this software, either in source code form or as a compiled
-# binary, for any purpose, commercial or non-commercial, and by any
-# means.
-#
-# In jurisdictions that recognize copyright laws, the author or authors
-# of this software dedicate any and all copyright interest in the
-# software to the public domain. We make this dedication for the benefit
-# of the public at large and to the detriment of our heirs and
-# successors. We intend this dedication to be an overt act of
-# relinquishment in perpetuity of all present and future rights to this
-# software under copyright law.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-# OTHER DEALINGS IN THE SOFTWARE.
-#
-# For more information, please refer to <http://unlicense.org/>
-
-from distutils.sysconfig import get_python_inc
-import platform
-import os
-import subprocess
-import ycm_core
-
-DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) )
-DIR_OF_THIRD_PARTY = os.path.join( DIR_OF_THIS_SCRIPT, '.' )
-SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
-
-# These are the compilation flags that will be used in case there's no
-# compilation database set (by default, one is not set).
-# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR.
-flags = [
-'-Wall',
-'-Wextra',
-'-Werror',
-'-Wno-long-long',
-'-Wno-variadic-macros',
-'-fexceptions',
-'-DNDEBUG',
-# You 100% do NOT need -DUSE_CLANG_COMPLETER and/or -DYCM_EXPORT in your flags;
-# only the YCM source code needs it.
-'-DUSE_CLANG_COMPLETER',
-'-DYCM_EXPORT=',
-# THIS IS IMPORTANT! Without the '-x' flag, Clang won't know which language to
-# use when compiling headers. So it will guess. Badly. So C++ headers will be
-# compiled as C headers. You don't want that so ALWAYS specify the '-x' flag.
-# For a C project, you would set this to 'c' instead of 'c++'.
-'-x', 'c++',
-'-isystem', '/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9',
-'-isystem', '/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include',
-'-isystem', '/usr/include',
-]
-
-# Clang automatically sets the '-std=' flag to 'c++14' for MSVC 2015 or later,
-# which is required for compiling the standard library, and to 'c++11' for older
-# versions.
-if platform.system() != 'Windows':
- flags.append( '-std=c++11' )
-
-
-# Set this to the absolute path to the folder (NOT the file!) containing the
-# compile_commands.json file to use that instead of 'flags'. See here for
-# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
-#
-# You can get CMake to generate this file for you by adding:
-# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
-# to your CMakeLists.txt file.
-#
-# Most projects will NOT need to set this to anything; you can just change the
-# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
-compilation_database_folder = ''
-
-if os.path.exists( compilation_database_folder ):
- database = ycm_core.CompilationDatabase( compilation_database_folder )
-else:
- database = None
-
-
-def IsHeaderFile( filename ):
- extension = os.path.splitext( filename )[ 1 ]
- return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
-
-
-def FindCorrespondingSourceFile( filename ):
- if IsHeaderFile( filename ):
- basename = os.path.splitext( filename )[ 0 ]
- for extension in SOURCE_EXTENSIONS:
- replacement_file = basename + extension
- if os.path.exists( replacement_file ):
- return replacement_file
- return filename
-
-
-def Settings( **kwargs ):
- if kwargs[ 'language' ] == 'cfamily':
- # If the file is a header, try to find the corresponding source file and
- # retrieve its flags from the compilation database if using one. This is
- # necessary since compilation databases don't have entries for header files.
- # In addition, use this source file as the translation unit. This makes it
- # possible to jump from a declaration in the header file to its definition
- # in the corresponding source file.
- filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] )
-
- if not database:
- return {
- 'flags': flags,
- 'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT,
- 'override_filename': filename
- }
-
- compilation_info = database.GetCompilationInfoForFile( filename )
- if not compilation_info.compiler_flags_:
- return {}
-
- # Bear in mind that compilation_info.compiler_flags_ does NOT return a
- # python list, but a "list-like" StringVec object.
- final_flags = list( compilation_info.compiler_flags_ )
-
- # NOTE: This is just for YouCompleteMe; it's highly likely that your project
- # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
- # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
- try:
- final_flags.remove( '-stdlib=libc++' )
- except ValueError:
- pass
-
- return {
- 'flags': final_flags,
- 'include_paths_relative_to_dir': compilation_info.compiler_working_dir_,
- 'override_filename': filename
- }
- return {}
-
-
-def GetStandardLibraryIndexInSysPath( sys_path ):
- for path in sys_path:
- if os.path.isfile( os.path.join( path, 'os.py' ) ):
- return sys_path.index( path )
- raise RuntimeError( 'Could not find standard library path in Python path.' )
-
-
-def PythonSysPath( **kwargs ):
- sys_path = kwargs[ 'sys_path' ]
- for folder in os.listdir( DIR_OF_THIRD_PARTY ):
- if folder == 'python-future':
- folder = os.path.join( folder, 'src' )
- sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1,
- os.path.realpath( os.path.join( DIR_OF_THIRD_PARTY,
- folder ) ) )
- continue
-
- if folder == 'cregex':
- interpreter_path = kwargs[ 'interpreter_path' ]
- major_version = subprocess.check_output( [
- interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ]
- ).rstrip().decode( 'utf8' )
- folder = os.path.join( folder, 'regex_{}'.format( major_version ) )
-
- sys_path.insert( 0, os.path.realpath( os.path.join( DIR_OF_THIRD_PARTY,
- folder ) ) )
- return sys_path