set nocompatible " be iMproved, required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " let Vundle manage Vundle, required " Plugin 'VundleVim/Vundle.vim' Plugin 'scrooloose/nerdtree' Plugin 'scrooloose/nerdcommenter' Plugin 'tpope/vim-fugitive' Plugin 'airblade/vim-gitgutter' Plugin 'alvan/vim-closetag' Plugin 'vim-airline/vim-airline' Plugin 'whiteinge/diffconflicts' Plugin 'AndrewRadev/linediff.vim' Plugin 'nathanaelkane/vim-indent-guides' Plugin 'ctrlpvim/ctrlp.vim' Plugin 'prabirshrestha/vim-lsp' Plugin 'mattn/vim-lsp-settings' Plugin 'psf/black' " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " Custom _vimrc_local.vim files can be added wherever you want. " Add them to whitelist to source automatically " For example we can switch off augroup black python " for work related projects "augroup BlackPython "autocmd! "augroup END function Hfmt() execute ':!djlint --indent 2 --reformat % ' endfunction function Jfmt() execute ':!js-beautify -s2 -r % ' endfunction function AutoBlackFile() if $VIM_BLACK_VIA_SHELL == "y" execute ':!black % ' execute ':e' else execute ':Black' endif endfunction augroup BlackPython autocmd! autocmd BufWritePre *.py call AutoBlackFile() augroup END augroup SVELTE autocmd! au BufNewFile,BufRead *.svelte set filetype=html augroup END let mapleader="," set ts=4 shiftwidth=4 ai expandtab ruler cursorline lazyredraw incsearch autocmd BufNewFile,BufRead *.html set shiftwidth=2 ts=2 autocmd BufNewFile,BufRead *.js set shiftwidth=2 ts=2 autocmd BufNewFile,BufRead *.css set shiftwidth=2 ts=2 autocmd BufNewFile,BufRead *.vue set shiftwidth=2 ts=2 syntax on let g:vimwiki_list = [{'path': '~/docs/', 'syntax': 'markdown', 'ext': '.md'}] "Configuring the plugins let g:slime_target = "tmux" let g:slime_default_config = {"socket_name": 'default', "target_pane": "{last}"} let g:airline#extensions#tabline#enabled = 1 "let g:indent_guides_enable_on_vim_startup = 1 "let g:asyncomplete_auto_popup = 0 let g:lsp_preview_float = 1 let g:lsp_preview_keep_focus = 1 let g:black_fast = 1 "let g:lsp_highlights_enabled = 1 "let g:lsp_signature_help_enabled = 0 noremap :read !python % 2>&1 \| sed 's/^/\# /' noremap :NERDTreeToggle noremap :LspDefinition noremap :LspReferences noremap :Ack! nmap :TagbarToggle if executable('ag') let g:ackprg = 'ag --vimgrep' endif abbr atreid @reidransom iab atparth @ParthS007 iab atmarie @mariehankinson "iab br breakpoint() iab #N # NOTE(thesage21): iab #P print( iab #T # TODO(thesage21): iab tprint \import traceback \def show(*a, **kw): \line = traceback.extract_stack()[-2].line \print(line, "\|", *a, **kw) \ au BufRead,BufNewFile *.lambda set filetype=lambda set updatetime=100 if executable('ag') " Use Ag over Grep set grepprg=ag\ --nogroup\ --nocolor " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' " Use ag in ack to search for patterns let g:ackprg = 'ag --vimgrep' endif "Copy full buffer into X clipboard let @C = 'ggVG"+y' let @c = '"+y' let @P = 'ggVGx"+p' let @p = 'x"+p' "------------------ Claude function! Claude() abort " Yank the selected text into register v normal! gv"vy " Get the content of register v let selected_text = @v " Store the current position and buffer let s:start_pos = getpos("'<") let s:end_pos = getpos("'>") let s:original_buf = bufnr('%') " URL for the API let url = 'http://localhost:9002' " Escape single quotes in the selected text let escaped_text = substitute(selected_text, "'", "'\\\\''", "g") " Construct the curl command let curl_cmd = ['curl', '-s', '-X', 'POST', '--data-binary', 'Return only code, unless otherwise stated. ' . escaped_text, url] " Delete the selected text normal! gvd " Start the job let job = job_start(curl_cmd, { \ 'callback': function('s:HandleJobOutput'), \ 'close_cb': function('s:HandleJobClose'), \ 'exit_cb': function('s:HandleJobExit'), \ }) endfunction function! s:HandleJobOutput(channel, msg) abort " Collect output in a script-local variable if !exists('s:job_output') let s:job_output = [] endif call add(s:job_output, a:msg) endfunction function! s:HandleJobClose(channel) abort " Switch to the original buffer if bufexists(s:original_buf) execute 'buffer ' . s:original_buf " Replace the originally selected text with the collected output call setpos('.', s:start_pos) if exists('s:job_output') call append(line('.') - 1, s:job_output) execute 'normal! ' . len(s:job_output) . 'k' execute 'normal! V' . (len(s:job_output) - 1) . 'j=' endif " Clean up unlet! s:job_output s:start_pos s:end_pos s:original_buf else echoerr "Original buffer no longer exists" endif endfunction function! s:HandleJobExit(job, status) abort echomsg "Claude command completed with status: " . a:status endfunction command! -range Gpt ,call Claude() let g:lsp_settings = { \ 'pylsp-all': { \ 'workspace_config': { \ 'pylsp': { \ 'plugins': { \ 'pycodestyle': { \ 'enabled': v:true, \ 'maxLineLength': 88 \ }, \ 'jedi_completion': { \ 'enabled': v:true \ }, \ 'jedi_definition': { \ 'enabled': v:true \ } \ } \ } \ } \ } \}