--- /dev/null
+# __ __ ____
+# / /_____ ___ __ ___ __ ____/ /__ _ __ _____ _________ ____ / __/
+# / __/ __ `__ \/ / / / |/_/ / __ / _ \ | / / / ___// ___/ __ \/ __ \/ /_
+# _/ /_/ / / / / / /_/ /> < / /_/ / __/ |/ / / /___/ /__/ /_/ / / / / __/
+#(_)__/_/ /_/ /_/\__,_/_/|_|____\__,_/\___/|___/____\___(_)___/\____/_/ /_/_/
+# /_____/ /_____/
+
+source ~/.tmux.conf
+
+bind-key C-m select-pane -t 2 \; send-keys C-l "CFLAGS= build" Enter \; last-pane
+bind-key C-g select-pane -t 2 \; send-keys C-l "CFLAGS=-g build" Enter \; last-pane
+bind-key C-c select-pane -t 2 \; send-keys C-l "clean" Enter \; last-pane
+bind-key C-r select-pane -t 2 \; send-keys C-l "run" Enter \; last-pane
+
+bind-key C-t select-pane -t 2 \; send-keys C-l "tags" Enter \; last-pane
--- /dev/null
+# Base16 Styling Guidelines:
+
+base00=default # - Default
+base01='#151515' # - Lighter Background (Used for status bars)
+base02='#202020' # - Selection Background
+base03='#909090' # - Comments, Invisibles, Line Highlighting
+base04='#505050' # - Dark Foreground (Used for status bars)
+base05='#D0D0D0' # - Default Foreground, Caret, Delimiters, Operators
+base06='#E0E0E0' # - Light Foreground (Not often used)
+base07='#F5F5F5' # - Light Background (Not often used)
+base08='#AC4142' # - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
+base09='#D28445' # - Integers, Boolean, Constants, XML Attributes, Markup Link Url
+base0A='#F4BF75' # - Classes, Markup Bold, Search Text Background
+base0B='#90A959' # - Strings, Inherited Class, Markup Code, Diff Inserted
+base0C='#75B5AA' # - Support, Regular Expressions, Escape Characters, Markup Quotes
+base0D='#6A9FB5' # - Functions, Methods, Attribute IDs, Headings
+base0E='#AA759F' # - Keywords, Storage, Selector, Markup Italic, Diff Changed
+base0F='#8F5536' # - Deprecated, Opening/Closing Embedded Language Tags, e.g. <? php ?>
+
+set -g status-left-length 32
+set -g status-right-length 150
+set -g status-interval 5
+
+# default statusbar colors
+set-option -g status-style fg=$base02,bg=$base00,default
+
+set-window-option -g window-status-style fg=$base03,bg=$base00
+set-window-option -g window-status-format " #I #W"
+
+# active window title colors
+set-window-option -g window-status-current-style fg=$base0C,bg=$base00
+set-window-option -g window-status-current-format " #[bold]#W"
+
+# pane border colors
+set-window-option -g pane-active-border-style fg=$base0C
+set-window-option -g pane-border-style fg=$base03
+
+# message text
+set-option -g message-style bg=$base00,fg=$base0C
+
+# pane number display
+set-option -g display-panes-active-colour $base0C
+set-option -g display-panes-colour $base01
+
+# clock
+set-window-option -g clock-mode-colour $base0C
+
+tm_session_name="#[default,bg=$base00,fg=$base0E] #S "
+set -g status-left "$tm_session_name"
+
+tm_date="#[default,bg=$base00,fg=$base0C] %R"
+tm_host="#[fg=$base0E,bg=$base00] #h "
--- /dev/null
+# __ ____
+# / /_____ ___ __ ___ __ _________ ____ / __/
+# / __/ __ `__ \/ / / / |/_// ___/ __ \/ __ \/ /_
+# _/ /_/ / / / / / /_/ /> <_/ /__/ /_/ / / / / __/
+#(_)__/_/ /_/ /_/\__,_/_/|_(_)___/\____/_/ /_/_/
+
+set -g default-terminal "tmux-256color"
+set -as terminal-overrides ',xterm*:Tc:sitm=\E[3m'
+
+set -g history-limit 20000
+
+# fix tmux copy issue with st terminal
+set -g set-clipboard off
+
+# automatically renumber tmux windows
+set -g renumber-windows on
+
+# unbind default prefix and set it to Ctrl+a
+unbind C-b
+set -g prefix C-a
+bind C-a send-prefix
+
+# Rather than constraining window size to the maximum size of any client
+# connected to the *session*, constrain window size to the maximum size of any
+# client connected to *that window*. Much more reasonable.
+setw -g aggressive-resize on
+
+# make delay shorter
+set -sg escape-time 0
+
+# tile all windows
+unbind =
+bind = select-layout tiled
+
+# make window/pane index start with 1
+set -g base-index 1
+setw -g pane-base-index 1
+
+set-option -g set-titles on
+set-option -g set-titles-string "#T - #W"
+
+######################
+#### Key Bindings ####
+######################
+
+# reload config file
+bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
+
+# split window and fix path for tmux 1.9
+bind | split-window -h -c "#{pane_current_path}"
+bind - split-window -v -c "#{pane_current_path}"
+
+# pane movement shortcuts
+bind h select-pane -L
+bind j select-pane -D
+bind k select-pane -U
+bind l select-pane -R
+
+bind -r C-h select-window -t :-
+bind -r C-l select-window -t :+
+
+# Resize pane shortcuts
+bind -r H resize-pane -L 5
+bind -r J resize-pane -D 5
+bind -r K resize-pane -U 5
+bind -r L resize-pane -R 5
+
+# synchronize panes shortcut
+bind y setw synchronize-panes
+
+# set vi mode for copy mode
+setw -g mode-keys vi
+# more settings to make copy-mode more vim-like
+unbind [
+bind Escape copy-mode
+unbind p
+bind p paste-buffer
+bind -Tcopy-mode-vi v send -X begin-selection
+bind -Tcopy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' \; display-message "copied to system clipboard"
+
+bind-key b select-pane -t 2 \; send-keys Up C-m \; last-pane
+
+###############################
+#### Color $ Style Settings####
+###############################
+
+source ~/.dotfiles/tmux/theme.sh
--- /dev/null
+#!/bin/sh
+
+SESSION="dev-c"
+
+while getopts "p:" opt; do
+ case $opt in
+ p) PRJ_DIR="${OPTARG}";;
+ *) echo "No reasonable options found";;
+ esac
+done
+
+if [[ -z "${PRJ_DIR}" ]]; then
+ read -p "Project directory: " -i "~/" -e PRJ_DIR
+fi
+
+if [[ -z "${PRJ_DIR}" ]]; then
+ echo "Project directory is not specified"
+ exit 1
+fi
+
+PRJ_DIR=$(eval echo "${PRJ_DIR}")
+SRC_DIR=${PRJ_DIR}/src
+INC_DIR=${SRC_DIR}/include
+RES_DIR=${SRC_DIR}/resources
+OUT_DIR=${PRJ_DIR}/out
+CFG_DIR=${PRJ_DIR}/.project
+
+PRJ_NAME=$(basename -- "${PRJ_DIR}")
+PRJ_INIT_FILE="${CFG_DIR}/.initrc"
+
+# Create project directory if needed
+[[ ! -d "${PRJ_DIR}" ]] && mkdir "${PRJ_DIR}"
+
+# Create project config directory if needed
+[[ ! -d "${CFG_DIR}" ]] && mkdir "${CFG_DIR}"
+
+# Create a project init file if it doen't exist
+if [[ ! -f "${PRJ_INIT_FILE}" ]]; then
+ cp ${DOT_FILES_VIM_C_DEV}/initrc ${PRJ_INIT_FILE}
+
+ read -p "Source code directory(default: src): " -e SOURCE_NAME &&\
+ [[ "${SOURCE_NAME}" ]] && SRC_DIR=${PRJ_DIR}/${SOURCE_NAME}
+ [[ ! -d ${SRC_DIR} ]] && mkdir ${SRC_DIR}
+
+ read -p "Include directory(default: include): " -e INCLUDE_NAME &&\
+ [[ "${INCLUDE_NAME}" ]] && INC_DIR=${SRC_DIR}/${INCLUDE_NAME}
+ [[ ! -d ${INC_DIR} ]] && mkdir ${INC_DIR}
+
+ read -p "Resource directory(default: resources): " -e RESOURCE_NAME &&\
+ [[ "${RESOURCE_NAME}" ]] && RES_DIR=${SRC_DIR}/${RESOURCE_NAME}
+ [[ ! -d ${RES_DIR} ]] && mkdir ${RES_DIR}
+
+ echo "export PRJ_NAME=\"${PRJ_NAME}\"" >> ${PRJ_INIT_FILE}
+ echo "export PRJ_DIR=\"${PRJ_DIR}\"" >> ${PRJ_INIT_FILE}
+ echo "export SRC_DIR=\"${SRC_DIR}\"" >> ${PRJ_INIT_FILE}
+ echo "export INC_DIR=\"${INC_DIR}\"" >> ${PRJ_INIT_FILE}
+ echo "export RES_DIR=\"${RES_DIR}\"" >> ${PRJ_INIT_FILE}
+ echo "export OUT_DIR=\"${OUT_DIR}\"" >> ${PRJ_INIT_FILE}
+ echo "export CFG_DIR=\"${CFG_DIR}\"" >> ${PRJ_INIT_FILE}
+ echo "export CMP=\"g++\"" >> ${PRJ_INIT_FILE}
+ echo "export CFLAGS=\"-g\"" >> ${PRJ_INIT_FILE}
+ echo "export IFLAGS=\"-I${INC_DIR}\"" >> ${PRJ_INIT_FILE}
+ echo "export LFLAGS=\"\"" >> ${PRJ_INIT_FILE}
+fi
+
+# Echoing common parameters
+echo "project name: ${PRJ_NAME}"
+echo "project directory: ${PRJ_DIR}"
+echo "source directory name: ${SRC_DIR}"
+echo "include directory name: ${INC_DIR}"
+echo "resources directory name: ${RES_DIR}"
+echo "output directory name: ${OUT_DIR}"
+echo "configuration directory name: ${CFG_DIR}"
+echo "vim dot directory for c dev: ${DOT_FILES_VIM_C_DEV}"
+
+# Create project specific dotfiles if needed
+l_vimrc="${CFG_DIR}/.vimrc"
+l_ycm_conf="${CFG_DIR}/ycm_extra_conf.py"
+l_header_template="${CFG_DIR}/header.txt"
+dot_vimrc="${DOT_FILES_VIM_C_DEV}/vimrc_c_dev"
+dot_ycm_conf="${DOT_FILES_VIM_C_DEV}/ycm_extra_conf_c_dev.py"
+dot_header_template="${DOT_FILES_VIM_C_DEV}/header_template.txt"
+
+[[ ! -f "${l_vimrc}" ]] && cp "${dot_vimrc}" "${l_vimrc}"
+[[ ! -f "${l_ycm_conf}" ]] && cp "${dot_ycm_conf}" "${l_ycm_conf}"
+[[ ! -f "${l_header_template}" ]] && cp "${dot_header_template}" "${l_header_template}"
+
+tmux_dev_c_conf="${DOT_FILES_TMUX}/.tmux_dev_c.conf"
+tmux source "${tmux_dev_c_conf}" \; new-session -d -s "${SESSION}" -n ide
+
+tmux splitw -v -p 7
+tmux selectp -t 2
+tmux send-keys "cd ${PRJ_DIR}" Enter
+tmux send-keys "source ${PRJ_INIT_FILE}" Enter
+tmux send-keys "clear" Enter
+
+tmux selectp -t 1
+tmux send-keys "cd ${PRJ_DIR}" Enter
+tmux send-keys "source ${PRJ_INIT_FILE}" Enter
+tmux send-keys "vi -u ${l_vimrc} ${PRJ_DIR}" Enter
+
+tmux attach-session -t "${SESSION}"
--- /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
+}
+
+# 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
+
+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 <C-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>
+
+" 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
--- /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