diff options
29 files changed, 845 insertions, 1326 deletions
diff --git a/after/syntax/proto.vim b/after/syntax/proto.vim deleted file mode 100644 index d0cdae2..0000000 --- a/after/syntax/proto.vim +++ /dev/null @@ -1,89 +0,0 @@ -" syn clear pbType -" syn clear pbRepeat -" syn clear pbMessage -" syn clear pbTypedef - -syn keyword pbEnumTypedef enum nextgroup=pbEnumTypeName skipwhite skipempty - -syn keyword pbRepeat required optional repeated nextgroup=protoFieldType skipempty skipwhite - -syn cluster top contains= - \pbRepeat, - \protoComment, - \protoInt, - \protoFloat, - \protoString, - \pbEnumTypedef, - \pbMessage2 - \protoSyntax, - \protoStructure, - \protoRepeat, - \protoDefault, - \protoExtend, - \protoRPC, - \pbAnnotation, - \pbOneofKeyword, - \pbOptionKeyword, - \pbMessageKeyword - -syn cluster oneofContains contains=protoFieldType,pbOptionKeyword,protoComment,pbAnnotation - -syn keyword pbOneofKeyword oneof nextgroup=pbOneofName skipwhite -syn match pbOneofName +\<\w\+\>+ nextgroup=pbOneofBody contained skipwhite -syn region pbOneofBody start=+{+ end=+}+ contains=@oneofContains contained - -syn match protoFieldType "\<\([A-Za-z0-9_]\+\|\_s*\.\_s*[A-Za-z0-9_]\+\)\+\>" nextgroup=protoFieldName skipempty skipwhite -syn match protoFieldName "\<\w\+\>" nextgroup=protoFieldEquals contained skipwhite -syn match protoFieldEquals +=+ contained nextgroup=protoFieldNumber,protoFieldNumberBad contained skipwhite -syn match protoFieldNumber +[1-9][0-9]*+ contained -syn match protoFieldNumberBad +0[0-9]*+ contained - -hi! link protoFieldNumber Number -hi! link protoFieldEquals Operator -hi! link protoFieldNumberBad Error - -syn match pbEnumTypeName "\<\w\+\>" nextgroup=enumBody skipempty skipwhite contained -syn region enumBody start=+{+ end=+}+ contains=enumValue,protoComment,protoInt,pbAnnotation fold contained -syn match enumValue "\zs\w\+\ze\s*=" contained - -syn keyword pbExtendKeyword extend nextgroup=pbMessageQualifiedName skipwhite -syn match pbMessageQualifiedName "\<[a-zA-Z0-9_.]\+\>" nextgroup=pbMessageBody skipempty skipwhite - -hi! link pbExtendKeyword protoExtend -hi! link pbMessageQualifiedName pbMessage2 - -syn keyword pbMessageKeyword message nextgroup=pbMessage2 skipwhite -syn match pbMessage2 "\<\w\+\>" nextgroup=pbMessageBody skipempty skipwhite -syn region pbMessageBody start=+{+ end=+}+ contains=@top,pbExtendKeyword fold contained - - -syn region protoAnnotString start=/"/ skip=/\\./ end=/"/ contained -syn region protoAnnotString start=/'/ skip=/\\./ end=/'/ contained -syn region pbAnnotation start=+\[+ end=+\]+ contains=protoAnnotString,pbAnnotationType,protoComment fold - -syn keyword pbOptionKeyword option nextgroup=pbAnnotationType skipwhite -syn match pbAnnotationType +([a-z._]\+)+ nextgroup=annotationEquals contained skipwhite -syn match annotationEquals +=+ nextgroup=annotationValue contained skipwhite -syn match annotationValue +\w\++ contained - -hi link annotationEquals Operator -hi link annotationValue Constant -hi link pbAnnotationType Identifier - -hi link protoAnnotString String -hi link protoFieldType Type -hi link pbEnumTypeName Type -hi link pbMessage2 Type - -hi link protoFieldName Identifier -hi link enumValue Constant - -hi link pbAnnotation PreProc -hi! link pbOneofKeyword protoStructure -hi! link pbOneofName Identifier - -hi! link pbEnumTypedef StorageClass -hi! link pbRepeat StorageClass - -hi! link pbOptionKeyword protoSyntax -hi! link pbMessageKeyword protoStructure diff --git a/ftplugin/java.vim b/ftplugin/java.vim deleted file mode 100644 index 8bf603c..0000000 --- a/ftplugin/java.vim +++ /dev/null @@ -1,29 +0,0 @@ -setl textwidth=100 - -inoreabbrev public public -inoreabbrev upblic public -inoreabbrev pbulic public -inoreabbrev pbulci public -inoreabbrev pulbic public -inoreabbrev pubilc public -inoreabbrev publci public - -inoreabbrev rpivate private -inoreabbrev pirvate private -inoreabbrev prviate private -inoreabbrev priavte private -inoreabbrev privtae private -inoreabbrev privaet private -inoreabbrev pirvaet private -inoreabbrev priavet private -inoreabbrev piravet private - -inoreabbrev tsatic static -inoreabbrev sattic static -inoreabbrev sttaic static -inoreabbrev staitc static -inoreabbrev statci static - -inoreabbrev ovid void -inoreabbrev viod void -inoreabbrev vodi void diff --git a/hadron.vim b/hadron.vim deleted file mode 100644 index 12c4d22..0000000 --- a/hadron.vim +++ /dev/null @@ -1 +0,0 @@ -colorscheme habamax diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..5551623 --- /dev/null +++ b/init.lua @@ -0,0 +1,21 @@ +local config_dir = vim.fn.stdpath('config') .. '/lua/config' + +local files = vim.list_extend( + vim.fn.globpath(config_dir, '*.lua', false, true), + vim.fn.globpath(config_dir .. '/local', '*.lua', false, true) +) + +table.sort(files, function(a, b) + local name_a = vim.fn.fnamemodify(a, ':t') + local name_b = vim.fn.fnamemodify(b, ':t') + + if name_a == name_b then + return a < b + end + + return name_a < name_b +end) + +for _, file in ipairs(files) do + dofile(file) +end diff --git a/init.vim b/init.vim deleted file mode 100644 index f6c3acf..0000000 --- a/init.vim +++ /dev/null @@ -1,572 +0,0 @@ -let g:loaded_netrw = 1 -let g:loaded_netrwPlugin = 1 - -if filereadable('/etc/hostname') - let hostname=join(readfile('/etc/hostname')) -else - let hostname='unknown' -endif - -let g:vsnip_snippet_dir = "~/.config/nvim/snippets" -let g:vsnip_snippet_dirs = ["~/.config/nvim/local/snippets"] - -call plug#begin() - -if filereadable(printf('%s/.config/nvim/local-plug.vim', $HOME)) - exec "source " . printf('%s/.config/nvim/local-plug.vim', $HOME) -endif - -Plug 'nvim-lua/lsp-status.nvim' -Plug 'bfrg/vim-jq' -Plug 'folke/trouble.nvim' -Plug 'git@git.josher.dev:bulletjava.vim.git' -Plug 'git@git.josher.dev:fieldmarshal.vim.git' -Plug 'git@git.josher.dev:nvim-color-picker.git' -Plug 'git@git.josher.dev:nvim-warp.git' -Plug 'git@git.josher.dev:meltdown.git' -Plug 'google/vim-codefmt' -Plug 'google/vim-glaive' -Plug 'google/vim-maktaba' -Plug 'hrsh7th/cmp-buffer' -Plug 'hrsh7th/cmp-nvim-lsp' -Plug 'hrsh7th/cmp-nvim-lua' -Plug 'hrsh7th/cmp-path' -Plug 'hrsh7th/cmp-vsnip' -Plug 'hrsh7th/nvim-cmp' -Plug 'hrsh7th/vim-vsnip' -Plug 'kyazdani42/nvim-web-devicons' -" Plug 'lukas-reineke/virt-column.nvim' -Plug 'nanozuki/tabby.nvim' -Plug 'neovim/nvim-lspconfig' -Plug 'nvim-lua/plenary.nvim' -Plug 'nvim-lualine/lualine.nvim' -Plug 'nvim-telescope/telescope.nvim' -Plug 'nvim-tree/nvim-tree.lua' -Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} -Plug 'nvim-treesitter/nvim-treesitter-textobjects' -Plug 'onsails/lspkind.nvim' -" Plug 'tpope/vim-surround' -Plug 'kylechui/nvim-surround' -Plug 'vito-c/jq.vim' -Plug 'EdenEast/nightfox.nvim' -" Plug 'sphamba/smear-cursor.nvim' -Plug 'smoka7/hop.nvim' - -Plug 'lewis6991/gitsigns.nvim' - -if exists('&userregfunc') - Plug 'git@git.josher.dev:rneovim-userregs.git' -endif -Plug 'git@git.josher.dev:config.vim.git', - \ { 'dir': g:plug_home . '/config.vim', - \ 'do': ':UpdateInitVimHook' } -call plug#end() -command! UpdateInitVimHook source ~/.config/nvim/init.vim <bar> PlugInstall - -set termguicolors -set shiftwidth=2 -set tabstop=2 -set expandtab -set nowrap -set splitright -set splitbelow -set wildmode=longest,list,full -set scrolloff=8 -set number -set relativenumber -set pumheight=20 -set updatetime=1000 -set matchpairs+=<:> - -let mapleader=" " - -function! Jump(...) - normal! `[ -endfunction -noremap <silent> g. <cmd>set operatorfunc=Jump<cr>g@ - -" Make splitting more congruent with how Tmux does it. -noremap <C-w>% <C-w>v -noremap <C-w>" <C-w>s - -" Open a terminal in a split below the current file. - -noremap <C-w><C-t> <C-w>s<cmd>term<cr> -" Opens a terminal in the directory the current file is in. -noremap <C-w><C-S-t> <C-w>s<cmd>TERM<cr> - -" Fix the yank behavior. -noremap Y y$ - -" Format code. This is <AltGr-u> -vnoremap ú :FormatLines<cr> -noremap ú <cmd>lua run_format_code()<cr> - -" Synstack to help profile syntax highlighting issues. -noremap <leader>p <plug>(SynStack) - -" Way to find files. -noremap <leader>ff <cmd>Telescope find_files<cr> -noremap <M-f> <cmd>Telescope find_files<cr> -noremap <M-r> <cmd>Telescope find_files<cr> -function! s:find_in_dir() - exec "Telescope find_files search_dirs={\"" . escape(resolve(expand('%:h')), ' ') . "\"} path_display={\"shorten\"} hidden=true" -endfunction -noremap <M-F> <cmd>call <sid>find_in_dir()<cr> - -inoremap <C-+> <Plug>(vsnip-expand) - -" When navigating to the beginning of a line, I want to always reset the screen -" to the leftmost position. -noremap ^ ^zH - -noremap <leader>to <cmd>Telescope oldfiles<cr> -noremap <leader>ta <cmd>Telescope autocommands<cr> -noremap <leader>tbu <cmd>Telescope buffers<cr><cr> -noremap <leader>T <cmd>Telescope builtin<cr> -noremap <leader>tcs <cmd>Telescope colorscheme<cr> -noremap <leader>tch <cmd>Telescope command_history<cr> -noremap <leader>tco <cmd>Telescope commands<cr> -noremap <leader>t/ <cmd>Telescope current_buffer_fuzzy_find<cr> -noremap <leader>tcbt <cmd>Telescope current_buffer_tags<cr> -noremap <leader>td <cmd>Telescope diagnostics<cr> -noremap <leader>tf <cmd>Telescope find_files<cr> -noremap <leader>tgb <cmd>Telescope git_branches<cr> -noremap <leader>tgc <cmd>Telescope git_commits<cr> -noremap <leader>tgf <cmd>Telescope git_files<cr> -noremap <leader>tgs <cmd>Telescope git_stash<cr> -noremap <leader>tgr <cmd>Telescope grep_string<cr> -noremap <leader>thi <cmd>Telescope highlights<cr> -noremap <leader>tjl <cmd>Telescope jumplist<cr> -noremap <leader>tlg <cmd>Telescope live_grep<cr> -noremap <leader>tll <cmd>Telescope loclist<cr> -noremap <leader>t[d <cmd>Telescope lsp_definitions<cr> -noremap <leader>t[s <cmd>Telescope lsp_document_symbols<cr> -noremap <leader>t[w <cmd>Telescope lsp_dynamic_workspace_symbols<cr> -noremap <leader>t[i <cmd>Telescope lsp_implementations<cr> -noremap <leader>t[r <cmd>Telescope lsp_incoming_calls<cr> -noremap <leader>t[n <cmd>Telescope lsp_outgoing_calls<cr> -noremap <leader>t[e <cmd>Telescope lsp_references<cr> -noremap <leader>t[t <cmd>Telescope lsp_type_definitions<cr> -noremap <leader>t? <cmd>Telescope man_pages<cr> -noremap <leader>t' <cmd>Telescope marks<cr> -noremap <leader>tp <cmd>Telescope pickers<cr> -noremap <leader>tqf <cmd>Telescope quickfix<cr> -noremap <leader>tqh <cmd>Telescope quickfixhistory<cr> -noremap <leader>t" <cmd>Telescope registers<cr> -noremap <leader>th/ <cmd>Telescope search_history<cr> -noremap <leader>tz <cmd>Telescope spell_suggest<cr> -noremap <leader>ty <cmd>Telescope symbols<cr> -noremap <leader>tt <cmd>Telescope tags<cr> -noremap <leader>tst <cmd>Telescope tagstack<cr> -noremap <leader>tsit <cmd>Telescope treesitter<cr> -noremap <leader>tv <cmd>Telescope vim_options<cr> - -augroup InitVim - au! - " Automatically stop highligting things when leaving insert mode. If I want - " the highlight back, I can just hit 'n' and it will come back. - autocmd InsertLeave * set nohlsearch - autocmd CmdlineEnter /,\? set hlsearch - - autocmd TextYankPost * - \ lua require'vim.hl'.on_yank( - \ { higroup = "IncSearch", timeout = 100 }); - " autocmd CursorHold * lua vim.lsp.buf.document_highlight() - " autocmd CursorHoldI * lua vim.lsp.buf.document_highlight() - " autocmd CursorMoved * lua vim.lsp.buf.clear_references() - autocmd FocusGained,BufEnter * checktime -augroup END -nnoremap <silent> n <cmd>set hlsearch<CR>n -nnoremap <silent> N <cmd>set hlsearch<CR>N - -" Local configuration that can be set by hostname or just a local configuration. -" Local files are ignored by .gitignore so they won't be added to the repo, -" allowing local (*cough* work) configuration to be separate from general -" configuration. - -if isdirectory(printf('%s/.config/nvim/%s', $HOME, hostname)) - exec "set rtp+=" . printf('%s/.config/nvim/%s', $HOME, hostname) -endif - -if isdirectory(printf('%s/.config/nvim/local', $HOME)) - exec "set rtp+=" . printf('%s/.config/nvim/local', $HOME) -endif - -if filereadable(printf('%s/.config/nvim/%s.vim', $HOME, hostname)) - exec "source " . printf('%s/.config/nvim/%s.vim', $HOME, hostname) -endif - -if filereadable(printf('%s/.config/nvim/local.vim', $HOME)) - exec "source " . printf('%s/.config/nvim/local.vim', $HOME) -endif - -if isdirectory(printf('%s/.config/nvim/after', $HOME)) - exec "set rtp+=" . printf('%s/.config/nvim/after', $HOME) -endif - -noremap <leader>nt <cmd>NvimTreeToggle<cr> -noremap <C-n><C-e> :<C-u>e <C-r>=escape(expand('%:h'), ' \')<cr>/ -noremap <C-w>. <cmd>lua require('windownav').goto_terminal()<cr> -noremap <C-w>I <cmd>lua require('windownav').goto_initvim()<cr> -noremap <C-w>' <cmd>lua require('windownav').goto_lastwin()<cr> - -nnoremap <M-t> <cmd>term<cr><cmd>startinsert<cr> -nnoremap <M-S-T> <cmd>TERM<cr><cmd>startinsert<cr> - -nnoremap <C-Space> <C-^> -nnoremap <M-b> <cmd>Telescope buffers<cr> -nnoremap <M-l> <cmd>bnext<cr> -nnoremap <M-h> <cmd>bprev<cr> - -noremap <C-g> <cmd>lua vim.diagnostic.open_float()<cr> - -noremap <leader><C-f> <cmd>WarpFull<cr> - -noremap <C-f> <cmd>WarpGrid<cr> -onoremap <C-f> v<cmd>WarpGrid<cr> - -noremap <leader>w <cmd>WarpWords<cr> -onoremap <leader>w v<cmd>WarpWords<cr> - -" <C-/> - search within last visual selection. -noremap /<C-u>\%V -nmap œ <leader>k -nmap ï <leader>j -omap œ <leader>k -omap ï <leader>j -omap aœ a<leader>k -omap aï a<leader>j -omap iœ i<leader>k -omap iï i<leader>j -vmap œ <leader>k -vmap ï <leader>j - -noremap <M-ñ> <cmd>TSNodeUnderCursor<cr> -noremap <M-©> <cmd>TSCaptureUnderCursor<cr> - -" Greek capital tau (τ) -noremap Τ <cmd>Inspect<cr> - -command! Config edit $HOME/.config/nvim/init.vim -command! Configl edit $HOME/.config/nvim/local.vim - -cnoreabbrev <expr> _config expand("$HOME/.config/nvim") -cnoreabbrev <expr> _plugged expand("$HOME/.local/share/nvim/plugged") -cnoreabbrev <expr> _fm expand("$HOME/.local/share/nvim/plugged/fieldmarshal.vim") -cnoreabbrev <expr> _home expand("$HOME/.local/share/nvim") -cnoreabbrev <expr> _projects expand("$HOME/Projects") -cnoreabbrev <expr> _ escape(expand('%:h'), ' \') - -noremap g[r <cmd>Telescope lsp_references path_display={"shorten"}<cr> -noremap g[d <cmd>Telescope lsp_definitions path_display={"shorten"}<cr> -noremap g[i <cmd>Telescope lsp_implementations path_display={"shorten"}<cr> -noremap g[td <cmd>Telescope lsp_type_definitions path_display={"shorten"}<cr> -noremap g[ci <cmd>Telescope lsp_incoming_calls path_display={"shorten"}<cr> -noremap g[co <cmd>Telescope lsp_outgoing_calls path_display={"shorten"}<cr> -noremap g[sd <cmd>Telescope lsp_document_symbols path_display={"shorten"}<cr> -noremap g[sw <cmd>Telescope lsp_workspace_symbols path_display={"shorten"}<cr> -noremap g[sdw <cmd>Telescope lsp_dynamic_workspace_symbols path_display={"shorten"}<cr> -noremap [e <cmd>lua vim.diagnostic.jump({count=-1, severity=vim.diagnostic.severity.ERROR})<cr> -noremap ]e <cmd>lua vim.diagnostic.jump({count=1, severity=vim.diagnostic.severity.ERROR})<cr> - -set textwidth=80 -set colorcolumn=+1 -set title - -if has('rneovim') - " call HighlightColorColumns() - " " Grey color column right after text width is grey and in the background and - " " a red one after the text width which is red and in the foreground. - " set colorcolumn=+1/│/MyColorColumn/b,+20/│/MyRedColorColumn/f -endif - -" Opens a terminal in the directory of the current file. -command! TERM lua open_terminal_on_directory(vim.fn.expand('%:p:h')) - -" W = w. I often click when typing :w -command! W w - -let g:loaded_netrw = 1 -let g:loaded_netrwPlugin = 1 - -augroup UseTerminal - au! - au BufNewFile * lua open_terminal_on_directory() - au BufEnter * lua open_terminal_on_directory() -augroup END - - -let g:jq_highlight_objects = 1 -let g:jq_highlight_function_calls = 1 - -" Increment the character under the cursor to the next character in order. -function! OrdNext() - let char = matchstr(getline('.'), '\%' . col('.') . 'c.') - let nr = char2nr(char) - let new_char = nr2char(nr + 1) - exec "norm r" . new_char -endfunction - -" Decrement the character under the cursor to the last character in order. -function! OrdPrev() - let char = matchstr(getline('.'), '\%' . col('.') . 'c.') - let nr = char2nr(char) - let new_char = nr2char(nr - 1) - exec "norm r" . new_char -endfunction - -noremap α <cmd>call OrdNext()<cr> -" Capital alpha (α) -noremap Α <cmd>call OrdPrev()<cr> - -noremap € vib<esc>a)<esc> - -noremap <X2Mouse> <C-I> -noremap <2-X2Mouse> <C-I> -noremap <3-X2Mouse> <C-I> - -noremap <X1Mouse> <C-O> -noremap <2-X1Mouse> <C-O> -noremap <3-X1Mouse> <C-O> - -noremap <M-S-ScrollWheelRight> <C-LeftMouse> - -noremap <M-]> <cmd>Telescope tags<cr> - -menu 0.400 PopUp.Find\ References <Cmd>norm g[r<CR> -menu 0.400 PopUp.Find\ Implementers <Cmd>norm g[i<CR> -menu PopUp.Split :split<cr> -menu PopUp.VSplit :vsplit<cr> -menu PopUp.Close :q<cr> - -noremap gh <cmd>HopCamelCase<cr> - -lua << EOF - function open_terminal_on_directory(dirname) - if not dirname then - local buf = vim.api.nvim_get_current_buf() - dirname = vim.api.nvim_buf_get_name(buf) - end - - if vim.fn.isdirectory(dirname) ~= 1 then - return - end - - local tcmd = string.format("cd %s && exec $SHELL", vim.fn.shellescape(dirname)) - local cmd = string.format("term sh -c %s", vim.fn.shellescape(tcmd)) - - - vim.cmd(cmd) - vim.cmd("startinsert") - vim.cmd("silent! keepalt file TERM " .. dirname) - end - - require'nvim-treesitter.configs'.setup { - textobjects = { - select = { - enable = true, - - -- Automatically jump forward to textobj, similar to targets.vim - lookahead = true, - - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ["am"] = "@function.outer", - ["im"] = "@function.inner", - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["aC"] = "@class.outer", - ["aa"] = "@parameter.outer", - ["ia"] = "@parameter.inner", - ["iq"] = "@block.inner", - ["aq"] = "@block.outer", - ["a;"] = "@statement.outer", - ["i;"] = "@statement.inner", - -- You can optionally set descriptions to the mappings (used in the desc parameter of - -- nvim_buf_set_keymap) which plugins like which-key display - ["iC"] = { query = "@class.inner", desc = "Select inner part of a class region" }, - }, - -- You can choose the select mode (default is charwise 'v') - -- - -- Can also be a function which gets passed a table with the keys - -- * query_string: eg '@function.inner' - -- * method: eg 'v' or 'o' - -- and should return the mode ('v', 'V', or '<c-v>') or a table - -- mapping query_strings to modes. - selection_modes = { - ['@parameter.outer'] = 'v', -- charwise - ['@function.outer'] = 'V', -- linewise - ['@function.inner'] = 'V', -- linewise - ['@block.inner'] = 'V', -- linewise - ['@block.outer'] = 'V', -- linewise - }, - -- If you set this to `true` (default is `false`) then any textobject is - -- extended to include preceding or succeeding whitespace. Succeeding - -- whitespace has priority in order to act similarly to eg the built-in - -- `ap`. - -- - -- Can also be a function which gets passed a table with the keys - -- * query_string: eg '@function.inner' - -- * selection_mode: eg 'v' - -- and should return true of false - include_surrounding_whitespace = function (q) - return string.match(q.query_string, '.inner$') == nil and - string.match(q.query_string, '^function') - end, - }, - move = { - enable = true, - set_jumps = true, - goto_next_start = { - ["]C"] = "@injectable_constructor.params.inner", - ["]c"] = "@class.outer", - }, - goto_previous_start = { - ["[C"] = "@injectable_constructor.params.inner", - ["[c"] = "@class.outer", - }, - }, - }, - } - - require('nvim-treesitter.configs').setup({ - highlight = { - enable = true, -- Enables highlighting for all supported filetypes - additional_vim_regex_highlighting = false, -- Disable regex-based highlighting for speed - }, - }) - - function remove_package(str) - for k, v in pairs(package.loaded) do - if string.match(k, "^" .. str) then - package.loaded[k] = nil - end - end - end - - function reload_package(str) - remove_package(str) - return require(str) - end - - -- CiderLSP - vim.opt.completeopt = { "menu", "menuone", "noselect" } - require("lsp") - require("lspconfig") - require("tabby") - - -- Diagnostics - require("diagnostics") - require("nvim-tree").setup({ - hijack_directories = {auto_open = false} - }) - - require("lualinesetup") - - require('telescope').setup({ - defaults = { - title = "", - borderchars = { " ", " ", " ", " ", " ", " ", " ", " " }, - prompt_prefix = '🞂 ', - selection_caret = '🞂 ', - layout_strategy = "horizontal", - results_title = false, - sorting_strategy = "ascending", - pickers = { - find_files = { - hidden = true - } - }, - -- path_display = "shorten", - layout_config = { - horizontal = { - width = 0.66, - height = 0.66, - }, - -- other layout configuration here - }, - -- other defaults configuration here - }, - -- other configuration values here - }) - - -- require("virt-column").setup({ - -- char = '│', - -- highlight = "ColorColumnLine" - -- }) - - function run_format_code() - local lsps = vim.lsp.buf_get_clients() - if lsps then - vim.lsp.buf.format() - else - vim.cmd("FormatCode") - end - end - - local gitsigns = require("gitsigns") - gitsigns.setup({ - on_attach = function(bufnr) - vim.keymap.set({'o', 'x'}, 'ih', '<Cmd>Gitsigns select_hunk<CR>') - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']h', function() - if vim.wo.diff then - vim.cmd.normal({']c', bang = true}) - else - gitsigns.nav_hunk('next') - end - end) - - map('n', '[h', function() - if vim.wo.diff then - vim.cmd.normal({'[c', bang = true}) - else - gitsigns.nav_hunk('prev') - end - end) - - -- Actions - map('n', '<leader>hs', gitsigns.stage_hunk) - map('n', '<leader>hr', gitsigns.reset_hunk) - - map('v', '<leader>hs', function() - gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end) - - map('v', '<leader>hr', function() - gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) - end) - - map('n', '<leader>hS', gitsigns.stage_buffer) - map('n', '<leader>hR', gitsigns.reset_buffer) - map('n', '<leader>hp', gitsigns.preview_hunk) - map('n', '<leader>hi', gitsigns.preview_hunk_inline) - end - }) - - require("nvim-surround").setup({}) - -- local smear_cursor = require('smear_cursor') - -- smear_cursor.enabled = true - -- smear_cursor.delay_event_to_smear = 33 - -- smear_cursor.cursor_color = '#ff0000' - -- smear_cursor.legacy_computing_symbols_support = true - -- smear_cursor.stiffness = 0.8 - -- smear_cursor.min_vertical_distance_smear = 5 - -- smear_cursor.min_horizontal_distance_smear = 20 - -- smear_cursor.distance_stop_animating = 0 - -- smear_cursor.trailing_stiffness = 0.5 - -- smear_cursor.time_inerval = 5 - -- smear_cursor.gamma = 2 - -- smear_cursor.color_levels = 16 - -- smear_cursor.smear_to_cmd = false - require('hop').setup() -EOF - diff --git a/lua/config/00-options.lua b/lua/config/00-options.lua new file mode 100644 index 0000000..629c14d --- /dev/null +++ b/lua/config/00-options.lua @@ -0,0 +1,42 @@ +-- Editor options extracted from the original init.vim. +-- Load before plugin setup where possible (especially netrw and mapleader). + +local opt = vim.opt +local g = vim.g + +g.loaded_netrw = 1 +g.loaded_netrwPlugin = 1 +g.mapleader = ' ' + + +-- Display and navigation. +opt.termguicolors = true +opt.number = true +opt.relativenumber = true +opt.wrap = false +opt.scrolloff = 8 +opt.title = true +opt.colorcolumn = '+1' + +-- Indentation and text layout. +opt.shiftwidth = 2 +opt.tabstop = 2 +opt.expandtab = true +opt.textwidth = 80 + +-- Splits and completion. +opt.splitright = true +opt.splitbelow = true +opt.wildmode = { 'longest', 'list', 'full' } +opt.pumheight = 20 +opt.completeopt = { 'menu', 'menuone', 'noselect' } + +-- Performance, responsiveness, and matching pairs. +opt.updatetime = 1000 +opt.matchpairs:append('<:>') + +-- Global configuration for plugins. +g.vsnip_snippet_dir = vim.fn.expand('~/.config/nvim/snippets') +g.vsnip_snippet_dirs = { vim.fn.expand('~/.config/nvim/local/snippets') } +g.jq_highlight_objects = 1 +g.jq_highlight_function_calls = 1 diff --git a/lua/config/01-plugins.lua b/lua/config/01-plugins.lua new file mode 100644 index 0000000..e0acdd0 --- /dev/null +++ b/lua/config/01-plugins.lua @@ -0,0 +1,56 @@ +-- Core plugin list: Neovim 0.12+ built-in package manager. +-- GitHub shorthand (owner/repo) is not supported by vim.pack. +local github = function(repo) + return 'https://github.com/' .. repo .. '.git' +end + +-- Josher projects: local working checkout takes precedence over Git. +-- Change the root on each machine or override this helper locally. +local projects = vim.fn.expand('~/Projects') +local function josher(repo) + local path = projects .. '/' .. repo + if vim.fn.isdirectory(path) == 1 then + -- Place local checkout on runtimepath instead of downloading it. + vim.opt.rtp:prepend(path) + return nil + end + return 'git@git.josher.dev:' .. repo .. '.git' +end + +local plugins = { + -- Searching + github('nvim-lua/plenary.nvim'), + github('nvim-telescope/telescope.nvim'), + + -- Syntax / structural editing + github('nvim-treesitter/nvim-treesitter'), + github('nvim-treesitter/nvim-treesitter-textobjects'), + + -- Editing and navigation + github('lewis6991/gitsigns.nvim'), + github('kylechui/nvim-surround'), + github('smoka7/hop.nvim'), + + -- UI + github('nvim-lualine/lualine.nvim'), + github('nvim-tree/nvim-web-devicons'), + + -- LSP server presets only; native vim.lsp.enable/config is used elsewhere. + github('neovim/nvim-lspconfig'), + + -- Existing personal plugins; delete entries you no longer want. + josher('bulletjava.vim'), + josher('fieldmarshal.vim'), + josher('nvim-color-picker'), + josher('nvim-warp'), + josher('meltdown'), + josher('extregs.nvim'), + -- josher('rneovim-userregs'), -- Optional experimental branch/plugin. +} + +-- Local projects return nil; remove holes before calling vim.pack. +local install = {} +for _, plugin in pairs(plugins) do + if plugin then install[#install + 1] = plugin end +end +vim.pack.add(install) diff --git a/lua/config/02-mappings.lua b/lua/config/02-mappings.lua new file mode 100644 index 0000000..8c4f6e3 --- /dev/null +++ b/lua/config/02-mappings.lua @@ -0,0 +1,148 @@ +-- Global mappings migrated from the original init.vim. +-- Load after setting vim.g.mapleader = " " and after defining required commands. +-- Plugin-owned mappings (LSP, Gitsigns, Tree-sitter, Trouble) remain in their setup files. + +vim.g.mapleader = vim.g.mapleader or " " + +local map = vim.keymap.set +local all = { "n", "x", "s", "o" } -- Vimscript :noremap modes + +local function find_in_dir() + local dir = vim.fn.resolve(vim.fn.expand("%:p:h")) + require("telescope.builtin").find_files({ + search_ |