Merge branch 'main' of github.com:elitherl/dotfiles

This commit is contained in:
Evie Litherland-Smith 2023-01-27 07:00:44 +00:00
commit 168efa5d08
15 changed files with 187 additions and 73 deletions

View file

@ -1,3 +1,4 @@
alias vim="nvim" alias nvimdiff="nvim -d"
alias pvim="poetry run nvim"
alias lg="lazygit" alias lg="lazygit"
alias kssh="kitty +kitten ssh" alias kssh="kitty +kitten ssh"

BIN
bin/rg Executable file

Binary file not shown.

BIN
bin/texlab Executable file

Binary file not shown.

View file

@ -659,8 +659,8 @@ bell_on_tab "🔔 "
#: Window layout {{{ #: Window layout {{{
remember_window_size no remember_window_size no
# initial_window_width 640 # initial_window_width 1600
# initial_window_height 400 # initial_window_height 900
#: If enabled, the window size will be remembered so that new #: If enabled, the window size will be remembered so that new
#: instances of kitty will have the same size as the previous #: instances of kitty will have the same size as the previous
@ -669,7 +669,7 @@ remember_window_size no
#: suffix of "c" on the width/height values to have them interpreted #: suffix of "c" on the width/height values to have them interpreted
#: as number of cells instead of pixels. #: as number of cells instead of pixels.
enabled_layouts Fat, Grid, Tall enabled_layouts Grid, Fat, Tall
#: The enabled window layouts. A comma separated list of layout names. #: The enabled window layouts. A comma separated list of layout names.
#: The special value all means all layouts. The first listed layout #: The special value all means all layouts. The first listed layout

View file

@ -1,14 +1,16 @@
require('aerial').setup { local aerial = require('aerial')
backends = { "treesitter", "lsp", "markdown", "man" }, aerial.setup {
backends = { "lsp", "treesitter", "markdown", "man" },
layout = { layout = {
default_direction = "right", -- "float", default_direction = "float",
placement = "edge", placement = "edge",
}, },
attach_mode = "global", attach_mode = "global",
highlight_mode = "none",
lazy_load = false, lazy_load = false,
on_attach = function(bufnr) on_attach = function(bufnr)
-- Toggle the aerial window with <leader>a -- Toggle the aerial window with <leader>a
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>k', '<cmd>AerialToggle!<CR>', {}) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>a', '<cmd>AerialToggle!<CR>', {})
-- Jump forwards/backwards with '{' and '}' -- Jump forwards/backwards with '{' and '}'
vim.api.nvim_buf_set_keymap(bufnr, 'n', '{', '<cmd>AerialPrev<CR>', {}) vim.api.nvim_buf_set_keymap(bufnr, 'n', '{', '<cmd>AerialPrev<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '}', '<cmd>AerialNext<CR>', {}) vim.api.nvim_buf_set_keymap(bufnr, 'n', '}', '<cmd>AerialNext<CR>', {})
@ -17,4 +19,6 @@ require('aerial').setup {
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', '<cmd>AerialNextUp<CR>', {}) vim.api.nvim_buf_set_keymap(bufnr, 'n', ']]', '<cmd>AerialNextUp<CR>', {})
end, end,
open_automatic = false, open_automatic = false,
close_automatic_events = { "unfocus", "switch_buffer", "unsupported" },
show_guides = true,
} }

View file

