diff --git a/dotfiles/bash/bashrc b/dotfiles/bash/bashrc index 5796373..802e408 100644 --- a/dotfiles/bash/bashrc +++ b/dotfiles/bash/bashrc @@ -80,8 +80,6 @@ if [[ "$OS_TYPE" != "gnu-linux" ]]; then alias python='python3' fi -alias vim='nvim' - # rlwrap provides readline wrapping for programs. # This alias makes the SBCL REPL usable. alias sbcl='rlwrap sbcl' @@ -96,6 +94,29 @@ alias gitd='git diff' alias k8='kubectl' +# Good overrides + +# Don't nuke the computer +alias rm='rm -i' + +# Better ls - lists more information for each file +alias ll='ls -lh' + +# Human readable ls for the current directory +if [[ "$OS_TYPE" != "gnu-linux" ]]; then + # OS X lt + alias lt='du -sh * | sort -h' +else + alias lt='ls --human-readable --size -1 -S --classify' +fi + + +# Count files in the current directory +alias count='find . -type f | wc -l' + +# Generate sha1 hashes on the fly +alias sha1='openssl sha1' + # -------------- END ALIASES --------------# diff --git a/dotfiles/bash/scripts/cgen.sh b/dotfiles/bash/scripts/cgen.sh index f10404d..a10f999 100755 --- a/dotfiles/bash/scripts/cgen.sh +++ b/dotfiles/bash/scripts/cgen.sh @@ -27,8 +27,8 @@ fi if [ -z $c_standard ] then - echo "No C Standard supplied...defaulting to 99" - c_standard="99" + echo "No C Standard supplied...defaulting to 11" + c_standard="11" fi mkdir $name @@ -51,8 +51,7 @@ echo "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \${CMAKE_BINARY_DIR}/bin)" >> $cmake_co echo "" >> $cmake_config echo "" >> $cmake_config echo "# The following lines enable compile_commands.json and dump it in the root of the project" >> $cmake_config -echo "# in order to allow YouCompleteMe to provide completion. You can delete these lines if your" >> $cmake_config -echo "# editor does not need/use \`compile_commands.json\`" >> $cmake_config +echo "# This is needed for clangd and lsp to work" >> $cmake_config echo "" >> $cmake_config echo "set(CMAKE_EXPORT_COMPILE_COMMANDS ON)" >> $cmake_config echo "" >> $cmake_config @@ -62,7 +61,7 @@ echo " \${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json echo " \${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json" >> $cmake_config echo " )" >> $cmake_config echo "endif()" >> $cmake_config -echo "#-------- END YOUCOMPLETEME SECTION --------#" >> $cmake_config +echo "#-------- END COMPILE_COMMANDS.JSON SECTION --------#" >> $cmake_config echo "" >> $cmake_config echo "" >> $cmake_config echo "file(GLOB SOURCE \${PROJECT_SOURCE_DIR}/src/*.c)" >> $cmake_config diff --git a/dotfiles/bash/scripts/cgen_etc/clang_format_template b/dotfiles/bash/scripts/cgen_etc/clang_format_template index 94ff769..db8218d 100644 --- a/dotfiles/bash/scripts/cgen_etc/clang_format_template +++ b/dotfiles/bash/scripts/cgen_etc/clang_format_template @@ -1,13 +1,16 @@ +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: 'true' AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' AlignTrailingComments: 'true' -AllowShortBlocksOnASingleLine: 'false' -AllowShortCaseLabelsOnASingleLine: 'false' -AllowShortFunctionsOnASingleLine: None -AllowShortIfStatementsOnASingleLine: Never -AllowShortLoopsOnASingleLine: 'false' BreakBeforeBraces: Allman -ColumnLimit: '120' +IndentCaseLabels: 'true' IndentWidth: '4' +Language: Cpp PointerAlignment: Right -SortIncludes: 'false' - +SortIncludes: 'true' +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: 'true' +SpaceInEmptyParentheses: 'false' +UseTab: Never +ColumnLimit: 80 \ No newline at end of file diff --git a/dotfiles/emacs.d/init.el b/dotfiles/emacs.d/init.el index 07e69f1..19d1a60 100644 --- a/dotfiles/emacs.d/init.el +++ b/dotfiles/emacs.d/init.el @@ -173,9 +173,6 @@ There are two things you can do about this warning: (add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode) (add-hook 'scheme-mode-hook #'enable-paredit-mode) -(add-hook 'c-mode-hook 'counsel-gtags-mode) -(add-hook 'c++-mode-hook 'counsel-gtags-mode) - (require 'rainbow-delimiters) (add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) @@ -207,10 +204,11 @@ There are two things you can do about this warning: ;; LSP (use-package lsp-mode - :ensure t - :hook ((python-mode . lsp-deferred) - (ruby-mode . lsp-deferred)) - :commands (lsp lsp-deferred)) + :ensure t + :hook ((python-mode . lsp-deferred) + (c-mode . lsp-deferred) + (ruby-mode . lsp-deferred)) + :commands (lsp lsp-deferred)) (use-package lsp-ui @@ -292,9 +290,6 @@ There are two things you can do about this warning: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RUBY ;;;;;;;;;;;;;;;;;; -;; -;; -;; (require 'rvm) (rvm-use-default) @@ -308,6 +303,18 @@ There are two things you can do about this warning: (advice-add 'inf-ruby-console-auto :before #'rvm-activate-corresponding-ruby) +;;;;;;;;;;; C/C++ + +(use-package clang-format+) +(use-package counsel-gtags) + +(add-hook 'c-mode-common-hook #'clang-format+-mode) +(add-hook 'c-mode-hook 'counsel-gtags-mode) +(add-hook 'c++-mode-hook 'counsel-gtags-mode) + +;; 4 space offset for c +(setq-default c-basic-offset 4) + ;;-------------------------------------------------------------------------------------- ;; Save hooks ;;-------------------------------------------------------------------------------------- diff --git a/dotfiles/emacs.d/package.el b/dotfiles/emacs.d/package.el index c6f0999..47eae63 100644 --- a/dotfiles/emacs.d/package.el +++ b/dotfiles/emacs.d/package.el @@ -28,6 +28,7 @@ cmake-ide cmake-mode + clang-format+ ;;;;;;;;;;;;;;;;;;;;;;;;