From f46d5370beeadc9debbbb8313765a1211f295f9c Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Fri, 25 Sep 2020 08:53:17 -0700 Subject: [PATCH] emacs config stuff --- dotfiles/bash/scripts/cgen.sh | 9 ++++----- dotfiles/bash/scripts/cgen_etc/clang_format_template | 19 +++++++++++-------- dotfiles/emacs.d/init.el | 11 ++++++----- 3 files changed, 21 insertions(+), 18 deletions(-) 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 5f9d8d6..f7d10d6 100644 --- a/dotfiles/emacs.d/init.el +++ b/dotfiles/emacs.d/init.el @@ -204,14 +204,15 @@ There are two things you can do about this warning: ;; LSP (use-package lsp-mode - :ensure t - :hook (python-mode . lsp-deferred) - :commands (lsp lsp-deferred)) + :ensure t + :hook ((python-mode . lsp-deferred) + (c-mode . lsp-deferred)) + :commands (lsp lsp-deferred)) (use-package lsp-ui - :ensure t - :hook (lsp-mode . lsp-ui-mode)) + :ensure t + :hook (lsp-mode . lsp-ui-mode)) ;;;;; PYTHON ;;;;;;;;;;;;;;;;;;