Update dev environment

This commit is contained in:
doyle 2021-01-07 10:23:02 +11:00
parent 7cad63948e
commit d4a3c3b4a3
4 changed files with 72 additions and 37 deletions

View File

@ -16,7 +16,6 @@ Plug 'https://github.com/tpope/vim-fugitive'
Plug 'https://github.com/bfrg/vim-cpp-modern' Plug 'https://github.com/bfrg/vim-cpp-modern'
Plug 'https://github.com/skywind3000/asyncrun.vim' Plug 'https://github.com/skywind3000/asyncrun.vim'
Plug 'https://github.com/Yggdroot/LeaderF' Plug 'https://github.com/Yggdroot/LeaderF'
Plug 'https://github.com/rhysd/vim-clang-format'
" Themes " Themes
Plug 'https://github.com/tomasr/molokai' Plug 'https://github.com/tomasr/molokai'
@ -223,43 +222,25 @@ noremap <C-F> :<C-U><C-R>=printf("Leaderf! rg -e %s ", expand("<cword>"))<CR>
" ============================================================================== " ==============================================================================
" Clang Format " Clang Format
" ============================================================================== " ==============================================================================
let g:clang_format#style_options = { if s:running_windows
\ "AccessModifierOffset": -4, if has('python')
\ "AlignAfterOpenBracket": "true", map <C-I> :pyf ~/vimfiles/clang-format.py<CR>
\ "AlignConsecutiveAssignments": "true", imap <C-I> <c-o>:pyf ~/vimfiles/clang-format.py<CR>
\ "AlignTrailingComments": "true", elseif has('python3')
\ "AllowAllParametersOfDeclarationOnNextLine": "true", map <C-I> :py3f ~/vimfiles/clang-format.py<CR>
\ "AllowShortBlocksOnASingleLine": "false", imap <C-I> <c-o>:py3f ~/vimfiles/clang-format.py<CR>
\ "AllowShortIfStatementsOnASingleLine": "true", endif
\ "AllowShortLoopsOnASingleLine": "false", else
\ "AlwaysBreakAfterDefinitionReturnType": "false", if has('python')
\ "AlwaysBreakBeforeMultilineStrings": "true", map <C-I> :pyf ~/.vim/clang-format.py<CR>
\ "AlwaysBreakTemplateDeclarations": "true", imap <C-I> <c-o>:pyf ~/.vim/clang-format.py<CR>
\ "BinPackArguments": "false", elseif has('python3')
\ "BinPackParameters": "false", map <C-I> :py3f ~/.vim/clang-format.py<CR>
\ "BreakBeforeBraces": "Allman", imap <C-I> <c-o>:py3f ~/.vim/clang-format.py<CR>
\ "BreakConstructorInitializersBeforeComma": "true", endif
\ "ColumnLimit": 120, endif
\ "ConstructorInitializerIndentWidth": 0,
\ "Cpp11BracedListStyle": "true",
\ "IndentCaseLabels": "true",
\ "IndentFunctionDeclarationAfterType": "false",
\ "IndentWidth": 4,
\ "MaxEmptyLinesToKeep": 1,
\ "NamespaceIndentation": "None",
\ "PointerBindsToType": "false",
\ "SpaceBeforeAssignmentOperators": "true",
\ "SpaceInEmptyParentheses": "false",
\ "SpacesBeforeTrailingComments": 1,
\ "SpacesInAngles": "false",
\ "SpacesInCStyleCastParentheses": "false",
\ "SpacesInParentheses": "false",
\ "SpacesInSquareBrackets": "false",
\ "Standard": "Cpp11",
\ "TabWidth": 4,
\ }
map <C-I> :update!<CR><C-v>:ClangFormat<CR>
" ============================================================================== " ==============================================================================
" Compiling / AsyncRun " Compiling / AsyncRun

View File

