This commit is contained in:
PowerUser64 2025-01-27 11:23:11 -08:00
commit 1ac141b8ce
13 changed files with 26 additions and 2330 deletions

View file

@ -110,7 +110,7 @@ key = "F11"
hide_when_typing = true hide_when_typing = true
[selection] [selection]
semantic_escape_chars = ",│`|:\"' ()[]{}<>" semantic_escape_chars = ",…││`|:\"' ()[]{}<>"
save_to_clipboard = true save_to_clipboard = true
[window] [window]

View file

@ -2,5 +2,6 @@ using OhMyREPL
using Pluto using Pluto
using Symbolics, Nemo using Symbolics, Nemo
using Unitful using Unitful
using Nemo
τ = 2*π τ = 2*π
pluto_custom() = Pluto.run(;port=8080, host="0.0.0.0", auto_reload_from_file=true, require_secret_for_access=false, warn_about_untrusted_code=false) pluto_custom() = Pluto.run(;port=8080, host="0.0.0.0", auto_reload_from_file=true, require_secret_for_access=false, warn_about_untrusted_code=false)

View file

@ -1,7 +0,0 @@
{
"diagnostic.displayByAle": true
/* "coc.preferences.formatOnSaveFiletypes": { */
/* "rust" */
/* } */
}

View file

@ -1,42 +0,0 @@
-- Blake's neovim rc file
-- plugins and plugin settings: ~/.config/nvim/lua/blake/plugins.lua
require('blake.plugins')
-- basic settings: ~/.config/nvim/lua/blake/settings.lua
require('blake.settings')
-- TODO:
-- Make plugins more modular
-- - Have a file with toggles for all plugins
-- - If a plugin toggle is off,
-- - the configuration for it should not be run,
-- - and the plugin should not be loaded
-- Downsides:
-- - requires me to add the plugin in two places (one in the plugin list, and again in the toggle list)
-- OR
-- - Find out how to get a list of loaded plugins
-- - Load the configuration for each plugin
-- Downsides:
-- - May not be plugin manager-independent
-- OR
-- - Create a file for each plugin that requires configuration and load them from their own files.
-- - I think this would be the most modular approach, as it would make my config more independent specific plugin managers.
-- Downsides:
-- - Lots of files (could be a good thing)
-- OR
-- - Make a list of plugins ('tpope/surround' style)
-- - load all plugins using whatever plugin manager in a for loop
-- - in the for loop, optionally load the configuration for each plugin based on its name
-- Downsides:
-- - Hardest (requires me to make a for loop, and I don't know lua)
-- - Doesn't take advantage of advanced plugin manager features (ex: dependencies)
-- Plugins to get:
-- https://github.com/glepnir/mcc.nvim
-- https://github.com/glepnir/lspsaga.nvim
-- https://github.com/glepnir/template.nvim
-- https://github.com/glepnir/dashboard-nvim
--
-- Plugins to check out:
-- https://github.com/glepnir/indent-guides.nvim
-- https://github.com/glepnir/coman.nvim

View file

@ -1,507 +0,0 @@
"set runtimepath^=~/.vim runtimepath+=~/.vim/after
"let &packpath = &runtimepath
"source ~/.vimrc
set suffixes+=.aux,.bbl,.blg,.brf,.cb,.dvi,.idx,.ilg,.ind,.inx,.jpg,.log,.out,.png,.toc
set suffixes-=.h
set suffixes-=.obj
set tabstop=3 softtabstop=3
set shiftwidth=3
set expandtab
set smartindent
" set foldmethod=indent
" set foldlevel=0
set undodir=~/.vim/undo
set undofile
set guifont=SauceCodePro\ NF\ Regular
set hlsearch
set hidden
set ignorecase
set smartcase
set wrap
set linebreak
" set guicursor= " always use the block cursor
syntax on
set redrawtime=1000 " max syntax highlight time
set number relativenumber
set noerrorbells
set encoding=UTF-8
set cursorline
set mouse=a
set incsearch
set scrolloff=6
" set wildmenu
" set wildmode=full
" TextEdit might fail if hidden is not set.
set hidden
set cmdheight=1 " Give more space for displaying messages.
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Spell check!
set spell spelllang=en_us
" spell check in git commits
autocmd Filetype gitcommit setlocal spell
set showcmd
set signcolumn=yes
" disable spell check in help files
autocmd FileType help setlocal nospell
filetype plugin on
" Macro for opening a new terminal with spell check off
command! Term tabnew | setlocal nospell | term
autocmd FileType help setlocal nospell
" test whitespace ->
" more test whitespace ->
" Indented text
" even more test whitespace ->
" Key bindings
let mapleader = " "
" *sigh*...
command! Q q
command! W w
command! Wq wq
command! WQ wq
" nnoremap ; :
" vnoremap ; :
" Press Alt h to toggle highlighting on/off, and show current value.
noremap <M-h> :set hlsearch! hlsearch?<CR>
" Escape to enter normal mode in the terminal
tnoremap <Esc> <C-\><C-n>
" Replace with alt S
nnoremap <M-s> :%s//g<Left><Left>
" Wrapped line movement (hold ctrl to move like a word processor)
nmap <C-h> h
nmap <C-j> gj
nmap <C-k> gk
nmap <C-l> l
" nmap <C-4> g$
nmap <C>$ g$
nmap <C-6> g^
nmap <C-^> g^
nmap <C-0> g^
vmap <C-h> h
vmap <C-j> gj
vmap <C-k> gk
vmap <C-l> l
vmap <C-4> g$
vmap <C>$ g$
vmap <C-6> g^
vmap <C-^> g^
vmap <C-0> g^
" " Hold ctrl to move between windows, shift to reorder the windows
" nmap <C-h> <C-w>h
" nmap <C-j> <C-w>j
" nmap <C-k> <C-w>k
" nmap <C-l> <C-w>l
" nmap <C-H> <C-w>H
" nmap <C-J> <C-w>J
" nmap <C-K> <C-w>K
" nmap <C-L> <C-w>L
" " and for visual mode
" vmap <C-h> <C-w>h
" vmap <C-j> <C-w>j
" vmap <C-k> <C-w>k
" vmap <C-l> <C-w>l
" vmap <C-H> <C-w>H
" vmap <C-J> <C-w>J
" vmap <C-K> <C-w>K
" vmap <C-L> <C-w>L
""""""" Quality of life things that aren't one line (also from stack overflow and stuff)
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
" 'Visual At' plugin (https://github.com/stoeffel/.dotfiles/blob/master/vim/visual-at.vim)
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
" Make shift-insert work like in Xterm
if has('gui_running')
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>
endif
set exrc
" Automatically jump to the last position in a file when opening
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
"" Plugins
" disable polyglot in markdown (needs to go before it loads)
let g:polyglot_disabled = ['markdown']
" make ALE work with CoC
let g:ale_disable_lsp = 1
call plug#begin('$HOME/.vim/plugins/')
""" Colors
Plug 'joshdick/onedark.vim' " Theme (status line)
Plug 'romgrk/doom-one.vim' " Theme (UI)
Plug 'vim-airline/vim-airline' " Status line theme
Plug 'Yggdroot/indentLine' " Indent lines
Plug 'sheerun/vim-polyglot' " Syntax highlighting
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " Syntax highlighting (neovim 0.5)
Plug 'airblade/vim-gitgutter' " Inline git info
" Plug 'tribela/vim-transparent' " Transparency always
""" IDE features/LSP
Plug 'editorconfig/editorconfig-vim' " editorconfig support
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Code completion
Plug 'dense-analysis/ale' " Code formatting, linting
Plug 'dbeniamine/cheat.sh-vim' " cheat.sh
""" Smaller IDE features
Plug 'mbbill/undotree' " Undo tree
Plug 'jiangmiao/auto-pairs' " Quote pairing
Plug 'junegunn/vim-easy-align'
Plug 'tpope/vim-repeat' " Repeatability for various tpope plugins
Plug 'tpope/vim-surround' " Quote/parenthesis changing
Plug 'tpope/vim-sensible' " Some sensible defaults
Plug 'tpope/vim-commentary' " Comments
Plug 'tpope/vim-fugitive' " git integration
" File explorer
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " File type colors
Plug 'ryanoasis/vim-devicons' " File icons
Plug 'Xuyuanp/nerdtree-git-plugin' " File git status
" Misc
Plug 'junegunn/goyo.vim', {'for': 'markdown', 'on': 'Goyo'} " Minimalist writing mode
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } " Firefox nvim integration
call plug#end()
"""""""""""""""""""""""""""""" Things set as a result of plugins
""" Colors
set background=dark
if match(&runtimepath, 'doom-one') != -1
let g:doom_one_terminal_colors = v:true
colorscheme doom-one
elseif match(&runtimepath, 'one') != -1
let g:one_allow_italics = 1
colorscheme one
else
colorscheme slate
set nocursorline
endif
""" Transparency
if match(&runtimepath, 'transparent') != -1
call g:background#clear_background()
endif
""" Airline
if match(&runtimepath, 'airline') != -1
let g:airline_powerline_fonts = 1
let g:airline_detect_spell=0 " (*YES*, I KNOW I have spell check on all the time)
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
if match(&runtimepath, 'onedark') != -1
let g:airline_theme='onedark'
elseif match(&runtimepath, 'one') != -1
let g:airline_theme='one'
endif
" this is the first bit of vimscript I ever wrote
" This also turned out to be the last bit of vimscript I would ever write
function! Tabline_auto_show_hide()
let tab_count = tabpagenr("$")
if tab_count == 2
" if there is one tab
if &lines > 3
set showtabline=2
endif
" echom 'The tab bar was enabled'
elseif tab_count == 1
if &lines > 3
set showtabline=1
endif
" echom 'The tab bar was disabled'
endif
endfunction
augroup TablineShowHide
" autocmd! BufEnter * call Tabline_auto_show_hide()
autocmd! TabNew * call Tabline_auto_show_hide()
autocmd! TabClosed * call Tabline_auto_show_hide()
autocmd! VimEnter * call Tabline_auto_show_hide()
autocmd! User GoyoLeave * call Tabline_auto_show_hide()
augroup END
endif
""" Commentary
if match(&runtimepath, 'commentary') != -1
nnoremap <Leader>l :Commentary<CR>
endif
""" indentline
if match(&runtimepath, 'indentline') != -1
let g:indentLine_char = '▏'
let g:indentLine_conceallevel = 1
let g:indentLine_fileTypeExclude = ['markdown']
endif
""" CtrlP
if match(&runtimepath, 'indentline') != -1
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
" set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*. " ignored file extensions
" let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] " Ignoer files in .gitignore's
endif
""" Undotree
if match(&runtimepath, 'undotree') != -1
nnoremap <F5> :UndotreeToggle<CR>
endif
""" Asynchronous Lint Engine (ALE)
" if match(&runtimepath, 'ale') != -1
" endif
""" Auto-pairs
if match(&runtimepath, 'autopairs') != -1
let g:AutoPairsFlyMode = 1
endif
""" Goyo
if match(&runtimepath, 'indentline') != -1
function! s:goyo_enter()
if executable('tmux') && strlen($TMUX)
silent !tmux set status off
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
endif
" silent Limelight
echo
endfunction
function! s:goyo_leave()
if executable('tmux') && strlen($TMUX)
silent !tmux set status on
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
endif
" set showmode
" set showcmd
" set scrolloff=5
" silent Limelight!
echo
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
endif
""" Treesitter
if match(&runtimepath, 'treesitter') != -1
lua << EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
--ignore_install = { "javascript", "java" }, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
-- disable = { "c", "rust" }, -- list of language that will be disabled
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = true,
},
indent = {
enable = true
}
}
EOF
endif
""" CoC
if match(&runtimepath, 'coc') != -1
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
" unicode characters in the file autoload/float.vim
set encoding=utf-8
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=1
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder.
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Applying codeAction to the selected region.
" Example: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
" Mappings for CoCList
" Show all diagnostics.
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions.
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
" Show commands.
nnoremap <silent><nowait> <space>C :<C-u>CocList commands<cr>
" Find symbol of current document.
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols.
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
endif
"""""""""""""""""""""""""""" END Plugin-dependent settings

