Skip to content

Commit

Permalink
[nvim] make a bunch of minor config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitmel committed Aug 20, 2023
1 parent c19ccc7 commit 9a8c24f
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"workspace.checkThirdParty": false
}
2 changes: 2 additions & 0 deletions misc/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ ignore = [
"ANN401", # dynamically typed expressions are disallowed
"PLW0603", # using the global statement is discouraged
"PLW2901", # outer loop variable overwritten by inner loop target
"B905", # `zip()` without an explicit `strict` parameter
"E731", # use `def` instead of assigning `lambda` to a variable
]

[flake8-quotes]
Expand Down
1 change: 1 addition & 0 deletions nvim/dotfiles/vimspector/c.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ let s:filetypes = ['c', 'cpp', 'objc', 'objcpp', 'rust', 'swift']
" <https://github.com/microsoft/MIEngine> - the DAP server
" <https://github.com/Microsoft/vscode-cpptools> - the corresponding VSCode extension
" <https://code.visualstudio.com/docs/cpp/launch-json-reference> - options
" <https://github.com/microsoft/MIEngine/blob/v1.13.5/src/MIDebugPackage/OpenFolderSchema.json> - options
" <https://github.com/microsoft/vscode-cpptools/blob/v1.15.3/Extension/package.json#L3214-L4971> - options in VSCode
let g:vimspector_adapters['vscode-cpptools'] = {
\ 'name': 'cppdbg',
Expand Down
6 changes: 3 additions & 3 deletions nvim/plugin/completion.vim
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ if dotfiles#plugman#is_registered('coc.nvim') " {{{
let g:coc_snippet_prev = '<S-Tab>'

imap <silent><expr> <CR> coc#pum#visible() ? "\<C-y>" : "\<Plug>delimitMateCR"
imap <silent><expr> <Esc> coc#pum#visible() ? "\<C-e>" : "\<Esc>"
" imap <silent><expr> <Esc> coc#pum#visible() ? "\<C-e>" : "\<Esc>"
imap <silent><expr> <Tab> coc#pum#visible() ? "\<C-n>" : "\<Tab>"
imap <silent><expr> <S-Tab> coc#pum#visible() ? "\<C-p>" : "\<S-Tab>"
inoremap <silent><expr> <Down> coc#pum#visible() ? coc#pum#next(0) : exists("b:dotfiles_prose_mode") ? "\<C-o>g\<Down>" : "\<Down>"
Expand Down Expand Up @@ -420,7 +420,7 @@ if dotfiles#plugman#is_registered('vimspector') " {{{
command! -bar DbgBreakDel call vimspector#ClearLineBreakpoint(expand('%'), line('.'))
command! -nargs=? DbgBreakFunc call vimspector#AddFunctionBreakpoint(!empty(<q-args>) ? <q-args> : expand('<cexpr>'))
command! -bar DbgBreakClearAll call vimspector#ClearBreakpoints()
command! -nargs=1 -complete=custom,vimspector#CompleteExpr DbgBreakCond call vimspector#SetLineBreakpoint(expand('%'), line('.'), {'condition': <q-args>})
command! -nargs=1 -complete=custom,vimspector#CompleteExpr DbgBreakIf call vimspector#SetLineBreakpoint(expand('%'), line('.'), {'condition': <q-args>})
command! -nargs=1 -complete=custom,vimspector#CompleteExpr DbgBreakHit call vimspector#SetLineBreakpoint(expand('%'), line('.'), {'hitCondition': <q-args>})
command! -nargs=1 -complete=custom,vimspector#CompleteExpr DbgBreakLog call vimspector#SetLineBreakpoint(expand('%'), line('.'), {'logMessage': <q-args>})
command! -nargs=1 -complete=custom,vimspector#CompleteExpr DbgEval call vimspector#Evaluate(<q-args>)
Expand All @@ -435,7 +435,7 @@ if dotfiles#plugman#is_registered('vimspector') " {{{
\}