@ -5,21 +5,41 @@ require('gitsigns').setup {
current_line_blame = true, current_line_blame = true,
word_diff = false, word_diff = false,
on_attach = function(bufnr) on_attach = function(bufnr)
-- Setup keymaps local gs = package.loaded.gitsigns
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', '<cmd>Gitsigns prev_hunk<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', '<cmd>Gitsigns next_hunk<CR>', {}) local function map(mode, l, r, opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>d', '<cmd>Gitsigns diffthis<CR>', {}) opts = opts or {}
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gq', '<cmd>Gitsigns setqflist<CR>', {}) opts.buffer = bufnr
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gl', '<cmd>Gitsigns setloclist<CR>', {}) vim.keymap.set(mode, l, r, opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>', {}) end
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hs', '<cmd>Gitsigns stage_hunk<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hr', '<cmd>Gitsigns reset_hunk<CR>', {}) -- Navigation
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>bs', '<cmd>Gitsigns stage_buffer<CR>', {}) map('n', ']c', function()
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>br', '<cmd>Gitsigns reset_buffer<CR>', {}) if vim.wo.diff then return ']c' end
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>bl', '<cmd>Gitsigns blame_line<CR>', {}) vim.schedule(function() gs.next_hunk() end)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btn', '<cmd>Gitsigns toggle_numhl<CR>', {}) return '<Ignore>'
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btl', '<cmd>Gitsigns toggle_linehl<CR>', {}) end, { expr = true })
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btc', '<cmd>Gitsigns toggle_current_line_blame<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btw', '<cmd>Gitsigns toggle_word_diff<CR>', {}) 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', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
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, end,
} }

View file

@ -175,3 +175,9 @@ require('lspconfig')['sumneko_lua'].setup {
flags = lsp_flags, flags = lsp_flags,
capabilities = capabilities, capabilities = capabilities,
} }
require('lspconfig')['texlab'].setup {
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}

View file

@ -1,20 +1,56 @@
vim.g.loaded_netrw = 1 -- vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 -- vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
require('nvim-tree').setup { require('nvim-tree').setup {
open_on_setup=true, disable_netrw = false,
open_on_setup_file=false, hijack_netrw = false,
hijack_cursor=true, open_on_setup = false,
sync_root_with_cwd=true, open_on_setup_file = false,
hijack_cursor = true,
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_root = true,
}, },
diagnostics = { diagnostics = {
enable = true, enable = true,
show_on_dirs = true, show_on_dirs = true,
show_on_open_dirs = false,
},
git = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
modified = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
},
view = {
centralize_selection = true,
float = {
enable = true,
},
}, },
filters = { custom = { "^.git$" } },
renderer = { renderer = {
add_trailing = true,
group_empty = true, group_empty = true,
full_name = true,
highlight_git = true, highlight_git = true,
highlight_modified = "all",
indent_markers = {
enable = true,
},
icons = {
show = {
git = false,
modified = false,
},
},
},
filters = {
dotfiles = true,
}, },
} }

View file

@ -0,0 +1,40 @@
require("project_nvim").setup {
-- Manual mode doesn't automatically change your root directory, so you have
-- the option to manually do so using `:ProjectRoot` command.
manual_mode = false,
-- Methods of detecting the root directory. **"lsp"** uses the native neovim
-- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here
-- order matters: if one is not detected, the other is used as fallback. You
-- can also delete or rearangne the detection methods.
detection_methods = { "pattern", "lsp" },
-- All the patterns used to detect root dir, when **"pattern"** is in
-- detection_methods
patterns = { ".git", ".venv", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
-- Table of lsp clients to ignore by name
-- eg: { "efm", ... }
ignore_lsp = {},
-- Don't calculate root dir on specific directories
-- Ex: { "~/.cargo/*", ... }
exclude_dirs = {},
-- Show hidden files in telescope
show_hidden = false,
-- When set to false, you will get a message when project.nvim changes your
-- directory.
silent_chdir = true,
-- What scope to change the directory, valid options are
-- * global (default)
-- * tab
-- * win
scope_chdir = 'all',
-- Path where project.nvim will store the project history for use in
-- telescope
datapath = vim.fn.stdpath("data"),
}

View file

@ -1,10 +1,16 @@
require('telescope').load_extension('aerial')
require('telescope').load_extension('notify')
require('telescope.actions') require('telescope.actions')
local trouble = require('trouble.providers.telescope') local trouble = require('trouble.providers.telescope')
require('telescope').setup { require('telescope').setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
},
defaults = { defaults = {
mappings = { mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble }, i = { ["<c-t>"] = trouble.open_with_trouble },
@ -12,3 +18,8 @@ require('telescope').setup {
}, },
}, },
} }
require('telescope').load_extension('fzf')
require('telescope').load_extension('aerial')
require('telescope').load_extension('notify')
require('telescope').load_extension('projects')

