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 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 {{{
remember_window_size no
# initial_window_width 640
# initial_window_height 400
# initial_window_width 1600
# initial_window_height 900
#: If enabled, the window size will be remembered so that new
#: 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
#: 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 special value all means all layouts. The first listed layout

View file

@ -1,14 +1,16 @@
require('aerial').setup {
backends = { "treesitter", "lsp", "markdown", "man" },
local aerial = require('aerial')
aerial.setup {
backends = { "lsp", "treesitter", "markdown", "man" },
layout = {
default_direction = "right", -- "float",
default_direction = "float",
placement = "edge",
},
attach_mode = "global",
highlight_mode = "none",
lazy_load = false,
on_attach = function(bufnr)
-- 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 '}'
vim.api.nvim_buf_set_keymap(bufnr, 'n', '{', '<cmd>AerialPrev<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>', {})
end,
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,
word_diff = false,
on_attach = function(bufnr)
-- Setup keymaps
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>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>d', '<cmd>Gitsigns diffthis<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gq', '<cmd>Gitsigns setqflist<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>gl', '<cmd>Gitsigns setloclist<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>', {})
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>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>bs', '<cmd>Gitsigns stage_buffer<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>br', '<cmd>Gitsigns reset_buffer<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>bl', '<cmd>Gitsigns blame_line<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btn', '<cmd>Gitsigns toggle_numhl<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>btl', '<cmd>Gitsigns toggle_linehl<CR>', {})
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>', {})
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', '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,
}

View file

@ -175,3 +175,9 @@ require('lspconfig')['sumneko_lua'].setup {
flags = lsp_flags,
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_netrwPlugin = 1
-- vim.g.loaded_netrw = 1
-- vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
require('nvim-tree').setup {
open_on_setup=true,
open_on_setup_file=false,
hijack_cursor=true,
sync_root_with_cwd=true,
disable_netrw = false,
hijack_netrw = false,
open_on_setup = false,
open_on_setup_file = false,
hijack_cursor = true,
sync_root_with_cwd = true,
respect_buf_cwd = true,
update_focused_file = {
enable = true,
update_root = true,
},
diagnostics = {
enable = 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 = {
add_trailing = true,
group_empty = true,
full_name = 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')
local trouble = require('trouble.providers.telescope')
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 = {
mappings = {
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 = ' '
-- Misc
imap('jk', '<Esc>')
nmap('<leader>gg', '<cmd>10TermExec cmd="lazygit; exit" direction="vertical" go_back=0<cr>')
nmap('<leader>gh', '<cmd>10TermExec cmd="lazygit; exit" direction="horizontal" go_back=0<cr>')
nmap('<leader>gf', '<cmd>10TermExec cmd="lazygit; exit" direction="float" go_back=0<cr>')
nmap('<leader>gp', '<cmd>Git pull<cr>')
nmap('<leader>gP', '<cmd>Git push<cr>')
nmap('<leader>hq', '<cmd>Gitsigns setqflist all<cr>')
nmap('<leader>gl', '<cmd>Git pull<cr>')
nmap('<leader>gp', '<cmd>Git push<cr>')
nmap('<leader>cc', '<cmd>Git commit<cr>')
nmap('<leader>co', ':Git checkout')
-- Telescope
nmap('<leader>;', '<cmd>Telescope builtin<cr>')
nmap('<leader>ff', '<cmd>Telescope find_files<cr>')
nmap('<leader>fr', '<cmd>Telescope resume<cr>')
nmap('<leader>fb', '<cmd>Telescope buffers<cr>')
nmap('<leader>fh', '<cmd>Telescope help_tags<cr>')
nmap('<leader>fk', '<cmd>Telescope aerial<cr>')
nmap('<leader>fp', '<cmd>Telescope projects<cr>')
nmap('<leader>fa', '<cmd>Telescope aerial<cr>')
nmap('<leader>fd', '<cmd>Telescope lsp_document_symbols<cr>')
nmap('<leader>fe', '<cmd>Telescope diagnostics<cr>')
nmap('<leader>fn', '<cmd>Telescope notify<cr>')
nmap('<leader>ft', '<cmd>Telescope treesitter<cr>')
nmap('<leader>fz', '<cmd>Telescope current_buffer_fuzzy_find<cr>')
nmap('<leader>fg', '<cmd>Telescope git_status<cr>')
-- Hop
nmap('<leader>hl', '<cmd>HopLine<cr>')
nmap('<leader>hw', '<cmd>HopWord<cr>')
-- Nvim-tree
nmap('<leader>nt', '<cmd>NvimTreeToggle<cr>')
nmap('<leader>n', '<cmd>NvimTreeToggle<cr>')
nmap('<leader>s', '<cmd>SidebarNvimToggle<cr>')
-- Trouble
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>xq', '<cmd>TroubleToggle quickfix<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',
}
vim.opt.termguicolors = true
vim.opt.mouse = "nvi"
vim.opt.mouse = "nv"
vim.opt.shiftwidth = 4
vim.opt.number = true
vim.opt.relativenumber = true

View file

@ -84,6 +84,12 @@ require('packer').startup {
require 'config_plugins.config_nvim-tree'
end
}
use {
"ahmedkhalf/project.nvim",
config = function()
require 'config_plugins.config_project'
end
}
use {
'akinsho/toggleterm.nvim',
tag = 'v2.*',
@ -91,6 +97,10 @@ require('packer').startup {
require 'config_plugins.config_toggleterm'
end
}
use {
'nvim-telescope/telescope-fzf-native.nvim',
run = 'make'
}
use {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
@ -101,10 +111,6 @@ require('packer').startup {
require 'config_plugins.config_telescope'
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 {
'michaelb/sniprun',
run = 'bash install.sh',

View file

@ -43,7 +43,6 @@ fi
if [ ! which -a fzf > /dev/null ]
then
python3 -m pip install --user pipx
pipx ensurepath
fi
# 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"
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
if [ ! -d "$ZSH" ]
then
@ -64,20 +81,3 @@ then
create_symlink "$OHMYZSH_DIR" "./completions.zsh"
create_symlink "$OHMYZSH_DIR" "./paths.zsh"
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