@ -0,0 +1,40 @@
{
AccessModifierOffset: -4, # 1 tab
AlignAfterOpenBracket: true,
AlignConsecutiveAssignments: true,
AlignConsecutiveBitfields: true,
AlignConsecutiveDeclarations: true,
AlignConsecutiveMacros: true,
AlignTrailingComments: true,
AllowAllParametersOfDeclarationOnNextLine: true,
AllowShortBlocksOnASingleLine: false,
AllowShortIfStatementsOnASingleLine: true,
AllowShortLoopsOnASingleLine: false,
AllowShortCaseLabelsOnASingleLine: true,
AllowShortLambdasOnASingleLine: false,
AlwaysBreakAfterDefinitionReturnType: false,
AlwaysBreakBeforeMultilineStrings: true,
AlwaysBreakTemplateDeclarations: true,
BinPackArguments: false,
BinPackParameters: false,
BreakBeforeBraces: Allman,
BreakConstructorInitializersBeforeComma: true,
ColumnLimit: 120,
ConstructorInitializerIndentWidth: 0,
Cpp11BracedListStyle: true,
IndentCaseLabels: true,
IndentFunctionDeclarationAfterType: false,
IndentWidth: 4, # 1 tab
MaxEmptyLinesToKeep: 1,
NamespaceIndentation: None,
PointerBindsToType: false,
SpaceBeforeAssignmentOperators: true,
SpaceInEmptyParentheses: false,
SpacesBeforeTrailingComments: 1,
SpacesInAngles: false,
SpacesInCStyleCastParentheses: false,
SpacesInParentheses: false,
SpacesInSquareBrackets: false,
Standard: Cpp11,
TabWidth: 4,
}

View File

@ -2,6 +2,10 @@ if [[ ! -f "${HOME}/.vim/autoload/plug.vim" ]]; then
wget --directory-prefix=../.vim/autoload https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim wget --directory-prefix=../.vim/autoload https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi fi
if [[ ! -f "${HOME}/clang-format.py" ]]; then
wget --directory-prefix=${HOME}/.vim/clang-format.py https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/clang-format.py
fi
# #
# Dependencies # Dependencies
# #
@ -12,6 +16,7 @@ sudo apt install exuberant-ctags neovim clang-format ripgrep
# #
cp --force Installer/_vimrc ~/.vimrc cp --force Installer/_vimrc ~/.vimrc
cp --force Installer/unix_nvim_init.vim ~/.config/nvim/init.vim cp --force Installer/unix_nvim_init.vim ~/.config/nvim/init.vim
cp --force Installer/clang-format-style-file ~/_clang-format
# #
# Ctags # Ctags

View File

@ -32,10 +32,12 @@ REM clang-format: C/C++ formatting tool
REM ctags: C/C++ code annotation generator REM ctags: C/C++ code annotation generator
REM scanmapset: Bind capslock to escape via registry REM scanmapset: Bind capslock to escape via registry
REM uncap: Bind capslock to escape via run-time program REM uncap: Bind capslock to escape via run-time program
REM clang-format: Default clang-format style
call :CopyFile "%installer_root%\win32_clang_format.exe" "%cmder_root%\bin\clang-format.exe" || exit /b call :CopyFile "%installer_root%\win32_clang_format.exe" "%cmder_root%\bin\clang-format.exe" || exit /b
call :CopyFile "%installer_root%\win32_ctags.exe" "%cmder_root%\bin\ctags.exe" || exit /b call :CopyFile "%installer_root%\win32_ctags.exe" "%cmder_root%\bin\ctags.exe" || exit /b
call :CopyFile "%installer_root%\win32_scanmapset.exe" "%cmder_root%\bin\scanmapset.exe" || exit /b call :CopyFile "%installer_root%\win32_scanmapset.exe" "%cmder_root%\bin\scanmapset.exe" || exit /b
call :CopyFile "%installer_root%\win32_uncap.exe" "%cmder_root%\bin\uncap.exe" || exit /b call :CopyFile "%installer_root%\win32_uncap.exe" "%cmder_root%\bin\uncap.exe" || exit /b
call :CopyFile "%installer_root%\clang-format-style-file" "%home%\_clang-format" || exit /b
REM REM
REM GVim, Vim Plug, Vim Config REM GVim, Vim Plug, Vim Config
@ -61,6 +63,13 @@ if exist "%vim_plug%" (
call :DownloadFile https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim "%vim_plug%" || exit /b call :DownloadFile https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim "%vim_plug%" || exit /b
) )
set vim_clang_format=%vim_root%\clang-format.py
if exist "%vim_clang_format%" (
echo - [Cache] Vim Clang Format already installed at %vim_clang_format%
) else (
call :DownloadFile https://raw.githubusercontent.com/llvm/llvm-project/main/clang/tools/clang-format/clang-format.py "%vim_clang_format%" || exit /b
)
REM REM
REM ripgrep REM ripgrep
REM REM