Update remedybg spawning, remove outdated vim patterns

This commit is contained in:
doylet 2023-10-09 11:00:23 +11:00
parent edef3be690
commit 8c132f2cad
4 changed files with 26 additions and 44 deletions

View File

@ -58,8 +58,9 @@ lua <<EOF
-- LSP Setup -- LSP Setup
-- =========================================================================== -- ===========================================================================
local lsp = require('lsp-zero') local lsp = require('lsp-zero')
local devenver_root = vim.fn.getenv('devenver_root')
local clang_format_fallback_file = devenver_root .. '/_clang-format'
lsp.preset('recommended') lsp.preset('recommended')
lsp.configure('clangd', { lsp.configure('clangd', {
cmd = { cmd = {
"clangd", "clangd",
@ -71,6 +72,7 @@ lua <<EOF
"--clang-tidy", "--clang-tidy",
"--header-insertion=iwyu", "--header-insertion=iwyu",
"--header-insertion-decorators", "--header-insertion-decorators",
"--fallback-style=" .. clang_format_fallback_file,
} }
}) })
@ -268,12 +270,8 @@ let g:cpp_simple_highlight = 1
" Show EOL type and last modified timestamp, right after the filename " Show EOL type and last modified timestamp, right after the filename
set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P set statusline=%<%F%h%m%r\ [%{&ff}]\ (%{strftime(\"%H:%M\ %d/%m/%Y\",getftime(expand(\"%:p\")))})%=%l,%c%V\ %P
" Resize splits when the window is resized
au VimResized * :wincmd =
" File patterns to ignore in command line auto complete " File patterns to ignore in command line auto complete
set wildignore+=*.class,*.o set wildignore+=*.class,*.o,*\\tmp\\*,*.swp,*.zip,*.exe,*.obj,*.vcxproj,*.pdb,*.idb
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe,*.obj,*.vcxproj,*.pdb,*.idb
" Setup undo file " Setup undo file
set undofile set undofile
@ -309,35 +307,41 @@ augroup persistent_settings
augroup end augroup end
function! RemedyBGOpenFile() function! RemedyBGOpenFile()
execute("Spawn! remedybg open-file " . expand("%:p") . " " . line(".")) execute("!remedybg open-file " . expand("%:p") . " " . line("."))
execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')") execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')")
endfunction endfunction
command RemedyBGOpenFile call RemedyBGOpenFile() command RemedyBGOpenFile call RemedyBGOpenFile()
function! RemedyBGStartDebugging() function! RemedyBGStartDebugging()
execute("Spawn! start remedybg start-debugging " . expand("%:p") . " " . line(".")) execute("!remedybg start-debugging " . expand("%:p") . " " . line("."))
endfunction endfunction
command RemedyBGStartDebugging call RemedyBGStartDebugging() command RemedyBGStartDebugging call RemedyBGStartDebugging()
function! RemedyBGStopDebugging() function! RemedyBGStopDebugging()
execute("Spawn! remedybg stop-debugging " . expand("%:p") . " " . line(".")) execute("!remedybg stop-debugging " . expand("%:p") . " " . line("."))
endfunction endfunction
command RemedyBGStopDebugging call RemedyBGStopDebugging() command RemedyBGStopDebugging call RemedyBGStopDebugging()
function! RemedyBGRunToCursor() function! RemedyBGRunToCursor()
execute("Spawn! remedybg open-file " . expand("%:p") . " " . line(".")) execute("!remedybg open-file " . expand("%:p") . " " . line("."))
execute("Spawn! remedybg run-to-cursor " . expand("%:p") . " " . line(".")) execute("!remedybg run-to-cursor " . expand("%:p") . " " . line("."))
execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')") execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')")
endfunction endfunction
command RemedyBGRunToCursor call RemedyBGRunToCursor() command RemedyBGRunToCursor call RemedyBGRunToCursor()
function! RemedyBGAddBreakpointAtFile() function! RemedyBGAddBreakpointAtFile()
execute("Spawn! remedybg open-file " . expand("%:p") . " " . line(".")) execute("!remedybg open-file " . expand("%:p") . " " . line("."))
execute("Spawn! remedybg add-breakpoint-at-file " . expand("%:p") . " " . line(".")) execute("!remedybg add-breakpoint-at-file " . expand("%:p") . " " . line("."))
execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')") execute("!powershell -Command Add-Type -AssemblyName Microsoft.VisualBasic; [Microsoft.VisualBasic.Interaction]::AppActivate(' - RemedyBG')")
endfunction endfunction
command RemedyBGAddBreakpointAtFile call RemedyBGAddBreakpointAtFile() command RemedyBGAddBreakpointAtFile call RemedyBGAddBreakpointAtFile()
nnoremap <silent> <F6> <cmd>RemedyBGOpenFile<cr><cr>
nnoremap <silent> <F5> <cmd>RemedyBGStartDebugging<cr><cr>
nnoremap <silent> <S-F5> <cmd>RemedyBGStopDebugging<cr><cr>
nnoremap <silent> <F9> <cmd>RemedyBGAddBreakpointAtFile<cr><cr>
nnoremap <silent> <C-F10> <cmd>RemedyBGRunToCursor<cr><cr>
" FZF " FZF
" ============================================================================== " ==============================================================================
" Empty value to disable preview window altogether " Empty value to disable preview window altogether
@ -366,27 +370,21 @@ nnoremap <leader>cc <cmd>FzfCommits<cr>
nnoremap <leader>cb <cmd>FzfBCommits<cr> nnoremap <leader>cb <cmd>FzfBCommits<cr>
nnoremap <leader>b <cmd>FzfBuffers<cr> nnoremap <leader>b <cmd>FzfBuffers<cr>
function! PadAndTruncateLineTo80Function() function! PadAndTruncateLineFunction()
let line = getline('.') let line = getline('.')
let line_length = strlen(line) let line_length = strlen(line)
let padding = 80 - line_length let padding = 100 - line_length
let padding = max([padding, 0]) let padding = max([padding, 0])
let existing_space = line_length == 80 || match(line, ' $') != -1 let existing_space = line_length == 100 || match(line, ' $') != -1
" Construct the new line with padding and a space before the padding " Construct the new line with padding and a space before the padding
let new_line = line . (existing_space ? '' : ' ') . repeat('=', padding - 1) let new_line = line . (existing_space ? '' : ' ') . repeat('=', padding - 1)
call setline(line('.'), new_line) call setline(line('.'), new_line)
endfunction endfunction
command! PadAndTruncateLineTo80 :call PadAndTruncateLineTo80Function()<CR> command! PadAndTruncateLine :call PadAndTruncateLineFunction()<CR>
nnoremap <silent> <F3> :PadAndTruncateLineTo80<cr> nnoremap <silent> <F3> :PadAndTruncateLine<cr>
nnoremap <silent> <F6> <cmd>RemedyBGOpenFile<cr><cr>
nnoremap <silent> <F5> <cmd>RemedyBGStartDebugging<cr><cr>
nnoremap <silent> <S-F5> <cmd>RemedyBGStopDebugging<cr><cr>
nnoremap <silent> <F9> <cmd>RemedyBGAddBreakpointAtFile<cr><cr>
nnoremap <silent> <C-F10> <cmd>RemedyBGRunToCursor<cr><cr>
" Map Ctrl+HJKL to navigate buffer window " Map Ctrl+HJKL to navigate buffer window
nmap <silent> <C-h> :wincmd h<CR> nmap <silent> <C-h> :wincmd h<CR>
@ -414,23 +412,6 @@ nnoremap <leader>s :vs<CR>
nnoremap <A-j> :cn<CR> nnoremap <A-j> :cn<CR>
nnoremap <A-k> :cp<CR> nnoremap <A-k> :cp<CR>
" Clang Format
" ==============================================================================
map <C-I> :py3file ~/clang-format.py<CR>
" Compiler Error Formats
" ==============================================================================
" Error message formats thanks to
" https://forums.handmadehero.org/index.php/forum?view=topic&catid=4&id=704#3982
set errorformat+=\\\ %#%f(%l\\\,%c):\ %m " MSVC: MSBuild
set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m " MSVC: cl.exe
set errorformat+=\\\ %#%t%nxx:\ %m " MSVC: cl.exe, fatal errors is crudely implemented
set errorformat+=\\\ %#LINK\ :\ %m " MSVC: link.exe, can't find link library badly implemented
set errorformat+=\\\ %#%s\ :\ error\ %m " MSVC: link.exe, errors is badly implemented
set errorformat+=\\\ %#%s\ :\ fatal\ error\ %m " MSVC: link.exe, fatal errors is badly implemented
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m " MSVC: HLSL fxc.exe
set errorformat+=%\\%%(CTIME%\\)%\\@=%m " ctime.exe -stats
" Vim Dispatch " Vim Dispatch
" ============================================================================== " ==============================================================================
let s:running_windows = has("win16") || has("win32") || has("win64") let s:running_windows = has("win16") || has("win32") || has("win64")

View File

@ -8,5 +8,5 @@ setlocal
for /f "delims=" %%a in ('where "$desired_path:%desired_exe%"') do ( set "exe_to_use=%%a") for /f "delims=" %%a in ('where "$desired_path:%desired_exe%"') do ( set "exe_to_use=%%a")
echo [DEVENVER] Executing script "%~dpnx0" with "%exe_to_use%" echo [DEVENVER] Executing script "%~dpnx0" with "%exe_to_use%"
call %desired_exe% %* start /B %desired_exe% %*
endlocal endlocal

View File

@ -801,7 +801,7 @@ def run(user_app_list,
devenv_script_buffer += "set path=%~dp0Symlinks;%PATH%\n" devenv_script_buffer += "set path=%~dp0Symlinks;%PATH%\n"
devenv_script_buffer += "set path=%~dp0Scripts;%PATH%\n" devenv_script_buffer += "set path=%~dp0Scripts;%PATH%\n"
else: else:
devenv_script_buffer += f"devenver_root=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )\":$PATH\n" devenv_script_buffer += f"export devenver_root=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )\"\n"
devenv_script_buffer += f"PATH=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )/Scripts\":$PATH\n" devenv_script_buffer += f"PATH=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )/Scripts\":$PATH\n"
devenv_script_buffer += f"PATH=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )/Symlinks\":$PATH\n" devenv_script_buffer += f"PATH=\"$( cd -- $( dirname -- \"${{BASH_SOURCE[0]}}\" ) &> /dev/null && pwd )/Symlinks\":$PATH\n"

View File

@ -414,6 +414,7 @@ pause
# Install left-overs # Install left-overs
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
devenver.print_header("Install configuration files") devenver.print_header("Install configuration files")
shutil.copy(internal_dir / "os_clang_format_style_file", install_dir / "_clang-format")
# Copy init.vim to NVIM directory # Copy init.vim to NVIM directory
nvim_init_dir = "" nvim_init_dir = ""