View file

@ -1,93 +0,0 @@
local M = {}
-- DAP: Debug Adapter Protocol >>>
M.nvim_dap = function()
local dap = require('dap')
-- keybinds
vim.cmd [[
" Debugger movement
nnoremap <silent> <leader>d<space> <cmd>lua require'dap'.continue()<CR>
nnoremap <silent> <leader>dj <cmd>lua require'dap'.step_over()<CR>
nnoremap <silent> <leader>dl <cmd>lua require'dap'.step_into()<CR>
nnoremap <silent> <leader>dh <cmd>lua require'dap'.step_out()<CR>
" Breakpoints
nnoremap <silent> <leader>dbb <cmd>lua require'dap'.toggle_breakpoint()<CR>
nnoremap <silent> <leader>dbc <cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition<cmd> '))<CR>
nnoremap <silent> <leader>dbl <cmd>lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message<cmd> '))<CR>
" Extra
nnoremap <silent> <leader>dp <cmd>lua require'dap'.run_last()<CR>
nnoremap <silent> <leader>dr <cmd>lua require'dap'.repl.open()<CR>
nnoremap <silent> <leader>dq <cmd>lua require'dap'.close()<CR>
]]
require("dap")
vim.fn.sign_define('DapBreakpoint', {text = '', texthl = 'ErrorMsg', linehl = '', numhl = ''}) -- custom attributes of breakpointed lines (use an emoji?)
vim.fn.sign_define('DapBreakpointRejected', {text = '', texthl = 'ErrorMsg', linehl = '', numhl = ''})
vim.fn.sign_define('DapLogPoint', {text = '', texthl = 'ErrorMsg', linehl = '', numhl = ''})
vim.fn.sign_define('DapStopped', {text = '', texthl = 'String', linehl = '', numhl = ''})
vim.cmd "au FileType dap-repl lua require('dap.ext.autocompl').attach()"
-- dap configuration
dap.defaults.fallback.terminal_win_cmd = "10new"
-- per-language config:
-- c++ dap congiguration >>>
dap.configurations.cpp = {
{
name = "Launch file",
type = "cppdbg",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = true,
},
}
dap.adapters.cppdbg = {
type = 'executable',
command = '/home/blake/.local/share/nvim/dapinstall/ccppr_vsc/extension/debugAdapters/bin/OpenDebugAD7',
}
-- <<<
end -- <<<
-- DAP installer >>>
M.dap_buddy = function()
require("dap_buddy").setup({
installation_path = vim.fn.stdpath("data") .. "/dap_buddy/",
})
end -- <<<
-- UI for nvim-dap >>>
M.dap_ui = function()
-- external keybinds
-- require("dapui").open()
-- require("dapui").close()
-- require("dapui").toggle()
-- toggle dap-ui with leader di as in dap interface
vim.cmd 'nnoremap <silent> <leader>di <cmd>lua require("dapui").toggle("sidebar")<CR>'
require("dapui").setup({
icons = { expanded = "", collapsed = "" },
mappings = {
expand = { "l", "h", "<CR>", "<2-LeftMouse>", }, -- expand (or close)
open = "o", -- action depends on the dap server
remove = "d", -- delete the variable
edit = "s", -- (as in substitute)
repl = "r", -- open a repl
},
windows = { indent = 1 },
})
end -- <<<
-- dap-virtual-text: show values of variables inline while debugging >>>
M.dap_vtext = function()
require'nvim-dap-virtual-text'
-- virtual text deactivated (default)
vim.g.dap_virtual_text = true
-- show virtual text for current frame (recommended)
vim.g.dap_virtual_text = true
-- request variable values for all frames (experimental)
vim.g.dap_virtual_text = 'all frames'
end -- <<<
return M
-- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3

