From 918ec40cd8c51068abf58bd6992ebad15bec9f74 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 11 Apr 2023 10:35:29 +0100 Subject: Put back all important vim plugins And got basic completion and go to definition working. --- vim/vimrc | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 244 insertions(+), 11 deletions(-) diff --git a/vim/vimrc b/vim/vimrc index 4bf6c8e..35d0661 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -8,7 +8,7 @@ let @s = ")i\\\" " leader let maplocalleader = "\\" -let mapleader = "," +let mapleader = " " " encryption method when using :X set cm=blowfish2 @@ -45,21 +45,43 @@ noremap rs :!clear; sh % " essential plugins call plug#begin() +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +Plug 'junegunn/fzf.vim' +Plug 'sheerun/vim-polyglot' +Plug 'preservim/vim-markdown' +Plug 'mhinz/vim-signify' Plug 'vim-test/vim-test' +Plug 'ledger/vim-ledger' +Plug 'jlanzarotta/bufexplorer' +Plug 'tpope/vim-fugitive' Plug 'tpope/vim-dispatch' Plug 'tpope/vim-commentary' Plug 'ycm-core/YouCompleteMe' Plug 'rose-pine/vim' Plug 'SirVer/UltiSnips' Plug 'honza/vim-snippets' +Plug 'dense-analysis/ale' +Plug 'davidhalter/jedi-vim' call plug#end() +" jedi-vim + +let g:jedi#goto_command = "d" +let g:jedi#goto_assignments_command = "g" +let g:jedi#goto_stubs_command = "s" +let g:jedi#goto_definitions_command = "" +let g:jedi#documentation_command = "K" +let g:jedi#usages_command = "n" +let g:jedi#completions_command = "" +let g:jedi#rename_command = "r" +let g:jedi#rename_command_keep_name = "R" + " YCM let g:ycm_enable_inlay_hints = 1 nnoremap h (YCMToggleInlayHints) -nnoremap jd :YcmCompleter GoTo -nnoremap jr :YcmCompleter GoToReferences -nnoremap k :YcmCompleter GetDoc +nnoremap gd :YcmCompleter GoToDefinition +nnoremap gr :YcmCompleter GoToReferences +nnoremap K :YcmCompleter GetDoc " snippets " Trigger configuration. You need to change this to something other than if you use one of the following: @@ -96,6 +118,7 @@ set hi=500 set scrolloff=0 set novisualbell set relativenumber "show line numbers +set wildignore=**/__pycache*/** set wildmenu "enable a menu that shows tab completion options in the status bar set wildchar= set showmatch "highlights matching brackets on cursor hover @@ -142,16 +165,102 @@ if has('folding') set viewoptions=folds,options,cursor,unix,slash endif -" Check whether any buffers have been updated outside of vim -nnoremap :checktime +" from https://www.reddit.com/r/vim/comments/f5gi2g/vim_notetaking_automatic_link_creation_between/ +" copies a link from file from previous buffer for pasting into +" next buffer with "ap +function! s:copy_filename_as_mdlink() + let fname=expand("%") + let @a="[" . fname . "](./" . fname. ")" +endfunction +autocmd BufLeave * call s:copy_filename_as_mdlink() + +" Ultisnips +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" + +" YouCompleteMe +let g:ycm_python_interpreter_path = '.venv/bin/python3' +let g:ycm_python_sys_path = [] +let g:ycm_extra_conf_vim_data = [ + \ 'g:ycm_python_interpreter_path', + \ 'g:ycm_python_sys_path' + \] +let g:ycm_global_ycm_extra_conf = '~/.global_extra_conf.py' +nnoremap jd :YcmCompleter GoTo + +" vim-test +" use vim-dispatch to run tests in the quickfix window +" from Modern Vim Ch.4 +" the mappings below are from vim-test +" https://github.com/vim-test/vim-test +" dispatch opens send test output to quickfix window +let test#strategy = "basic" +let test#python#runner = "pytest" +let test#vim#term_position = "topleft 10" +let test#python#pytest#options = '--tb=short' +let test#go#runner = 'gotest' +"let test#go#gotest#options = '-v' +" To run mypy using vim-dispath -with Dispatch +autocmd FileType python let b:dispatch = 'mypy --ignore-missing-imports' + +" Set wrap option for Markdown files +autocmd FileType markdown setlocal linebreak + +" test +nmap tn :TestNearest +nmap ts :TestSuite +nmap tf :TestFile +nmap :TestLast +nmap t :TestVisit + +" disable folding by default with vim-markdown +let g:vim_markdown_folding_disabled = 1 +" +" ALE ale config +let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' +let g:ale_sign_error = '✘' +let g:ale_sign_warning = '⚠' +let g:ale_lint_on_text_changed = 0 +let g:ale_hover_cursor = 1 +let g:ale_enabled = 1 +let g:ale_sign_column_always = 1 +let g:ale_open_list = 0 +let g:ale_set_highlights = 1 +let g:ale_set_signs = 1 +let g:ale_set_loclist = 1 +let g:ale_set_quickfix = 0 +let g:ale_echo_cursor = 1 +let g:ale_echo_msg_error_str = 'Error' +let g:ale_echo_msg_format = '%linter% - %code: %%s' +let g:ale_loclist_msg_format = '%linter% - %code: %%s' +let g:ale_echo_msg_warning_str = 'Warning' +let g:ale_linters = {'python': ['ruff', 'flake8', 'mypy'], +\ 'ocaml': ['merlin'], +\ 'cpp': ['clang'], +\ 'yaml': ['yamllint'], +\ 'c': ['clang'], +\ 'go': ['gopls', 'golint', 'gofmt'], + \} +let g:ale_fixers = { +\ 'python': ['ruff', 'isort', 'yapf', 'black'], +\ 'go': ['gofmt'], +\ 'rust': ['rustfmt'] +\ } +let g:ale_python_mypy_ignore_invalid_syntax = 1 +let g:ale_python_mypy_executable = 'mypy' +let g:ale_python_mypy_options = '--config-file mypy.ini' +" let g:ale_sign_error = '>>' +let g:ale_fix_on_save = 1 +let g:ale_linters_explicit = 0 " Python - keybindings -"nnoremap Ts :setlocal makeprg=pytest\ -q\ % -"nnoremap Tf :setlocal makeprg=flake8\ % -"nnoremap Tb :setlocal makeprg=black\ % -"nnoremap Tm :setlocal makeprg=mypy\ --ignore-missing-imports\ % +nnoremap Ts :setlocal makeprg=pytest\ -q\ % +nnoremap Tf :setlocal makeprg=flake8\ % +nnoremap Tb :setlocal makeprg=black\ % +nnoremap Tm :setlocal makeprg=mypy\ --ignore-missing-imports\ % " then run the one set with this... -"nnoremap Tt :make! +nnoremap Tt :make! " clear search highlights nnoremap :noh:call clearmatches() @@ -163,6 +272,120 @@ let g:netrw_preview = 1 autocmd BufNewFile,BufReadPost *.md map jj :r! date +" - \%H:\%M: "kJA$ autocmd BufNewFile,BufReadPost *.md map jd :r! date +"(\%Y-\%m-\%dT\%H:\%M)"i +syntax on "turn syntax highlighting on +filetype plugin indent on "load plugin and indent files associated a detected filetype +runtime macros/matchit.vim "allows jumping between brackets with % in normal mode + +" Go stuff +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 +let g:go_highlight_function_calls = 1 +let g:go_highlight_extra_types = 1 +let g:go_highlight_operators = 1 +let g:go_doc_keywordprg_enabled = 1 +let g:go_list_height = 0 +let g:go_highlight_operators = 1 +let g:go_highlight_function_parameters = 1 +let g:go_doc_max_height = 50 +let g:go_doc_popup_window = 1 +let g:go_list_height = 10 + + +" vim-go debugger window settings +let g:go_debug_windows = { + \ 'vars': 'leftabove 40vnew', + \ 'stack': 'leftabove 20new', + \ 'goroutines': 'botright 10new', + \ 'out': 'botright 5new', +\ } + +" vim-go and gopls +let g:go_def_mode='gopls' +let g:go_info_mode='gopls' +let g:go_play_browser_command = 'firefox %URL% &' +let g:go_test_show_name = 1 +let g:go_auto_type_info = 1 +let test#go#runner = 'gotest' +let g:go_term_mode = "split" +let g:go_term_height = 50 +let g:go_highlight_fields = 1 +let g:go_highlight_functions = 1 + +"autocmd FileType go nmap r :w:split terminal go run % +autocmd FileType go nmap R :GoRun +" highlights the variable in the file for you.. +"let g:go_auto_sameids = 1 +" auto import... +let g:go_fmt_command = "goimports" +" automatic type info on cursor +let g:go_auto_type_info = 2 +let g:go_snippet_engine = "ultisnips" +au Filetype go nmap ga (go-alternate-edit) +au Filetype go nmap gah (go-alternate-split) +au Filetype go nmap gav (go-alternate-vertical) +au Filetype go nmap gaf (go-fmt) +au Filetype go nmap gal (go-lint) +au Filetype go nmap gbx (go-deps) +au FileType go nmap :GoTestFunc -short +au FileType go nmap :GoTest -short +au FileType go nmap :DlvToggleBreakpoint +au FileType go nmap :DlvTest +au FileType go nmap :DlvDebug +au FileType go nmap :GoRename + +" FZF +" This is the default extra key bindings +let g:fzf_action = { + \ 'ctrl-t': 'tab split', + \ 'ctrl-x': 'split', + \ 'ctrl-v': 'vsplit' } + +" - FZF Popup window (center of the screen) +let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } } + +" Customize fzf colors to match your color scheme +let g:fzf_colors = +\ { 'fg': ['fg', '#f8f8f2'], + \ 'bg': ['bg', '#282a36'], + \ 'hl': ['fg', '#bd93f9'], + \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], + \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], + \ 'hl+': ['fg', 'Statement'], + \ 'info': ['fg', '#ffb86c'], + \ 'prompt': ['fg', '#50fa7b'], + \ 'pointer': ['fg', 'Exception'], + \ 'marker': ['fg', 'Keyword'], + \ 'spinner': ['fg', '#ffb86c'], + \ 'header': ['fg', '#6272a4'] } +" More fzf settings +" (https://github.com/zenbro/dotfiles/blob/master/.nvimrc#L151-L187) + let g:fzf_nvim_statusline = 0 " disable statusline overwriting + + " copy the path of the current file into the system clipboard +"nnoremap y :let @+=expand('%:p'):call system("true"):let @"=@+:echo "File path copied to clipboard: " . @+ +nnoremap y :let @*=expand('%:p'):call system("true"):let @+=@*:echo "File path copied to clipboard: " . @+ + +" Alternatively, format is as Markdown link +nnoremap Y :let @+=printf("[%s](%s)", expand('%:t'), "file://" . expand('%:p')):call system("true"):let @"=@+:echo "Markdown link copied to clipboard: " . @+ + +" command history is :History: + nnoremap :GFiles! + nnoremap :FZF! + nnoremap t :Files + nnoremap o :Tags + nnoremap h :History + nnoremap 0 :Files + nnoremap ; :BLines + nnoremap l :Lines + nnoremap o :BTags + nnoremap bu :Buffers + nnoremap ? :History: + " nnoremap / :execute 'Ag ' . input('Ag/') + nnoremap ft :Filetypes + nnoremap CC :Commands + imap (fzf-complete-file-ag) + imap (fzf-complete-line) + " ghetto note system " Go to index of notes nnoremap ni :e $NOTES_DIR/index.md:cd $NOTES_DIR @@ -187,6 +410,16 @@ nnoremap a :Rg "" Quick Editing vimrc nnoremap ev sjL:e $MYVIMRC +syntax enable +let g:solarized_termcolors=256 +let g:gruvbox_termcolors=256 +let g:gruvbox_contrast_dark='hard' +let g:gruvbox_contrast_light='hard' +let g:gruvbox_hls_cursor='orange' +let g:gruvbox_sign_column='bg0' +let g:gruvbox_number_column='bg0' +let g:gruvbox_invert_signs='0' +let g:gruvbox_improved_strings='0' set background=dark "colorscheme hipster colorscheme rosepine -- cgit v1.2.3 From 91254440a13261e993a21cd1b08a8db9e52490bd Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 11 Apr 2023 12:08:40 +0100 Subject: Enables completion in bash again This seemed to be missing from my moving back to bash. --- bashrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bashrc b/bashrc index 621fd21..e70c824 100644 --- a/bashrc +++ b/bashrc @@ -4,6 +4,11 @@ complete -cf sudo man which # reduce history size export HISTCONTROL=ignoreboth +# completions +if [ -f /usr/share/bash-completion/completions/pass ]; then + . /usr/share/bash-completion/completions/pass +fi + # export PS1='bash-\v-\u@\h \W\$ ' export PS1='\[\033[38;5;208m\]\u@\h:\w\$\[\033[0m\] ' -- cgit v1.2.3 From 9ce59b1edd0c220607b4449bcac7b13363bc2e11 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 11 Apr 2023 12:09:32 +0100 Subject: Enable fzf in the bash shell again Some useful stuff in here. --- bashrc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index e70c824..64226f9 100644 --- a/bashrc +++ b/bashrc @@ -27,6 +27,8 @@ export PATH=~/bin/:$PATH source $HOME/dotfiles/openai_key # aliases +alias pacget="pacman -Slq | fzf --multi --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S" +alias pacdel="pacman -Qq | fzf --multi --preview 'pacman -Qi {1}' | xargs -ro sudo pacman -Rns" alias gloga='git log --oneline --decorate --graph --all' alias batnote='batnote-source-code' alias am='append_to_masterlist' @@ -52,11 +54,15 @@ export TERM="screen-256color" export LESS="-iMRS -x2" export NOTES_DIR="~/Documents/Notes" export RANGER_LOAD_DEFAULT_RC="FALSE" -export FZF_DEFAULT_COMMAND="ag --nocolor -g " +export FZF_DEFAULT_COMMAND="rg --files --hidden --glob '!.git' " export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_ALT_C_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_DEFAULT_OPTS="--color info:108,prompt:109,spinner:108,pointer:168,marker:168" +# fzf +source /usr/share/fzf/key-bindings.bash +source /usr/share/fzf/completion.bash + # gpg export=GPG_TTY="$(tty)" export=SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" -- cgit v1.2.3 From b74f76e26755b4c6f2c0fc61e00176587848953d Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 11 Apr 2023 14:06:32 +0100 Subject: Adds back tab for Ultisnips expansion And removes tab from YCM, which is useless. --- vim/vimrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 35d0661..1e63413 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -82,12 +82,16 @@ nnoremap h (YCMToggleInlayHints) nnoremap gd :YcmCompleter GoToDefinition nnoremap gr :YcmCompleter GoToReferences nnoremap K :YcmCompleter GetDoc +" this will disable tab, allowing it to be used for ultisnips +let g:ycm_key_list_select_completion = ['', ''] +let g:ycm_key_list_previous_completion = ['', ''] + " snippets " Trigger configuration. You need to change this to something other than if you use one of the following: " - https://github.com/Valloric/YouCompleteMe " - https://github.com/nvim-lua/completion-nvim -let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" -- cgit v1.2.3 From 1ad01b8da6f03c9bf0b47f4c6e998af2c459e698 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 13 Apr 2023 17:44:09 +0100 Subject: Adds Classic Console font to alacrity And also switches off bold text because it looks shit. --- alacritty.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/alacritty.yml b/alacritty.yml index afc2d2b..05f6b2a 100644 --- a/alacritty.yml +++ b/alacritty.yml @@ -112,9 +112,9 @@ window: # Font configuration font: normal: - family: Jetbrains Mono + family: Classic Console Neue style: Regular - size: 13.0 + size: 14.0 #font: # Normal (roman) font face #normal: @@ -130,15 +130,15 @@ font: #style: Regular # Bold font face - #bold: + bold: # Font family # # If the bold family is not specified, it will fall back to the # value specified for the normal font. - #family: monospace + family: Classic Console Neue # The `style` can be specified to pick a specific face. - #style: Bold + style: Regular # Italic font face #italic: @@ -187,7 +187,7 @@ font: #builtin_box_drawing: true # If `true`, bold text is drawn using the bright color variants. -#draw_bold_text_with_bright_colors: false +draw_bold_text_with_bright_colors: true # Colors (Tomorrow Night) colors: -- cgit v1.2.3 From b100e1840f1da442f67548238d9fdf8477837bf5 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 13 Apr 2023 17:44:44 +0100 Subject: Adds a vim svelte plugin --- vim/vimrc | 1 + 1 file changed, 1 insertion(+) diff --git a/vim/vimrc b/vim/vimrc index 1e63413..c617eaa 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -62,6 +62,7 @@ Plug 'SirVer/UltiSnips' Plug 'honza/vim-snippets' Plug 'dense-analysis/ale' Plug 'davidhalter/jedi-vim' +Plug 'evanleck/vim-svelte' call plug#end() " jedi-vim -- cgit v1.2.3