diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2025-12-26 00:57:46 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2025-12-26 00:57:46 -0500 |
| commit | 9cd1e4f16131c41f2b16637ced9fd184573a7102 (patch) | |
| tree | 0d115ba19ca7329748eea0de14a3bee1e802ecd6 | |
| parent | 14cfc33991fa3b858301fb8738ae7dbf41e48e80 (diff) | |
| download | dotfiles-9cd1e4f16131c41f2b16637ced9fd184573a7102.tar.gz dotfiles-9cd1e4f16131c41f2b16637ced9fd184573a7102.tar.xz | |
Start shifting over to nvim0.12, fix treesitter, add nvim compile script
| -rwxr-xr-x | compile/nvim.sh | 17 | ||||
| -rwxr-xr-x | compile/oksh.sh | 6 | ||||
| -rw-r--r-- | dotfiles/nvim/init.lua | 190 | ||||
| -rw-r--r-- | dotfiles/nvim/nvim0.12.lua | 147 | ||||
| -rwxr-xr-x | install.sh | 6 |
5 files changed, 76 insertions, 290 deletions
diff --git a/compile/nvim.sh b/compile/nvim.sh new file mode 100755 index 0000000..d5badf5 --- /dev/null +++ b/compile/nvim.sh @@ -0,0 +1,17 @@ +#!/bin/sh +if [ "$(id -u)" -eq 0 ] ; then + echo "Run as a regular user" + exit 1 +fi +set -ex +codedir="${CODEDIR:-$HOME/scm}" +nvimdir="${codedir}/nvim" +if ! [ -d "$nvimdir" ] ; then + git clone https://github.com/neovim/neovim "$nvimdir" +fi +cd "$nvimdir" +# git clean -fdx . +rm -rf build || echo "" +make CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=$HOME/.local" -j"$(nproc)" +make install +cd - diff --git a/compile/oksh.sh b/compile/oksh.sh index 1a44c0f..a22eacf 100755 --- a/compile/oksh.sh +++ b/compile/oksh.sh @@ -1,12 +1,12 @@ #!/bin/sh set -ex -codedir="$HOME/scm/pub" -okshdir="${codedir}/ibara-oksh" +codedir="${CODEDIR:-$HOME/scm/pub}" +okshdir="${codedir}/oksh" if ! [ -d "$okshdir" ] ; then git clone https://github.com/ibara/oksh "$okshdir" fi cd "$okshdir" -git checkout oksh-7.6 +git checkout oksh-7.8 ./configure make sudo make install diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua index 1a762e2..3186fe0 100644 --- a/dotfiles/nvim/init.lua +++ b/dotfiles/nvim/init.lua @@ -1,24 +1,30 @@ --- ~/.config/nvim/init.lua --- Setup for paq: --- git clone --depth=1 https://github.com/savq/paq-nvim.git "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim --- https://github.com/savq/paq-nvim -require "paq" { - 'savq/paq-nvim', - 'shaunsingh/nord.nvim', - 'ellisonleao/gruvbox.nvim', - 'nvim-lua/plenary.nvim', -- Required for telescope - 'nvim-telescope/telescope.nvim', - {'nvim-treesitter/nvim-treesitter', build = ':TSUpdate'}, - 'tpope/vim-fugitive', - 'lewis6991/gitsigns.nvim', - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - 'fatih/vim-go', - {'neovim/nvim-lspconfig'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/nvim-cmp'}, - -- 'nvim-lualine/lualine.nvim', -- status line -} +-- Configuration for nvim 0.12+ + +-- Themes +vim.pack.add({'https://github.com/shaunsingh/nord.nvim'}) +vim.pack.add({'https://github.com/ellisonleao/gruvbox.nvim'}) + +vim.pack.add({'https://github.com/nvim-treesitter/nvim-treesitter'}) + +-- Required for telescope +vim.pack.add({'https://github.com/nvim-lua/plenary.nvim'}) +vim.pack.add({'https://github.com/nvim-telescope/telescope.nvim'}) + + +-- `pacman -S tree-sitter-cli` or similar if you get tons of errors... +-- ls ~/.local/share/nvim/site/parser/ +-- can also be useful +require'nvim-treesitter'.install { 'bash', 'c', 'cpp', 'go', 'gomod', 'java', 'javascript', 'lua', 'zig' } + +vim.api.nvim_create_autocmd('FileType', { + pattern = { 'lua', 'c', 'cpp', 'go', 'gomod', 'sh', 'bash', 'js' }, + callback = function() vim.treesitter.start() end, +}) + +vim.api.nvim_create_autocmd('User', { pattern = 'TSUpdate', +callback = function() + require('nvim-treesitter.parsers').lua.install_info.generate = true +end}) -------------------------------------------------------------------------------- -- telescope @@ -61,87 +67,7 @@ require('nord').set() -------------------------------------------------------------------------------- -require('gitsigns').setup { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, -} - - -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" - -- https://github.com/nvim-treesitter/nvim-treesitter - ensure_installed = { - "c", "lua", 'javascript', 'go', 'sql', 'python', 'bash', 'css' - }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, - - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, - - -- List of parsers to ignore installing (for "all") - -- ignore_install = { "javascript" }, - - ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) - -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! - - highlight = { - -- `false` will disable the whole extension - enable = true, - - -- 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 = false, - }, -} - -require("mason").setup() - --- LSP --- Reserve a space in the gutter --- This will avoid an annoying layout shift in the screen -vim.opt.signcolumn = 'yes' - --- Add cmp_nvim_lsp capabilities settings to lspconfig --- This should be executed before you configure any language server -local lspconfig_defaults = require('lspconfig').util.default_config -lspconfig_defaults.capabilities = vim.tbl_deep_extend( - 'force', - lspconfig_defaults.capabilities, - require('cmp_nvim_lsp').default_capabilities() -) - --- This is where you enable features that only work --- if there is a language server active in the file -vim.api.nvim_create_autocmd('LspAttach', { - desc = 'LSP actions', - callback = function(event) - local opts = {buffer = event.buf} - - vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts) - vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts) - vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts) - vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts) - vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts) - vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts) - vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts) - vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts) - vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts) - vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts) - end, -}) - - --- Personal config options below: +-- "Basic" nvim config: vim.opt.nu = true vim.opt.rnu = true @@ -164,21 +90,14 @@ vim.opt.softtabstop = 4 vim.opt.shiftwidth = 4 vim.opt.smartindent = true vim.opt.expandtab = false -vim.opt.wrap = true - --- Allow shift K and shift J to move around a selected block of text, --- While I could just cut and paste this is also neat. --- vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") --- vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") - --- vim.opt.mouse+ = a --- vim.cmd('syntax on') +vim.opt.wrap = false -- I know how to setup my editor, I don't need your changes to my vim -- configuration. vim.opt.modeline = false -- Use \-s to pop open a spelling menu. use ]s to search forwards and [s to go +-- -- backwards. -- Apparently this also doesn't work if spell checking isn't enabled -- at the time you enable it. @@ -190,34 +109,37 @@ vim.opt.spell = false -- Always show status line vim.opt.laststatus = 2 +-- Automatically keep window sizes equal and do it automatically +vim.cmd("set ea") +vim.cmd("autocmd VimResized * wincmd =") --- Persistent undo and no swap files -vim.opt.updatecount = 0 -vim.opt.compatible = false -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undofile = false -vim.opt.undodir = os.getenv("HOME") .. '/.nvimundo' -vim.opt.undolevels = 1000 -vim.opt.undoreload = 10000 - --- lots of history, it's always nice to find old nasty command that happen --- to be really useful -vim.opt.history = 10000 +vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + -- update_in_insert = false, + severity_sort = true +}) -vim.cmd("set ea") -vim.cmd("autocmd VimResized * wincmd =") +-- For LSP, :help lsp-defaults can be useful to get the keybindings down -vim.cmd('colorscheme gruvbox') +-- clangd language server config... +-- 'bear' can be useful for generating compile_commands.json with clangd +vim.lsp.config['clangd'] = { + cmd = {'clangd'}, + filetypes = { 'c', 'cpp' }, + root_markers = {'compile_commands.json' }, +} +vim.lsp.enable('clangd') --- vim.lsp.enable('gopls') -- nvim 0.11, requires additional files: --- https://lsp-zero.netlify.app/blog/lsp-in-3-steps.html --- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md -require('lspconfig').gopls.setup({}) -require('lspconfig').bashls.setup({}) -require('lspconfig').lua_ls.setup({}) +vim.lsp.config['gopls'] = { + cmd = {'gopls'}, + filetypes = { 'go' }, + root_markers = {'go.mod' }, +} +vim.lsp.enable('gopls') -require('mason-lspconfig').setup() +vim.cmd('colorscheme gruvbox') diff --git a/dotfiles/nvim/nvim0.12.lua b/dotfiles/nvim/nvim0.12.lua deleted file mode 100644 index 2d0ee2f..0000000 --- a/dotfiles/nvim/nvim0.12.lua +++ /dev/null @@ -1,147 +0,0 @@ --- Configuration for nvim 0.12+ --- Not replacing my main configuration yet as this isn't released or --- in any distribution package managers at the moment - --- Themes -vim.pack.add({'https://github.com/shaunsingh/nord.nvim'}) -vim.pack.add({'https://github.com/ellisonleao/gruvbox.nvim'}) - -vim.pack.add({'https://github.com/nvim-treesitter/nvim-treesitter'}) - --- Required for telescope -vim.pack.add({'https://github.com/nvim-lua/plenary.nvim'}) -vim.pack.add({'https://github.com/nvim-telescope/telescope.nvim'}) - -local hooks = function(ev) - local name, kind = ev.data.spec.name, ev.data.kind - - if name == 'nvim-treesitter' then - vim.system(":TSUpdate") - end -end - -vim.api.nvim_create_autocmd('PackChanged', {callback = hooks}) - -require'nvim-treesitter.configs'.setup { - hightlight = { - enable = true, - } -} - --------------------------------------------------------------------------------- --- telescope --------------------------------------------------------------------------------- -vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '<leader>sb', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) -vim.keymap.set('n', '<leader>/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) -end, { desc = '[/] Fuzzily search in current buffer]' }) - -vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) -local builtin = require('telescope.builtin') -vim.keymap.set('n', '<C-p>', builtin.find_files, {}) -vim.keymap.set('n', '<C-o>', builtin.git_files, {}) -vim.keymap.set('n', '<leader>ps', function() - builtin.grep_string({ search = vim.fn.input("Grep > ") }) -end) --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- Nord theme config --------------------------------------------------------------------------------- --- vim.g.nord_contrast = true --- vim.g.nord_borders = false -vim.g.nord_disable_background = true -vim.g.nord_italic = false --- vim.g.nord_uniform_diff_background = true -vim.g.nord_bold = false - --- Load the colorscheme -require('nord').set() --------------------------------------------------------------------------------- - - --- "Basic" nvim config: - -vim.opt.nu = true -vim.opt.rnu = true - -vim.keymap.set("n", "<leader>l", function() vim.cmd('set list!') end) -vim.opt.listchars = 'tab:▸ ,eol:¬,trail:•' --- vim.opt.listchars = 'tab:| ,eol:$,trail:.' - --- tw == textwidth -vim.opt.tw = 80 -vim.opt.colorcolumn = "80" - -vim.opt.ic = true -vim.opt.hls = true - -vim.opt.scrolloff = 8 - -vim.opt.tabstop = 4 -vim.opt.softtabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.smartindent = true -vim.opt.expandtab = false -vim.opt.wrap = false - --- I know how to setup my editor, I don't need your changes to my vim --- configuration. -vim.opt.modeline = false - --- Use \-s to pop open a spelling menu. use ]s to search forwards and [s to go --- --- backwards. --- Apparently this also doesn't work if spell checking isn't enabled --- at the time you enable it. -vim.opt.spell = true -vim.keymap.set("n", "<leader>ss", "ea<C-X><C-S>") -vim.opt.spell = false - - --- Always show status line -vim.opt.laststatus = 2 - --- Automatically keep window sizes equal and do it automatically -vim.cmd("set ea") -vim.cmd("autocmd VimResized * wincmd =") - - -vim.diagnostic.config({ - virtual_text = true, - signs = true, - underline = true, - -- update_in_insert = false, - severity_sort = true, -}) - - --- For LSP, :help lsp-defaults can be useful to get the keybindings down - --- clangd language server config... --- 'bear' can be useful for generating compile_commands.json with clangd -vim.lsp.config['clangd'] = { - cmd = {'clangd'}, - filetypes = { 'c', 'cpp' }, - root_markers = {'compile_commands.json' }, -} -vim.lsp.enable('clangd') - - -vim.lsp.config['gopls'] = { - cmd = {'gopls'}, - filetypes = { 'go' }, - root_markers = {'go.mod' }, -} -vim.lsp.enable('gopls') - -vim.cmd('colorscheme gruvbox') @@ -39,12 +39,6 @@ if ! [ -d "$_nvimdir" ] ; then fi setLink -s "$(pwd)/dotfiles/nvim/init.lua" -d "$_nvimdir/init.lua" -_paq_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim -if ! [ -d "$_paq_dir" ] ; then - git clone --depth=1 https://github.com/savq/paq-nvim.git "$_paq_dir" - printf "\033[1;31m%s\033[0m\n" "You will need to run ':PacSync' in neovim" -fi - _ghosttydir="$HOME/.config/ghostty" if ! [ -d "$_ghosttydir" ] ; then mkdir "$_ghosttydir" |