View file

@ -13,34 +13,28 @@ end
vim.g.mapleader = ' ' vim.g.mapleader = ' '
-- Misc -- Misc
imap('jk', '<Esc>') imap('jk', '<Esc>')
nmap('<leader>gg', '<cmd>10TermExec cmd="lazygit; exit" direction="vertical" go_back=0<cr>') nmap('<leader>hq', '<cmd>Gitsigns setqflist all<cr>')
nmap('<leader>gh', '<cmd>10TermExec cmd="lazygit; exit" direction="horizontal" go_back=0<cr>') nmap('<leader>gl', '<cmd>Git pull<cr>')
nmap('<leader>gf', '<cmd>10TermExec cmd="lazygit; exit" direction="float" go_back=0<cr>') nmap('<leader>gp', '<cmd>Git push<cr>')
nmap('<leader>gp', '<cmd>Git pull<cr>')
nmap('<leader>gP', '<cmd>Git push<cr>')
nmap('<leader>cc', '<cmd>Git commit<cr>') nmap('<leader>cc', '<cmd>Git commit<cr>')
nmap('<leader>co', ':Git checkout')
-- Telescope -- Telescope
nmap('<leader>;', '<cmd>Telescope builtin<cr>') nmap('<leader>;', '<cmd>Telescope builtin<cr>')
nmap('<leader>ff', '<cmd>Telescope find_files<cr>') nmap('<leader>ff', '<cmd>Telescope find_files<cr>')
nmap('<leader>fr', '<cmd>Telescope resume<cr>') nmap('<leader>fp', '<cmd>Telescope projects<cr>')
nmap('<leader>fb', '<cmd>Telescope buffers<cr>') nmap('<leader>fa', '<cmd>Telescope aerial<cr>')
nmap('<leader>fh', '<cmd>Telescope help_tags<cr>')
nmap('<leader>fk', '<cmd>Telescope aerial<cr>')
nmap('<leader>fd', '<cmd>Telescope lsp_document_symbols<cr>') nmap('<leader>fd', '<cmd>Telescope lsp_document_symbols<cr>')
nmap('<leader>fe', '<cmd>Telescope diagnostics<cr>') nmap('<leader>fe', '<cmd>Telescope diagnostics<cr>')
nmap('<leader>fn', '<cmd>Telescope notify<cr>')
nmap('<leader>ft', '<cmd>Telescope treesitter<cr>') nmap('<leader>ft', '<cmd>Telescope treesitter<cr>')
nmap('<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>') nmap('<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
nmap('<leader>fg', '<cmd>Telescope git_status<cr>')
-- Hop -- Hop
nmap('<leader>hl', '<cmd>HopLine<cr>') nmap('<leader>hl', '<cmd>HopLine<cr>')
nmap('<leader>hw', '<cmd>HopWord<cr>') nmap('<leader>hw', '<cmd>HopWord<cr>')
-- Nvim-tree -- Nvim-tree
nmap('<leader>nt', '<cmd>NvimTreeToggle<cr>') nmap('<leader>n', '<cmd>NvimTreeToggle<cr>')
nmap('<leader>s', '<cmd>SidebarNvimToggle<cr>')
-- Trouble -- Trouble
nmap('<leader>xx', '<cmd>TroubleToggle<cr>') nmap('<leader>xx', '<cmd>TroubleToggle<cr>')
@ -48,6 +42,3 @@ nmap('<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<cr>')
nmap('<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>') nmap('<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>')
nmap('<leader>xq', '<cmd>TroubleToggle quickfix<cr>') nmap('<leader>xq', '<cmd>TroubleToggle quickfix<cr>')
nmap('<leader>xl', '<cmd>TroubleToggle loclist<cr>') nmap('<leader>xl', '<cmd>TroubleToggle loclist<cr>')
-- SnipRun
nmap('<leader>sr', '<cmd>%SnipRun<cr>')

View file

@ -7,7 +7,7 @@ vim.g.python_indent = {
closed_paren_align_last_line = 'v:false', closed_paren_align_last_line = 'v:false',
} }
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.opt.mouse = "nvi" vim.opt.mouse = "nv"
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4
vim.opt.number = true vim.opt.number = true
vim.opt.relativenumber = true vim.opt.relativenumber = true

