aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Riedstra <mitch@riedstra.dev>2025-01-22 08:39:41 -0500
committerMitchell Riedstra <mitch@riedstra.dev>2025-01-22 08:39:41 -0500
commite2b0c4a4ee95d9e05162da15e5dc89484c03f599 (patch)
tree7e45a643ec3775ef0c557dc02d32ce4906ab87d5
parentbccc1e5ae58a9ca83bf7ad689f8970e9a3db2a1d (diff)
downloaddotfiles-e2b0c4a4ee95d9e05162da15e5dc89484c03f599.tar.gz
dotfiles-e2b0c4a4ee95d9e05162da15e5dc89484c03f599.tar.xz
Add nvim configuration
-rw-r--r--dotfiles/nvim/init.lua172
-rwxr-xr-xinstall.sh10
2 files changed, 182 insertions, 0 deletions
diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua
new file mode 100644
index 0000000..7df15ea
--- /dev/null
+++ b/dotfiles/nvim/init.lua
@@ -0,0 +1,172 @@
+-- ~/.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',
+ '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',
+ -- 'nvim-lualine/lualine.nvim', -- status line
+}
+
+--------------------------------------------------------------------------------
+-- 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()
+--------------------------------------------------------------------------------
+
+
+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", 'rust', 'javascript', 'typescript', 'go', 'hcl',
+ 'java', 'lua', 'make', 'perl', 'python', 'scheme', 'sql', 'svelte',
+ 'terraform', 'yaml', 'bash', 'css', 'haskell',
+ },
+
+ -- 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()
+
+-- Personal config options below:
+
+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 = 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')
+
+-- 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
+
+
+-- 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 = true
+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.cmd("set ea")
+vim.cmd("autocmd VimResized * wincmd =")
+
diff --git a/install.sh b/install.sh
index 179a8d5..c457ecb 100755
--- a/install.sh
+++ b/install.sh
@@ -26,9 +26,19 @@ for _f in dotfiles/* ; do
src="$(pwd)/$_f"
dest="$HOME/.$(basename "$_f")"
+ if ! [ -f "$src" ] ; then
+ continue
+ fi
+
setLink -s "$src" -d "$dest"
done
+_nvimdir="$HOME/.config/nvim"
+if ! [ -d "$_nvimdir" ] ; then
+ mkdir "$_nvimdir"
+fi
+setLink -s "$(pwd)/dotfiles/nvim/init.lua" -d "$_nvimdir/init.lua"
+
if ! [ -d "$HOME/bin" ] ; then mkdir "$HOME/bin" ; fi
for _f in bin/* ; do
src="$(pwd)/$_f"