345 lines
10 KiB
Plaintext
345 lines
10 KiB
Plaintext
" ----------------------------------------------------------------------------
|
|
" waldek additions essentials
|
|
" ----------------------------------------------------------------------------
|
|
|
|
" close all windows except the one you're in
|
|
nmap <leader>o :only <cr>
|
|
|
|
" use the arrows for buffer navigation
|
|
nnoremap <down> <C-W><C-J>
|
|
nnoremap <up> <C-W><C-K>
|
|
nnoremap <left> <C-W><C-H>
|
|
nnoremap <right> <C-W><C-L>
|
|
|
|
" use CTRL-motion for buffer navigation
|
|
nnoremap <C-h> <C-w>h
|
|
nnoremap <C-j> <C-w>j
|
|
nnoremap <C-k> <C-w>k
|
|
nnoremap <C-l> <C-w>l
|
|
|
|
" don't use the arrows for insert navigation
|
|
inoremap <Down> <Nop>
|
|
inoremap <Up> <Nop>
|
|
inoremap <Left> <Nop>
|
|
inoremap <Right> <Nop>
|
|
|
|
" more natural splits set splitbelow
|
|
set splitright
|
|
set splitbelow
|
|
|
|
" autorefresh syntax highlighting
|
|
autocmd BufEnter * :syntax sync fromstart
|
|
|
|
" ----------------------------------------------------------------------------
|
|
" waldek filetype specific
|
|
" ----------------------------------------------------------------------------
|
|
|
|
" python3
|
|
" -------
|
|
|
|
" let gi introspection work
|
|
if has('python3')
|
|
py3 << EOF
|
|
import os.path
|
|
import sys
|
|
import vim
|
|
sys.path.insert(0, os.path.join(os.path.expanduser('~'), '.cache/fakegir/'))
|
|
EOF
|
|
endif
|
|
|
|
" run code in new window
|
|
let _pymain="null"
|
|
map <leader>rs :let _pymain=expand('%:p')<CR>
|
|
map <leader>ru :let _pymain="null"<CR>
|
|
map <leader>r :execute '!x-terminal-emulator -e python3 ~/bin/python/vim_run.py ' . &filetype expand('%:p') _pymain <CR><CR>
|
|
map <leader>rr :execute '!x-terminal-emulator -e python3 ~/bin/python/vim_run.py ' . &filetype expand('%:p') "null" <CR><CR>
|
|
|
|
" mail
|
|
" ----
|
|
|
|
" mail should not wrap for mutt
|
|
autocmd FileType mail set textwidth=0
|
|
|
|
" ical
|
|
" ----
|
|
|
|
autocmd! BufRead,BufNewFile *.ics setfiletype icalendar
|
|
|
|
" arduino
|
|
" -------
|
|
|
|
au BufRead,BufNewFile *.pde set filetype=arduino
|
|
au BufRead,BufNewFile *.ino set filetype=arduino
|
|
|
|
if executable('arduino-language-server')
|
|
let g:lsp_semantic_enabled = 0
|
|
au User lsp_setup call lsp#register_server({
|
|
\ 'name': 'arduino-language-server',
|
|
\ 'cmd': {server_info->['/home/waldek/bin/arduino-language-server', '-clangd', '/usr/bin/clangd', '-cli', '/home/waldek/bin/arduino-cli', '-cli-config', '/home/waldek/.arduino15/arduino-cli.yaml', '-fqbn', 'arduino:renesas_uno', '-log', '-logpath', '/tmp']},
|
|
\ 'whitelist': ['arduino'],
|
|
\ 'workspace_config': lsp_settings#get('arduino-language-server', 'workspace_config', {}),
|
|
\ })
|
|
endif
|
|
|
|
"\ 'cmd': {server_info->['arduino-language-server -clangd /usr/bin/clangd -cli /home/waldek/bin/arduino-cli -cli-config /home/waldek/.arduino15/arduino-cli.yaml -fqbn arduino:mbed:nanorp2040connect'],},
|
|
"
|
|
" vimscript
|
|
" ----
|
|
|
|
" mail should not wrap for mutt
|
|
autocmd FileType vim nnoremap <buffer> <F5> :source % <CR>
|
|
|
|
" ----------------------------------------------------------------------------
|
|
" waldek plugins specific
|
|
" ----------------------------------------------------------------------------
|
|
|
|
" vim-lsp
|
|
" -------
|
|
|
|
set foldmethod=expr
|
|
\ foldexpr=lsp#ui#vim#folding#foldexpr()
|
|
\ foldtext=lsp#ui#vim#folding#foldtext()
|
|
|
|
let g:lsp_hover_conceal=1
|
|
let g:markdown_syntax_conceal=1
|
|
|
|
" lsp-settings
|
|
" ------------
|
|
|
|
"let g:lsp_settings_filetype_python = ['pylsp-all', 'pyright-langserver']
|
|
"let g:lsp_settings_filetype_python = ['pyright-langserver']
|
|
let g:lsp_settings_filetype_python = ['pylsp-all']
|
|
|
|
"let g:lsp_settings = {
|
|
"\ 'pyls-all': {
|
|
"\ 'workspace_config': {
|
|
"\ 'pyls': {
|
|
"\ 'configurationSources': ['pycodestyle'],
|
|
"\ 'plugins': {
|
|
"\ 'pycodestyle': {
|
|
"\ 'enabled': v:false,
|
|
"\ 'ignore': ['E501']
|
|
"\ },
|
|
"\ "pyls_mypy":
|
|
"\ {
|
|
"\ "enabled": v:true,
|
|
"\ "live_mode": v:false
|
|
"\ },
|
|
"\ }
|
|
"\ }
|
|
"\ }
|
|
"\ },
|
|
"\}
|
|
|
|
" ale-lsp settings
|
|
" ----------------
|
|
|
|
let g:lsp_diagnostics_enabled = 1
|
|
let g:lsp_diagnostics_echo_cursor = 1
|
|
let g:lsp_diagnostics_float_cursor = 1
|
|
let g:lsp_diagnostics_highlights_enabled = 1
|
|
let g:lsp_diagnostics_signs_enabled = 1
|
|
let g:lsp_diagnostics_virtual_text_enabled = 1
|
|
let g:ale_sign_column_always = 1
|
|
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
|
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
|
" Check Python files with flake8 and pylint.
|
|
" let b:ale_linters = ['flake8', 'pylint']
|
|
" Fix Python files with autopep8 and yapf.
|
|
let b:ale_fixers = ['autopep8', 'yapf', 'remove_trailing_lines', 'trim_whitespace', 'black', 'pycln', 'isort']
|
|
|
|
|
|
" pylint seems to not like venvs...
|
|
let g:ale_linters = {
|
|
\ 'go': ['vim-lsp'],
|
|
\ 'python': ['vim-lsp'],
|
|
\ }
|
|
|
|
" 'cmd': {server_info->['/home/waldek/.virtualenvs/configuration-language-server-/bin/confls']},
|
|
|
|
|
|
"au User lsp_setup
|
|
" \ call lsp#register_server({
|
|
" \ 'name': 'confls',
|
|
" \ 'tcp': '127.0.0.1:9999',
|
|
" \ 'cmd': {server_info->['pyls']},
|
|
" \ 'allowlist': ['systemd']
|
|
" \ })
|
|
|
|
"if executable('/home/waldek/.virtualenvs/configuration-language-server-/bin/confls')
|
|
" " pip install python-language-server
|
|
" au User lsp_setup call lsp#register_server({
|
|
" \ 'name': 'confls',
|
|
" \ 'tcp': "localhost:9999",
|
|
" \ 'allowlist': ['systemd'],
|
|
" \ })
|
|
"endif
|
|
|
|
|
|
" TagBar
|
|
" ------
|
|
|
|
nmap <leader>c :TagbarToggle <cr>
|
|
|
|
" nerdtree
|
|
" --------
|
|
|
|
map <leader>n :NERDTreeToggle<CR>
|
|
let g:NERDTreeWinSize=30
|
|
let g:NERDDefaultAlign = 'left'
|
|
|
|
" vebugger
|
|
" --------
|
|
|
|
"let g:vebugger_leader='<Leader>d'
|
|
|
|
" vimspector
|
|
" --------
|
|
|
|
let g:vimspector_enable_mappings = 'HUMAN'
|
|
set signcolumn=yes
|
|
|
|
sign define vimspectorBP text=\ ● texthl=WarningMsg
|
|
sign define vimspectorBPCond text=\ ◆ texthl=WarningMsg
|
|
sign define vimspectorBPLog text=\ ◆ texthl=SpellRare
|
|
sign define vimspectorBPDisabled text=\ ● texthl=LineNr
|
|
sign define vimspectorPC text=\ ▶ texthl=MatchParen linehl=CursorLine
|
|
sign define vimspectorPCBP text=●▶ texthl=MatchParen linehl=CursorLine
|
|
sign define vimspectorCurrentThread text=▶ texthl=MatchParen linehl=CursorLine
|
|
sign define vimspectorCurrentFrame text=▶ texthl=Special linehl=CursorLine
|
|
|
|
|
|
" asyncrun
|
|
" --------
|
|
|
|
let $PYTHONUNBUFFERED=1
|
|
let g:asyncrun_open = 8
|
|
"autocmd filetype python noremap <F5> :AsyncRun -cwd=$(VIM_FILEDIR) -raw python3 "$(VIM_FILEPATH)"<CR>
|
|
"noremap <F6> :AsyncStop<CR>
|
|
"noremap <F10> :cclose<CR>
|
|
|
|
" marker specific
|
|
" ---------------
|
|
|
|
let g:SignatureMap = {
|
|
\ 'Leader' : "m",
|
|
\ 'PlaceNextMark' : "mm",
|
|
\ 'ToggleMarkAtLine' : "m.",
|
|
\ 'PurgeMarksAtLine' : "m-",
|
|
\ 'DeleteMark' : "dm",
|
|
\ 'PurgeMarks' : "m<Space>",
|
|
\ 'PurgeMarkers' : "m<BS>",
|
|
\ 'GotoNextLineAlpha' : "m]",
|
|
\ 'GotoPrevLineAlpha' : "m[",
|
|
\ 'GotoNextSpotAlpha' : "M]",
|
|
\ 'GotoPrevSpotAlpha' : "M[",
|
|
\ 'GotoNextLineByPos' : "]m",
|
|
\ 'GotoPrevLineByPos' : "[m",
|
|
\ 'GotoNextSpotByPos' : "]M",
|
|
\ 'GotoPrevSpotByPos' : "[M",
|
|
\ 'GotoNextMarker' : "]-",
|
|
\ 'GotoPrevMarker' : "[-",
|
|
\ 'GotoNextMarkerAny' : "]=",
|
|
\ 'GotoPrevMarkerAny' : "[=",
|
|
\ 'ListBufferMarks' : "m/",
|
|
\ 'ListBufferMarkers' : "m?"
|
|
\ }
|
|
|
|
" markdown preview
|
|
" ----------------
|
|
|
|
" set to 1, nvim will open the preview window after entering the markdown buffer
|
|
" default: 0
|
|
let g:mkdp_auto_start = 0
|
|
|
|
" set to 1, the nvim will auto close current preview window when change
|
|
" from markdown buffer to another buffer
|
|
" default: 1
|
|
let g:mkdp_auto_close = 1
|
|
|
|
" set to 1, the vim will refresh markdown when save the buffer or
|
|
" leave from insert mode, default 0 is auto refresh markdown as you edit or
|
|
" move the cursor
|
|
" default: 0
|
|
let g:mkdp_refresh_slow = 0
|
|
|
|
" set to 1, the MarkdownPreview command can be use for all files,
|
|
" by default it can be use in markdown file
|
|
" default: 0
|
|
let g:mkdp_command_for_global = 0
|
|
|
|
" set to 1, preview server available to others in your network
|
|
" by default, the server listens on localhost (127.0.0.1)
|
|
" default: 0
|
|
let g:mkdp_open_to_the_world = 0
|
|
|
|
" use custom IP to open preview page
|
|
" useful when you work in remote vim and preview on local browser
|
|
" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9
|
|
" default empty
|
|
let g:mkdp_open_ip = ''
|
|
|
|
" specify browser to open preview page
|
|
" default: ''
|
|
let g:mkdp_browser = '/usr/bin/firefox'
|
|
|
|
" set to 1, echo preview page url in command line when open preview page
|
|
" default is 0
|
|
let g:mkdp_echo_preview_url = 1
|
|
|
|
" a custom vim function name to open preview page
|
|
" this function will receive url as param
|
|
" default is empty
|
|
let g:mkdp_browserfunc = ''
|
|
|
|
" options for markdown render
|
|
" mkit: markdown-it options for render
|
|
" katex: katex options for math
|
|
" uml: markdown-it-plantuml options
|
|
" maid: mermaid options
|
|
" disable_sync_scroll: if disable sync scroll, default 0
|
|
" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle'
|
|
" middle: mean the cursor position alway show at the middle of the preview page
|
|
" top: mean the vim top viewport alway show at the top of the preview page
|
|
" relative: mean the cursor position alway show at the relative positon of the preview page
|
|
" hide_yaml_meta: if hide yaml metadata, default is 1
|
|
" sequence_diagrams: js-sequence-diagrams options
|
|
" content_editable: if enable content editable for preview page, default: v:false
|
|
" disable_filename: if disable filename header for preview page, default: 0
|
|
let g:mkdp_preview_options = {
|
|
\ 'mkit': {},
|
|
\ 'katex': {},
|
|
\ 'uml': {},
|
|
\ 'maid': {},
|
|
\ 'disable_sync_scroll': 0,
|
|
\ 'sync_scroll_type': 'relative',
|
|
\ 'hide_yaml_meta': 1,
|
|
\ 'sequence_diagrams': {},
|
|
\ 'flowchart_diagrams': {},
|
|
\ 'content_editable': v:false,
|
|
\ 'disable_filename': 0
|
|
\ }
|
|
|
|
" use a custom markdown style must be absolute path
|
|
" like '/Users/username/markdown.css' or expand('~/markdown.css')
|
|
let g:mkdp_markdown_css = ''
|
|
|
|
" use a custom highlight style must absolute path
|
|
" like '/Users/username/highlight.css' or expand('~/highlight.css')
|
|
let g:mkdp_highlight_css = ''
|
|
|
|
" use a custom port to start server or random for empty
|
|
let g:mkdp_port = ''
|
|
|
|
" preview page title
|
|
" ${name} will be replace with the file name
|
|
let g:mkdp_page_title = '${name}'
|
|
|
|
" recognized filetypes
|
|
" these filetypes will have MarkdownPreview... commands
|
|
let g:mkdp_filetypes = ['markdown']
|
|
|
|
autocmd FileType markdown nmap <F5> <Plug>MarkdownPreview
|
|
autocmd FileType markdown nmap <F6> <Plug>MarkdownPreviewStop
|
|
autocmd FileType markdown nmap <F7> <Plug>MarkdownPreviewToggle
|