View file

@ -84,6 +84,12 @@ require('packer').startup {
require 'config_plugins.config_nvim-tree' require 'config_plugins.config_nvim-tree'
end end
} }
use {
"ahmedkhalf/project.nvim",
config = function()
require 'config_plugins.config_project'
end
}
use { use {
'akinsho/toggleterm.nvim', 'akinsho/toggleterm.nvim',
tag = 'v2.*', tag = 'v2.*',
@ -91,6 +97,10 @@ require('packer').startup {
require 'config_plugins.config_toggleterm' require 'config_plugins.config_toggleterm'
end end
} }
use {
'nvim-telescope/telescope-fzf-native.nvim',
run = 'make'
}
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
branch = '0.1.x', branch = '0.1.x',
@ -101,10 +111,6 @@ require('packer').startup {
require 'config_plugins.config_telescope' require 'config_plugins.config_telescope'
end end
} }
use {
'nvim-telescope/telescope-fzf-native.nvim',
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
}
use { use {
'michaelb/sniprun', 'michaelb/sniprun',
run = 'bash install.sh', run = 'bash install.sh',

View file

@ -43,7 +43,6 @@ fi
if [ ! which -a fzf > /dev/null ] if [ ! which -a fzf > /dev/null ]
then then
python3 -m pip install --user pipx python3 -m pip install --user pipx
pipx ensurepath
fi fi
# pyenv # pyenv

View file

@ -45,6 +45,23 @@ PACKER_REPO="https://github.com/wbthomason/packer.nvim"
PACKER_DIR="$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" PACKER_DIR="$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim"
git_clone_if_missing "$PACKER_REPO" "$PACKER_DIR" git_clone_if_missing "$PACKER_REPO" "$PACKER_DIR"
# Set up git editor if missing
grep "editor" "$HOME/.gitconfig" > /dev/null || git config --global core.editor "nvim"
# Add NerdFont symbols
mkdir -p "$HOME/.local/share/fonts"
for FILE in nerdfont_symbols/*
do
create_symlink "$HOME/.local/share/fonts" "$FILE"
done
# Ensure nvim plugins
mkdir -p "$HOME/.local/bin"
for FILE in bin/*
do
which -a "$(basename $FILE)" > /dev/null || create_symlink "$HOME/.local/bin" "$FILE"
done
# oh-my-zsh # oh-my-zsh
if [ ! -d "$ZSH" ] if [ ! -d "$ZSH" ]
then then
@ -64,20 +81,3 @@ then
create_symlink "$OHMYZSH_DIR" "./completions.zsh" create_symlink "$OHMYZSH_DIR" "./completions.zsh"
create_symlink "$OHMYZSH_DIR" "./paths.zsh" create_symlink "$OHMYZSH_DIR" "./paths.zsh"
fi fi
# Set up git editor if missing
grep "editor" "$HOME/.gitconfig" > /dev/null || git config --global core.editor "nvim"
# Add NerdFont symbols
mkdir -p "$HOME/.local/share/fonts"
for FILE in nerdfont_symbols/*
do
create_symlink "$HOME/.local/share/fonts" "$FILE"
done
# Ensure nvim plugins
mkdir -p "$HOME/.local/bin"
for FILE in bin/*
do
which -a "$(basename $FILE)" > /dev/null || create_symlink "$HOME/.local/bin" "$FILE"
done