View file

@ -1,344 +0,0 @@
local M = {}
-- lsp_signature >>>
M.signature = function()
require "lsp_signature".setup({
toggle_key = '<M-x>'
})
end -- <<<
-- lspinstall >>>
M.lspinstall = function() --
require("nvim-lsp-installer").setup()
end -- <<<
-- treesitter >>>
M.treesitter = function()
require'nvim-treesitter.configs'.setup {
-- install the necessary parsers
ensure_installed = {
"bash",
"c",
"cmake",
"comment",
"cpp",
"css",
"dockerfile",
"faust",
"html",
"javascript",
"json",
"jsonc",
"lua",
"markdown",
"nix",
"python",
"r",
"regex",
"rst",
"rust",
"toml",
"vim",
"yaml",
},
--ignore_install = { "javascript", "java" }, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
},
-- indent = {
-- enable = true
-- },
incremental_selection = {
enable = true,
keymaps = {
init_selection = 'gnn',
node_incremental = 'grn',
scope_incremental = 'grc',
node_decremental = 'grm',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
},
}
end -- <<<
-- cmp >>>
M.cmp = function()
-- nvim-cmp supports additional completion capabilities
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-- capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
-- luasnip setup
local luasnip = require 'luasnip'
-- If you want insert `(` after select function or method item
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'nvim_lua' },
{ name = 'otter' },
{ name = 'pandoc_references' },
{ name = 'luasnip' },
{ name = 'treesitter' },
{ name = 'calc' },
-- { name = 'spell' },
{ name = 'emoji' },
{ name = 'buffer' },
{ name = 'path' },
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = function(entry, vim_item)
-- fancy icons and a name of kind
local kind = require("lspkind").cmp_format({ mode = "symbol", maxwidth = 50 })(entry, vim_item)
-- local strings = vim.split(kind.kind, "%s", { trimempty = true })
-- set a name for each source
vim_item.kind = " " .. kind.kind
vim_item.menu = ({
path = "[path]",
emoji = "[emoji]",
nvim_lua = "[lua]",
nvim_lsp = "[lsp]",
treesitter = "[ts]",
calc = "[calc]",
-- spell = "[spell]",
cmdline = "[cmd]",
buffer = "[buf]",
luasnip = "[snip]",
pandoc_references = "[pandoc]",
otter = "[quarto]",
})[entry.source.name] or "unknown type"
return vim_item
end,
},
window = {
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
},
documentation = {
border = { "", "", "", "", "", "", "", "" },
},
},
experimental = {
ghost_text = true,
},
}
-- Thanks to iwataka on github for this bit
local search_config = {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' },
}
}
-- Use buffer source for `/` and `?`
cmp.setup.cmdline('/', search_config)
cmp.setup.cmdline('?', search_config)
-- `:` cmdline setup.
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
{ name = 'cmdline' },
})
})
end -- <<<
-- lspconfig >>>
M.lspconfig = function()
local nvim_lsp = require('lspconfig')
-- Keybinds >>>
-- commit before telescope keybinds: 5d63069
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local opts = { noremap=true, silent=true }
local map = vim.api.nvim_set_keymap
local buffmap = vim.api.nvim_buf_set_keymap
local buffopt = vim.api.nvim_buf_set_option
map('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
map('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
map('n', '<leader>q', '<cmd>lua require("telescope.builtin").diagnostics()<CR>', opts) -- Telescope
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
buffopt(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
buffmap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buffmap(bufnr, 'n', 'gd', '<cmd>lua require("telescope.builtin").lsp_definitions()<CR>', opts) -- Telescope
buffmap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buffmap(bufnr, 'n', 'gI', '<cmd>lua require("telescope.builtin").lsp_implementations()<CR>', opts) -- Telescope
buffmap(bufnr, 'n', '<M-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buffmap(bufnr, 'n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buffmap(bufnr, 'n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buffmap(bufnr, 'n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buffmap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buffmap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buffmap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buffmap(bufnr, 'n', 'gR', '<cmd>lua require("telescope.builtin").lsp_references()<CR>', opts) -- Telescope
buffmap(bufnr, 'n', '<leader>f', '<cmd>lua vim.lsp.buf.format { async = true }<CR>', opts)
buffmap(bufnr, 'n', '<leader>so', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>', opts)
end -- <<<
-- cmp things >>>
local capabilities
if packer_plugins["nvim-cmp"] and packer_plugins["nvim-cmp"].loaded then -- only load this if cmp is loaded
capabilities = require("cmp_nvim_lsp").default_capabilities()
end
-- <<<
-- Load servers >>>
-- General servers >>>
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local lsp_servers = {
'bashls',
'clangd',
'cssls',
'dockerls',
'eslint',
'html',
'jsonls',
'kotlin_language_server',
'marksman',
'nil_ls',
'nil_ls',
'rust_analyzer',
-- 'yamlls',
}
for _, lsp in pairs(lsp_servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end
-- <<<
-- Custom servers:
-- lua >>>
local sumneko_root_path
local sumneko_binary
if (vim.fn.exepath('lua-language-server') ~= '') then
-- If you installed this with your package manager
sumneko_root_path = '/usr/lib/lua-language-server/bin/Linux'
sumneko_binary = vim.fn.exepath('lua-language-server')
else
-- If you installed this with lspinstall
sumneko_root_path = vim.fn.getenv 'HOME' .. '/.local/share/nvim/lspinstall/lua/sumneko-lua/extension/server'
sumneko_binary = sumneko_root_path .. '/lua-language-server'
end
-- From kickstart.nvim:
if (vim.fn.executable(sumneko_binary) == 1) then
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
nvim_lsp.lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file('', true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
}
end
-- lua <<<
-- <<<
end -- <<<
return M
-- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3

View file

@ -1,496 +0,0 @@
local M = {}
-- telescope >>>
M.telescope = function ()
-- telescope action binds >>>
local map = vim.api.nvim_set_keymap
local opt = {
noremap = true,
silent = true,
}
map("n", "<leader>sf", "<cmd>lua require('telescope.builtin').find_files()<cr>", opt)
map("n", "<leader>sg", "<cmd>lua require('telescope.builtin').live_grep()<cr>", opt)
map("n", "<leader>sb", "<cmd>lua require('telescope.builtin').buffers()<cr>", opt)
map("n", "<leader>ss", "<cmd>lua require('telescope.builtin').lsp_dynamic_workspace_symbols()<cr>", opt)
-- <<<
-- telescope config >>>
require('telescope').setup(
)
-- <<<
end
-- <<<
-- nvimtree >>>
M.nvimtree = function ()
require'nvim-tree'.setup {
hijack_cursor = true,
}
end -- <<<
-- toggleterm >>>
M.toggleterm = function()
require("toggleterm").setup{
-- size can be a number or function which is passed the current terminal
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<F12>]],
hide_numbers = true, -- hide the number column in toggleterm buffers
shading_factor = '1', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
start_in_insert = true,
direction = 'float', -- vertical, horizontal, window, or float
close_on_exit = true, -- close the terminal window when the process exits
-- shell = vim.o.shell, -- change the default shell
-- This field is only relevant if direction is set to 'float'
float_opts = {
-- The border key is *almost* the same as 'nvim_open_win'
-- see :h nvim_open_win for details on borders however
-- the 'curved' border is a custom border type
-- not natively supported but implemented in this plugin.
border = 'curved', -- single, double, shadow, or curved
width = 200,
height = 48,
winblend = 10, -- transparancy
highlights = {
border = "Normal",
background = "Normal",
}
}
}
end -- <<<
-- gitsigns >>>
M.gitsigns = function()
require('gitsigns').setup {
signs = {
add = {hl = 'GitSignsAdd' , text = '', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
change = {hl = 'GitSignsChange', text = '', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
topdelete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
-- Actions
map('n', '<leader>hs', gs.stage_hunk)
map('n', '<leader>hr', gs.reset_hunk)
map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('n', '<leader>hS', gs.stage_buffer)
map('n', '<leader>hu', gs.undo_stage_hunk)
map('n', '<leader>hR', gs.reset_buffer)
map('n', '<leader>hp', gs.preview_hunk)
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
map('n', '<leader>tb', gs.toggle_current_line_blame)
map('n', '<leader>hd', gs.diffthis)
map('n', '<leader>hD', function() gs.diffthis('~') end)
map('n', '<leader>td', gs.toggle_deleted)
-- Text object
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end,
watch_gitdir = {
interval = 1000,
follow_files = true
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
worktrees = {
{
toplevel = vim.env.HOME,
gitdir = vim.env.HOME .. '/git/dotfiles'
},
},
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
},
current_line_blame_formatter_opts = {
relative_time = false
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
yadm = {
enable = false
},
}
end -- <<<
-- neoscroll for smooth scrolling >>>
M.neoscroll = function()
require('neoscroll').setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = { '<C-u>', '<C-d>', '<C-b>', '<C-f>', '<C-y>', '<C-e>',
'zt', 'zz', 'zb', '<ScrollWheelUp>', '<ScrollWheelDown>', },
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = 'sine', -- use sine easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
})
end
-- <<<
-- indent_blankline >>>
M.indent_blankline = function()
vim.cmd [[
let g:indent_blankline_show_first_indent_level = v:true
let g:indent_blankline_show_foldtext = v:false
let g:indent_blankline_buftype_exclude = ['terminal']
let g:indent_blankline_use_treesitter = v:true
let g:indent_blankline_show_current_context = v:true
]]
require("ibl").setup()
end
-- <<<
-- ZenMode >>>
M.zenmode = function()
-- map :ZM to :ZenMode
vim.cmd 'cab ZM ZenMode'
require("zen-mode").setup {
window = {
backdrop = 1, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
-- height and width can be:
-- * an absolute number of cells when > 1
-- * a percentage of the width / height of the editor when <= 1
-- * a function that returns the width or the height
width = 120, -- width of the Zen window
height = 51-2, -- height of the Zen window
-- by default, no options are changed for the Zen window
-- uncomment any of the options below, or add other vim.wo options you want to apply
options = { -- uncomment to do what the sign says
-- signcolumn = "no", -- signcolumn
number = false, -- number column
-- relativenumber = false, -- relative numbers
-- cursorline = false, -- cursorline
cursorcolumn = false, -- cursor column
-- foldcolumn = "0", -- fold column
-- list = false, -- whitespace characters
},
},
plugins = {
-- disable some global vim options (vim.o...)
-- comment the lines to not apply the options
options = {
enabled = true,
ruler = false, -- disables the ruler text in the cmd line area
showcmd = false, -- disables the command in the last line of the screen
},
twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
gitsigns = { enabled = true }, -- disables git signs
tmux = { enabled = false }, -- disables the tmux statusline
},
}
end
-- <<<
-- Autosession >>>
M.autosession = function()
local opts = {
log_level = 'info',
auto_session_enable_last_session = true,
auto_session_root_dir = vim.fn.stdpath('data').."/sessions/",
auto_session_enabled = true,
auto_save_enabled = false,
auto_restore_enabled = true,
auto_session_suppress_dirs = nil,
}
require('auto-session').setup(opts)
-- save some more things. notably options, resize, winpos, and terminal
vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,resize,winpos,terminal"
-- So I don't forget which one it is
vim.cmd 'cab SessionSave SaveSession'
vim.cmd 'cab SessionDelete DeleteSession'
vim.cmd 'cab SessionRestore RestoreSession'
end -- <<<
-- Lualine >>>
M.lualine = function()
-- From https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/evil_lualine.lua
-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
-- Example:
-- ▊  20.2k .zshrc 320:1 56%  LSP: bashls UTF-8 UNIX ▊
local lualine = require 'lualine'
-- Color table for highlights
-- stylua: ignore
-- Onedark colors
-- local colors = {
-- bg = '#21242B',
-- fg = '#bbc2cf',
-- yellow = '#ECBE7B',
-- cyan = '#008080',
-- darkblue = '#081633',
-- green = '#98be65',
-- orange = '#FF8800',
-- violet = '#a9a1e1',
-- magenta = '#c678dd',
-- blue = '#51afef',
-- red = '#ec5f67',
-- }
local colors = {
bg = '#1a1b26',
fg = '#c0caf5',
red = '#f7768e',
orange = '#ff9e64',
yellow = '#e0af68',
green = '#9ece6a',
cyan = '#7dcfff',
blue = '#7aa2f7',
darkblue = '#081633',
violet = '#6d60e0',
magenta = '#bb9af7',
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand '%:t') ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand '%:p:h'
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = '',
section_separators = '',
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x ot right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
function()
return ''
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
ins_left {
-- mode component
function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.green,
i = colors.blue,
v = colors.magenta,
[''] = colors.magenta,
V = colors.magenta,
c = colors.violet,
no = colors.green,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
ic = colors.yellow,
R = colors.red,
Rv = colors.red,
cv = colors.green,
ce = colors.green,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.green,
t = colors.green,
}
vim.api.nvim_command('hi! LualineMode guifg=' .. mode_color[vim.fn.mode()] .. ' guibg=' .. colors.bg)
return ''
end,
color = 'LualineMode',
padding = { right = 1 },
}
ins_left {
-- filesize component
'filesize',
cond = conditions.buffer_not_empty,
}
ins_left {
'filename',
cond = conditions.buffer_not_empty,
color = { fg = colors.magenta, gui = 'bold' },
}
ins_left { 'location' }
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = '', warn = '', info = '' },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
},
}
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
function()
return '%='
end,
}
-- ins_left {
-- -- Lsp server name .
-- function()
-- local msg = 'No Active Lsp'
-- local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
-- local clients = vim.lsp.get_active_clients()
-- if next(clients) == nil then
-- return msg
-- end
-- for _, client in ipairs(clients) do
-- local filetypes = client.config.filetypes
-- if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
-- return client.name
-- end
-- end
-- return msg
-- end,
-- icon = ' LSP:',
-- color = { fg = '#ffffff', gui = 'bold' },
-- }
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'fileformat',
fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'branch',
icon = '',
color = { fg = colors.violet, gui = 'bold' },
}
ins_right {
'diff',
-- Is it me or the symbol for modified us really weird
symbols = { added = '', modified = '', removed = '' },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
ins_right {
function()
return ''
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
-- Now don't forget to initialize lualine
lualine.setup(config)
end -- <<<
return M
-- vim:fdm=marker:fmr=>>>,<<<:expandtab:tabstop=3:sw=3

View file

@ -1,659 +0,0 @@
-- Load plugins
-- Bootstrap packer if needed {{
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
Packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
end
-- }}
-- set packer threads {{
-- Reduce the maximum number of jobs in termux (a terminal for android) or if WEAK_SYSTEM is set to true
if (os.getenv("TERMUX_VERSION") ~= nil) or (os.getenv("WEAK_SYSTEM") == "true") then
Packer_max_jobs = 5
else
Packer_max_jobs = 100
end
local use = require('packer').use
-- }}
return require('packer').startup({function()
-- TODO: Find a better way to organize this
-- impatient (needs to go early)
use { -- lewis6991: impatient: Make nvim load faster by caching them - needs to load early
'lewis6991/impatient.nvim',
config = function()
require('impatient')
end,
}
-- Packer
use { -- packer: plugin manager
'wbthomason/packer.nvim',
config = function()
-- Map :PS to :PackerSync
vim.cmd 'cab PS PackerSync'
end,
}
-- Colors (decorations)
use { -- treesitter: syntax highlighting and more
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
config = function()
require('blake.lsp').treesitter()
end,
}
use { -- onedark.nvim: onedark theme
'navarasu/onedark.nvim',
config = function()
-- vim.g.onedark_transparent_background = true
vim.cmd [[
"au ColorScheme onedark hi TabLine gui=none guibg='#282C34' guifg='#5C6370' " all tabs color
au ColorScheme onedark hi TabLineSel guibg='#282C34' guifg='#B5BBC7' " Highlighted tab color
"au ColorScheme onedark hi TabLineFill guibg='#282C34' " tabline portion without tabs (right-hand side)
]]
end
}
use { -- tokyonight.nvim: tokyonight theme
'folke/tokyonight.nvim',
config = function()
-- vim.g.tokyonight_style = "night"
vim.g.tokyonight_italic_functions = true
vim.g.tokyonight_sidebars = { "nvimtree", "qf", "vista_kind", "terminal", "packer" }
vim.cmd [[
au ColorScheme tokyonight hi TabLine gui=none guibg='#1D202F' guifg='#565F89' " all tabs color
au ColorScheme tokyonight hi TabLineSel guibg='#24283B' guifg='#C0CAF5' " Highlighted tab color
au ColorScheme tokyonight hi TabLineFill guibg='#1D202F' " tabline portion without tabs (right-hand side)
]]
-- Has to be put here so it runs synchronously
vim.cmd 'colorscheme tokyonight'
end,
}
use { -- newspring: Good light theme for writing
'NLKNguyen/papercolor-theme',
}
use { -- statusline: lualine
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
config = function()
require('blake.other').lualine()
end,
}
-- use { -- nvim-tabline: batter looking tabline
-- 'alvarosevilla95/luatab.nvim',
-- requires = { 'kyazdani42/nvim-web-devicons' },
-- config = function()
-- require('luatab').setup()
-- end
-- }
use { -- nvim-colorizer: css color tag highlighter (ex- #FFB13B)
'norcalli/nvim-colorizer.lua',
config = function()
vim.cmd 'cab COL ColorizerToggle'
end,
}
use { -- vim-illuminate: highlight other occurrences of the word under cursor
'RRethy/vim-illuminate',
-- commit = '27f6ef135a88d9410a33cf92fc47f5c018df552c', -- for finding the correct color to make highlights
config = function()
vim.keymap.set('n', '<a-i>', require('illuminate').toggle_freeze_buf)
require('illuminate').configure({
providers = {
'treesitter',
'regex',
}
})
end
}
-- Tree-sitter
use { -- treesitter-context: equivalent to vsc*de's "sticky scrolling"
'nvim-treesitter/nvim-treesitter-context',
config = function()
require('treesitter-context').setup {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 5, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 1, -- Maximum number of lines to show for a single context
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = 'topline', -- Line used to calculate context. Choices: 'cursor', 'topline'
-- Separator between context and content. Should be a single character string, like '-'.
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
separator = nil,
zindex = 20, -- The Z-index of the context window
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
}
end
}
-- IDE features
---- LSP
use { -- lspinstall: language server installer, (lspconfig is here too)
'williamboman/nvim-lsp-installer',
{ -- lspconfig: default language server configurations
'neovim/nvim-lspconfig',
config = function()
require('blake.lsp').lspinstall()
require('blake.lsp').lspconfig()
end
}
}
use { -- cmp: completion menu
'hrsh7th/nvim-cmp',
config = function()
require('blake.lsp').cmp()
end,
requires = { -- (mostly) nvim-cmp sources (not required by cmp, but reqired by my configuration)
'f3fora/cmp-spell',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-calc',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-emoji',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-path',
'jc-doyle/cmp-pandoc-references',
'onsails/lspkind-nvim', -- icons for entries of the completion menu, required by config
'ray-x/cmp-treesitter',
'saadparwaiz1/cmp_luasnip',
},
}
use { -- luasnip: snippits plugin
'L3MON4D3/LuaSnip',
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end
}
use { -- friendly-snippets: lots of good snippits
'rafamadriz/friendly-snippets'
}
use { -- lsp_signature: function parameter previews
'ray-x/lsp_signature.nvim',
after = 'nvim-lspconfig',
config = function()
require('blake.lsp').signature()
end,
}
use { -- symbols-outline: treesitter-based document outline (SO)
'simrat39/symbols-outline.nvim',
config = function()
vim.cmd 'cab SO SymbolsOutline'
vim.cmd 'nnoremap <Leader>so <cmd>SymbolsOutline<CR>'
end,
}
use { -- null-ls: Support for lots of programming tools, but through nvim lsp
'jose-elias-alvarez/null-ls.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
local null_ls = require("null-ls")
require("null-ls").setup({
sources = {
null_ls.builtins.code_actions.refactoring,
null_ls.builtins.formatting.alejandra,
null_ls.builtins.formatting.jq,
}
})
end
}
use { -- refactoring: Refactoring tools for neovim
'ThePrimeagen/refactoring.nvim',
requires = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-treesitter/nvim-treesitter' }
},
config = function()
require('refactoring').setup({})
-- Remaps for the refactoring operations currently offered by the plugin
vim.api.nvim_set_keymap("v", "<leader>re", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>rf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>rv", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
-- Extract block doesn't need visual mode
vim.api.nvim_set_keymap("n", "<leader>rb", [[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("n", "<leader>rbf", [[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]], {noremap = true, silent = true, expr = false})
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
vim.api.nvim_set_keymap("n", "<leader>ri", [[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
-- Refactoring telescope integration
-- load refactoring Telescope extension
require("telescope").load_extension("refactoring")
-- remap to open the Telescope refactoring menu in visual mode
vim.api.nvim_set_keymap(
"v",
"<leader>rr",
"<Esc><cmd>lua require('telescope').extensions.refactoring.refactors()<CR>",
{ noremap = true }
)
end,
}
---- DAP (Debug Adapter Protocol)
use { -- nvim-dap: DAP support
'mfussenegger/nvim-dap',
config = function()
require('blake.dap').nvim_dap()
end
}
-- use { -- dap-buddy: DAP adapter installer - DBInstall
-- 'Pocco81/dap-buddy.nvim',
-- config = function()
-- require('blake.dap').dap_buddy()
-- end
-- }
use { -- virtual-text: Print Variable names while debugging
'theHamsta/nvim-dap-virtual-text',
requires = {"mfussenegger/nvim-dap", "nvim-neotest/nvim-nio"},
config = function()
-- calling this with a parameter to keep lua language server from complaining
require("nvim-dap-virtual-text").setup({context_commentstring = {enable = true,}})
end
}
use { -- nvim-dap-ui: a UI for nvim-dap
'rcarriga/nvim-dap-ui',
requires = { 'mfussenegger/nvim-dap' },
config = function()
require('blake.dap').dap_ui()
end,
}
use { -- debugprint: automatic debug print statement creator - bind g?{p/P,v/V,o/O}
'andrewferrier/debugprint.nvim',
requires = { 'nvim-treesitter/nvim-treesitter' },
config = function()
require('debugprint').setup()
end
}
---- Other IDE features
use { -- telescope: fuzzy finder for finding fuzzy things
'nvim-telescope/telescope.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require('blake.other').telescope()
end
}
use { -- trouble: one big list of code errors from all sources (lsp, quickfix)
'folke/trouble.nvim',
requires = "kyazdani42/nvim-web-devicons",
config = function()
require('trouble').setup({ mode = "quickfix" })
end
}
use { -- bqf: improved quickfix list
'kevinhwang91/nvim-bqf',
ft = 'qf',
}
use { -- pqf: prettier quickfix list
'https://gitlab.com/yorickpeterse/nvim-pqf',
ft = 'qf',
}
use { -- gitsigns: git integration
'lewis6991/gitsigns.nvim',
requires = { 'nvim-lua/plenary.nvim' },
config = function()
require('blake.other').gitsigns()
end,
}
use { -- toggleterm: terminal
'akinsho/toggleterm.nvim',
branch = 'main',
config = function()
require('blake.other').toggleterm()
end
}
use { -- neoscroll: Smooth Scrolling
'karb94/neoscroll.nvim',
disable = true,
config = function()
require('blake.other').neoscroll()
end,
}
use { -- auto-session: automatic session management
'rmagatti/auto-session',
config = function()
require('blake.other').autosession()
end
}
use { -- glow: Markdown preview
'ellisonleao/glow.nvim',
ft = { 'md', 'markdown', }
}
use { -- zen mode: (ZenMode or ZM)
"folke/zen-mode.nvim",
config = function()
require('blake.other').zenmode()
vim.cmd 'nnoremap <F10> <cmd>ZenMode<CR>'
vim.cmd 'inoremap <F10> <cmd>ZenMode<CR>'
end,
}
-- use { -- twilight.nvim: dim text outside paragraph or function
-- 'folke/twilight.nvim',
-- config = function()
-- vim.cmd 'cab TW Twilight'
-- require("twilight").setup()
-- end,
-- }
use { -- matchup: Use the percent (%) key for more things
'andymass/vim-matchup',
}
use { -- indentline: Line indent indicators
'lukas-reineke/indent-blankline.nvim',
config = function()
require('blake.other').indent_blankline()
end
}
use { -- targets.vim: fix ci' and other things to work better
'wellle/targets.vim',
}
use { -- nvim-tree: File explorer
'kyazdani42/nvim-tree.lua',
requires = { 'kyazdani42/nvim-web-devicons' },
tag = 'nightly',
config = function()
require("nvim-tree").setup({
diagnostics = { enable = true, },
})
end
}
use { -- neogen: annotation generator for neovim
'danymat/neogen',
requires = "nvim-treesitter/nvim-treesitter",
config = function()
require('neogen').setup({
snippet_engine = "luasnip",
})
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<Leader>af", ":lua require('neogen').generate('func')<CR>", opts)
end
}
use { -- hop.nvim: Jump around files quickly
'phaazon/hop.nvim',
config = function()
require('hop').setup { keys = 'etovxqpdygfblzhckisuran' }
end
}
---- Language-specific packages
use { -- rust-tools: make nvim a better rust environment
'simrat39/rust-tools.nvim',
requires = {
'mattn/webapi-vim', -- allow :RustPlay
},
config = function ()
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "K", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
})
end
}
use { -- quarto-nvim: tools for writing with quarto
'quarto-dev/quarto-nvim',
requires = {
'jmbuhr/otter.nvim', -- execute code in a terminal
},
config = function ()
require'quarto'.setup({
debug = false,
closePreviewOnExit = true,
lspFeatures = {
enabled = true,
languages = { 'bash' },
chunks = 'curly', -- 'curly' or 'all'
diagnostics = {
enabled = true,
triggers = { "BufWritePost" }
},
completion = {
enabled = true,
},
},
keymap = {
hover = 'K',
definition = 'gd',
},
})
end
}
use { -- faust-nvim: faust integration
'madskjeldgaard/faust-nvim',
config = function()
require 'faust-nvim'
require 'faust-nvim'.load_snippets()
end,
requires = {
'vijaymarupudi/nvim-fzf',
'L3MON4D3/LuaSnip'
}--,
-- run = require'faust-nvim'.post_install, -- Generate documentation etc (currently doesn't work it seems)
}
-- Conveniences
use { -- sort motion: (gs)
'christoomey/vim-sort-motion',
requires = 'navicore/vissort.vim', -- config requires
config = function()
vim.cmd [[
"let g:sort_motion_flags = 'i'
let g:sort_motion_visual_block_command = 'Vissort'
]]
end,
}
use { -- vissort: "Visual Sort" - sort based on selected characters
'navicore/vissort.vim',
cmd = 'Vissort',
}
use { -- AdvancedSorters: More ways to sort text - :Sort....
'inkarkat/vim-AdvancedSorters'
}
use { -- ghost: Web browser integration
'raghur/vim-ghost',
opt = true,
cmd = {'GhostStart', 'GhostInstall', 'GhostStop', 'GhostSync', 'GhostToggleSync',},
}
use { -- undotree: visual undo tree
'mbbill/undotree',
config = function()
vim.api.nvim_set_keymap('n', '<Leader>u', '<cmd>UndotreeToggle<CR>', { noremap = true, silent = true, })
end
}
use { -- macroeditor: edit macros in another window to avoid making LSP mad
'dohsimpson/vim-macroeditor',
config = function()
vim.cmd 'cab ME MacroEdit'
end
}
-- use { -- shade.nvim: dim inactive window
-- 'sunjon/shade.nvim',
-- config = function()
-- require'shade'.setup({
-- overlay_opacity = 50,
-- opacity_step = 1,
-- keys = {
-- brightness_up = '<C-Up>',
-- brightness_down = '<C-Down>',
-- toggle = '<Leader>s',
-- }
-- })
-- end
-- }
use { -- nvim-autopairs: automatic quote pairing
'windwp/nvim-autopairs',
config = function()
-- If you want insert `(` after select function or method item
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
require('nvim-autopairs').setup({
check_ts = true,
map_c_h = true,
map_c_w = true,
})
end,
requires = { 'hrsh7th/nvim-cmp' }, -- config requires
}
use { -- ts-autotag: automatically close html tags
'windwp/nvim-ts-autotag',
config = function()
require('nvim-ts-autotag').setup()
end
}
use { -- endwise: auto add 'end' keyword when typing loops in various languages
'RRethy/nvim-treesitter-endwise',
config = function()
require('nvim-treesitter.configs').setup {
endwise = {
enable = true,
},
}
end
}
use { -- nvim-align: Align text
'RRethy/nvim-align',
}
use { -- comment.nvim: toggle comments - gb and gc
'numToStr/Comment.nvim',
config = function()
require('Comment').setup {
mappings = {
extra = true,
}
}
end
}
use { -- ts-context-commentstring: set commentstring based on context from treesitter (two langs in one file)
'JoosepAlviste/nvim-ts-context-commentstring',
requires = { 'nvim-treesitter/nvim-treesitter', },
}
use { -- vim-rooter: cd to the root of a project when opening a file or folder
'notjedi/nvim-rooter.lua',
}
use { -- splitjoin: switch between single line and multiline versions of code - gJ and gS
'AndrewRadev/splitjoin.vim',
}
use { -- which-key: remind me what that one keybind does again?
'folke/which-key.nvim',
config = function()
require("which-key").setup()
end,
}
use { -- marks.nvim: Show marks in sign column
'chentoast/marks.nvim',
config = function()
require('marks').setup()
end
}
use { -- oscyank: copy text to system clipboard over ssh
'ojroques/vim-oscyank',
config = function()
-- Yanking to "+ will yank to system board
vim.cmd [[ autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '+' | execute 'OSCYankRegister +' | endif ]]
end
}
use { -- fixcursorhold: fix neovim bug #12587 - https://github.com/neovim/neovim/issues/12587
'antoinemadec/FixCursorHold.nvim',
}
use { -- rhysd: clever-split: split calculation based on pane dimensions - CS or CleverSplit
'rhysd/clever-split.vim',
config = function()
vim.cmd [[
cab CH CleverHelp
cab CS CleverSplit
]]
end
}
-- use { -- rhysd: accelerated jk: make j and k move faster by pressing them a lot movement
-- 'rhysd/accelerated-jk',
-- }
use { -- rhysd: committia: better commit editing window
'rhysd/committia.vim',
}
use { -- rhysd: conflict-marker: mark git conflicts - [x, ]x, co, ct, cb, cB, cn
'rhysd/conflict-marker.vim',
}
use { -- lewis6991: spaceless: Strip trailing whitespace as you are editing
'lewis6991/spaceless.nvim',
config = function()
require'spaceless'.setup()
end,
}
use { -- lewis6991: foldsigns: signcolumn signs on folded lines
'lewis6991/foldsigns.nvim',
config = function()
require('foldsigns').setup()
end,
}
use { -- lewis6991: cleanfold: folds have never looked better
'lewis6991/cleanfold.nvim',
config = function()
require('cleanfold').setup()
end,
}
-- use { -- lewis6991: sattelite: small scroll bar
-- 'lewis6991/satellite.nvim',
-- config = function()
-- require('satellite').setup()
-- vim.cmd [[
-- nnoremap <C-l> <cmd>nohlsearch\|diffupdate\|SatelliteRefresh<CR>
-- inoremap <C-l> <cmd>nohlsearch\|diffupdate\|SatelliteRefresh<CR>
-- ]]
-- end,
-- }
use { -- tpope: surround: surround text with quotes, parens, tags, and more - ys
'tpope/vim-surround',
}
use { -- tpope: fugitive: git integration
'tpope/vim-fugitive',
cmd = 'G',
}
use { -- tpope: repeat: Repeatability for various tpope plugins
'tpope/vim-repeat',
}
use { -- tpope: sleuth: automatically get info about files and apply it to vim (tabs vs spaces, etc)
'tpope/vim-sleuth',
}
use { -- tpope: eunuch: some unix shell commands in vim
'tpope/vim-eunuch',
cmd = { 'Remove', 'Unlink', 'Delete', 'Copy', 'Duplicate', 'Move', 'Rename', 'Chmod', 'Mkdir', 'Mkdir', 'Cfind', 'Lfind', 'Clocate', 'Llocate', 'SudoEdit', 'SudoWrite', },
}
-- Bootstrap packer if needed {
if (Packer_bootstrap) then
print('Please wait for packer to install plugins')
require('packer').sync()
end
-- }
end,
config = {
-- Make packer a floating window with single border
display = {
open_fn = function()
return require('packer.util').float({ border = 'single' })
end
},
-- Move to lua dir so impatient.nvim can cache it
compile_path = vim.fn.stdpath('config')..'/lua/packer_compiled.lua',
-- Don't ask before removing plugins
autoremove = true,
-- Limit max jobs to avoid getting killed on low-end hardware
max_jobs = Packer_max_jobs,
profile = {
enable = true,
},
}})
-- how to align all plugin descriptions: select all plugins in visual line, :'<,'>Align \(.\+use { -- .\+: \+\)\@<=[^ ][^:]\+$
-- vim:fdm=marker:fmr={,}:fdl=1:expandtab:tabstop=3:sw=3

View file

@ -1,178 +0,0 @@
local set = vim.o
local autocmd = vim.api.nvim_create_autocmd
-- Settings
local tabsize = 3
set.tabstop = tabsize
set.softtabstop = tabsize
set.shiftwidth = tabsize
set.suffixes = '.bak,~,.o,.h,.info,.swp,.obj,.aux,.bbl,.blg,.brf,.cb,.dvi,.idx,.ilg,.ind,.inx,.jpg,.log,.out,.png,.toc'
set.expandtab = true
set.smartindent = true
set.undofile = true
set.swapfile = true
set.hlsearch = true
set.hidden = true
set.backspace = 'indent,eol,start'
set.ignorecase = true
set.smartcase = true
set.showmode = false
set.wrap = false
set.linebreak = true
set.redrawtime = 200
set.updatetime = 300
set.number = true
set.relativenumber = true
set.errorbells = false
set.encoding = 'UTF-8'
set.cursorline = true
set.mouse = 'a'
set.incsearch = true
set.scrolloff = 5
set.hidden = true
set.shortmess = 'filnxtToOFc' -- the funny thing is, this *is* a short mess
set.spell = true
set.spelllang = 'en_us'
set.showcmd = true
set.signcolumn = 'yes'
set.makeprg = 'make -j$(nproc)'
set.ruler = false
set.listchars = 'trail:~,tab:│ ,nbsp:␣,lead:·,extends:…,precedes:…'
set.list = false
set.mousemodel = 'extend'
set.exrc = true
set.secure = true
-- Disable smartindent when editing `nix` files
autocmd("BufEnter", { pattern = "*.nix", callback = function() vim.opt_local.smartindent = false end })
-- Syntax highlighting for faust files
autocmd("BufEnter", { pattern = "*.dsp", callback = function() vim.opt_local.filetype = 'c' end })
autocmd("BufEnter", { pattern = "*.lib", callback = function() vim.opt_local.filetype = 'c' end })
----------------------------------------------
--- Key bindings (needs to be translated?) ---
----------------------------------------------
vim.g.mapleader = " "
-- *sigh*...
vim.cmd [[
cab Q q
cab W w
cab Wq wq
cab WQ wq
cab Wa wa
cab WA wa
cab Qa qa
cab QA qa
cab Wqa wqa
cab WQa wqa
cab WQA wqa
]]
-- Go to previous file, but faster
vim.cmd 'cab P previous'
-- Macro for opening a terminal in a new tab
vim.cmd 'command! Term tabnew | term'
-- Genereate ctags
vim.cmd 'cab MakeTags !ctags -R .'
-- Toggle spell check with alt S
vim.cmd 'nnoremap <M-S> <cmd>set spell! spell?<CR>'
-- Toggle wrap with alt W
vim.cmd 'nnoremap <M-W> <cmd>set wrap! wrap?<CR>'
-- find + replace with alt S
vim.cmd 'nnoremap <M-s> :%s//g<Left><Left>'
-- find + replace a word with alt S
vim.cmd 'nnoremap <M-w> ye:%s//g<Left><Left><C-r>"/'
-- open current file with nvim in alacritty (useful if it gets opened in some other terminal)
vim.cmd "nnoremap <M-a> <cmd>!nohup alacritty -e nvim '%' > /dev/null 2>&1 &; disown<CR><cmd>q<CR>"
-- Escape to enter normal mode in the terminal
vim.cmd 'tnoremap <C-\\> <C-\\><C-n>'
vim.cmd 'nnoremap <silent> <Leader>= :exe "resize " . (winheight(0) * 3/2)<CR>'
vim.cmd 'nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>'
vim.cmd 'nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>'
-- Switch panes with ctrl hjkl
vim.cmd 'nnoremap <C-h> <C-w>h'
vim.cmd 'nnoremap <C-j> <C-w>j'
vim.cmd 'nnoremap <C-k> <C-w>k'
-- Spell correct with Q, rather than z=
vim.cmd 'nnoremap Q z='
-- Scroll full pages without moving the cursor (like it should!)
vim.cmd 'nnoremap  <C-u><C-u>'
vim.cmd 'nnoremap  <C-d><C-d>'
----------------------------------------------
--- Things that can't be translated to lua ---
----------------------------------------------
vim.cmd 'let g:markdown_fenced_languages = [ "bash=sh", "javascript", "cpp=cpp", "c++=cpp", "js=javascript", "json=javascript", "typescript", "ts=typescript", "php", "html", "css", "yml=yaml", "yaml" ]'
--- autocmd's ---
-- Set comment strings
vim.cmd 'autocmd FileType crontab setlocal commentstring=#%s'
-- vim.cmd 'autocmd FileType rmd set commentstring=<!--\\ %s\\ -->'
-- Enable linewrap in markdown files
vim.cmd [[ autocmd FileType markdown setlocal wrap ]]
-- Automatically jump to the last position in a file when opening
vim.cmd [[ au BufReadPost * if expand('%:p') !~# '\m/\.git/' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif ]]
-- Spell check in git commits by default
vim.cmd 'autocmd Filetype gitcommit setlocal spell'
-- Disable spell check in help files
vim.cmd 'autocmd FileType help setlocal nospell'
vim.cmd 'filetype plugin on'
-- .dsp and .lib files are faust
vim.cmd 'autocmd BufReadPost *.dsp setlocal ft=faust'
vim.cmd 'autocmd BufReadPost *.lib setlocal ft=faust'
-- Automatically disable line numbers when in terminal mode
vim.cmd 'autocmd TermOpen * setlocal nospell nonumber norelativenumber'
-- Automatically toggle relative line numbers
-- vim.cmd 'autocmd InsertEnter * :set norelativenumber '
-- vim.cmd 'autocmd InsertLeave * :set relativenumber '
-- Make vim a hex editor
-- Edit *.bin files as binaries rather than text files
-- (if your file isn't a .bin, do this: `ln -s $file $file.bin; vim $file`)
vim.cmd [[
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif
augroup END
]]
-- 'Visual At' plugin (https://github.com/stoeffel/.dotfiles/blob/master/vim/visual-at.vim)
-- Basically, record a macro that effects one line, select some lines, then run
-- it, and the macro will be executed on all visual selected lines individually
vim.cmd [[
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
]]
-- vim: nospell

View file

@ -1 +0,0 @@
../lua/packer_compiled.lua

View file

@ -23,11 +23,33 @@ fi
# Avoiding copy pasting this over and over # Avoiding copy pasting this over and over
g() { git -C "$REPO" "$@"; } g() { git -C "$REPO" "$@"; }
REPOS_TO_UPDATE="${REPOS_TO_UPDATE:-}"
# path_append from https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
# checks if a path is already in the PATH and if it exists
path_append() {
if [ -d "$1" ]; then
# shellcheck disable=SC3010
if command '[[' > /dev/null 2>&1 && [[ ":$REPOS_TO_UPDATE:" != *":$1:"* ]]; then
REPOS_TO_UPDATE="${REPOS_TO_UPDATE:+"$REPOS_TO_UPDATE:"}$1"
else
REPOS_TO_UPDATE="$REPOS_TO_UPDATE:$1"
fi
fi
}
# shellcheck disable=SC2016 # shellcheck disable=SC2016
REPO_ABBR='echo ${REPO/"$HOME"/"~"}' REPO_ABBR='echo ${REPO/"$HOME"/"~"}'
path_append "${DOCS_DIR:-}"
path_append "$HOME/bin"
path_append "${NIXOS_DIR:-}"
path_append "$HOME/code/faust-ideas"
path_append "$HOME/code/nixvim-config"
path_append "$HOME/.config/nvim"
# `git pull` everything mentioned in the REPOS_TO_UPDATE variable # `git pull` everything mentioned in the REPOS_TO_UPDATE variable
IFS=: read -ra REPOS_TO_UPDATE_ARR <<< "${REPOS_TO_UPDATE:-}:${DOCS_DIR:-}:$HOME/bin:${NIXOS_DIR:-}:$HOME/code/faust-ideas:$HOME/code/nixvim-config" IFS=: read -ra REPOS_TO_UPDATE_ARR <<< "${REPOS_TO_UPDATE:-}"
for REPO in "${REPOS_TO_UPDATE_ARR[@]}"; do for REPO in "${REPOS_TO_UPDATE_ARR[@]}"; do
if [ -n "$REPO" ]; then if [ -n "$REPO" ]; then
if g rev-parse > /dev/null 2>&1; then if g rev-parse > /dev/null 2>&1; then

2
.zshrc
View file

@ -62,7 +62,7 @@ ${SKIP_PLUGINS:-false} || {
# Quality of life # Quality of life
zinit load "zsh-users/zsh-autosuggestions" zinit load "zsh-users/zsh-autosuggestions"
zinit load "zdharma-continuum/fast-syntax-highlighting" zinit load "zdharma-continuum/fast-syntax-highlighting"
zinit load "jeffreytse/zsh-vi-mode" zinit load "softmoth/zsh-vim-mode"
zinit load "zsh-users/zsh-history-substring-search" zinit load "zsh-users/zsh-history-substring-search"
zinit load "zsh-users/zsh-completions" zinit load "zsh-users/zsh-completions"
zinit load "Tarrasch/zsh-bd" zinit load "Tarrasch/zsh-bd"