let g:vimspector_configurations['Remote Attach'] = {
\ 'autoselect': v:false,
\ 'autoselect': v:false,
\ 'adapter': 'multi-session',
\ 'configuration': {
\ 'request': 'attach',
Expand Down
13 changes: 13 additions & 0 deletions nvim/plugin/files.vim
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ set nofixendofline
command -nargs=* -complete=file -bar EditGlob call s:EditGlob(<f-args>)
" }}}

" EditClist {{{
function! s:EditList(...) abort
let list = []
for glob in a:000
call extend(list, glob(glob, 0, 1))
endfor
call map(list, '{"filename": v:val, "lnum": 1}')
call setqflist(list)
copen
endfunction
command -nargs=* -complete=file -bar EditList call s:EditList(<f-args>)
" }}}

" DragOut {{{
" Shows a window for draging (-and-dropping) the currently opened file out.
function! s:DragOut(path) abort
Expand Down
4 changes: 2 additions & 2 deletions nvim/snippets/PKGBUILD.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ snippet ! Basic template (/usr/share/pacman/PKGBUILD.proto)
cd "\$pkgname-\$pkgver"
make DESTDIR="\$pkgdir/" install
}
snippet !split Template for a split package (/usr/share/pacman/PKGBUILD-split.proto)
snippet split! Template for a split package (/usr/share/pacman/PKGBUILD-split.proto)
# This is an example of a PKGBUILD for splitting packages. Use this as a
# start to creating your own, and remove these comments. For more information,
# see 'man PKGBUILD'. NOTE: Please fill out the license field for your package!
Expand Down Expand Up @@ -129,7 +129,7 @@ snippet !split Template for a split package (/usr/share/pacman/PKGBUILD-split.pr
cd "\$pkgbase-\$pkgver"
make DESTDIR="\$pkgdir/" install-pkg2
}
snippet !vcs Template for a VCS package (/usr/share/pacman/PKGBUILD-vcs.proto)
snippet vcs! Template for a VCS package (/usr/share/pacman/PKGBUILD-vcs.proto)
# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
Expand Down
33 changes: 33 additions & 0 deletions nvim/snippets/c.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,36 @@ snippet timeit measure execution time of a section of code
$0
clock_t elapsed_time${1:_test} = clock() - start_time${1:_test};
printf("%f\n", (double)elapsed_time${1:_test} / CLOCKS_PER_SEC);
snippet pragmaonce #pragma once
#pragma once
snippet ifdefcpp insert the #ifdef __cplusplus guards
#ifdef __cplusplus
extern "C" {
#endif

$0

#ifdef __cplusplus
}
#endif
snippet incguard insert include guards
#ifndef ${1:SOMETHING_H}
#define ${1:SOMETHING_H}

$0

#endif /* ${1:SOMETHING_H} */
snippet struct structure declaration
typedef struct ${1:Type} {
$0
} ${1:Type};
snippet enum enumeration declaration
typedef enum ${1:Type} {
$0
} ${1:Type};
snippet union union declaration
typedef union ${1:Type} {
$0
} ${1:Type};
snippet gccattrib GCC __attribute__ keyword
__attribute__(($0))
24 changes: 24 additions & 0 deletions nvim/snippets/json.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
snippet vimspector-conf vimspector: a basic config file
{
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
"configurations": {
$0
}
}
snippet vimspector-launch vimspector: launch configuration
"${1:Configuration Name}": {
"adapter": "${2:adapter}",
"configuration": {
"request": "launch",
"program": "${workspaceFolder}/${3:<program>}",
"args": []$0
}
}
snippet vimspector-attach vimspector: attach configuration
"${1:Configuration Name}": {
"adapter": "${2:adapter}",
"configuration": {
"request": "attach",
"program": "${workspaceFolder}/${3:<program>}"$0
}
}
2 changes: 1 addition & 1 deletion nvim/snippets/lua.snippets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
snippet !dotmod dotfiles Lua module
snippet dotmod! dotfiles Lua module
--- ${1:TODO: Documentation}
local M = require('dotfiles.autoload')('`dotfiles#ftplugin_helpers#lua#module_name()`')

Expand Down
4 changes: 4 additions & 0 deletions script-resources/pycalc_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ def coth(x: float) -> float:

def acoth(x: float) -> float:
return atanh(1 / x)


def relative_error(real: float, measured: float) -> float:
return abs(measured - real) / real

0 comments on commit 9a8c24f

Please sign in to comment.