Compare commits
18 Commits
blesh
...
f7b5147450
| Author | SHA1 | Date | |
|---|---|---|---|
| f7b5147450 | |||
| 6246e75d81 | |||
| d901efe31a | |||
| e15f254143 | |||
| fa7af5ee1f | |||
| 819c41de45 | |||
| c97ef61d30 | |||
| 0d5d35d5e1 | |||
| 8c379c558a | |||
| 8ce45fc87c | |||
| ed9e0d4419 | |||
| dd35fe3b20 | |||
| c26f6a6bf5 | |||
| 08713c254f | |||
| 2d14e91f81 | |||
| 8dda8c7fbc | |||
| 7d67ff0662 | |||
|
|
a2076fd6f1 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
taskwarrior/.task/*.data
|
taskwarrior/.task/*.data
|
||||||
|
ssh/.ssh/extra.conf
|
||||||
|
|||||||
15
.gitmodules
vendored
15
.gitmodules
vendored
@@ -40,3 +40,18 @@
|
|||||||
[submodule "vim/.vim/bundle/ale"]
|
[submodule "vim/.vim/bundle/ale"]
|
||||||
path = vim/.vim/bundle/ale
|
path = vim/.vim/bundle/ale
|
||||||
url = https://github.com/dense-analysis/ale
|
url = https://github.com/dense-analysis/ale
|
||||||
|
[submodule "vim/.vim/nvim-bundle/plenary"]
|
||||||
|
path = vim/.vim/nvim-bundle/plenary
|
||||||
|
url = https://github.com/nvim-lua/plenary.nvim.git
|
||||||
|
[submodule "vim/.vim/nvim-bundle/telescope"]
|
||||||
|
path = vim/.vim/nvim-bundle/telescope
|
||||||
|
url = https://github.com/nvim-telescope/telescope.nvim.git
|
||||||
|
[submodule "vim/.vim/nvim-bundle/nvim-lspconfig"]
|
||||||
|
path = vim/.vim/nvim-bundle/nvim-lspconfig
|
||||||
|
url = https://github.com/neovim/nvim-lspconfig.git
|
||||||
|
[submodule "vim/.vim/nvim-bundle/indent-blankline"]
|
||||||
|
path = vim/.vim/nvim-bundle/indent-blankline
|
||||||
|
url = https://github.com/lukas-reineke/indent-blankline.nvim.git
|
||||||
|
[submodule "vim/.vim/nvim-bundle/LuaSnip"]
|
||||||
|
path = vim/.vim/nvim-bundle/LuaSnip
|
||||||
|
url = https://github.com/L3MON4D3/LuaSnip.git
|
||||||
|
|||||||
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Dotfiles
|
||||||
|
|
||||||
|
This is my personal dotfiles repository containing all my configurations (and some credentials in git-crypt). Most of these files are managed using [GNU Stow](https://www.gnu.org/software/stow/) to symlink them into place while the real files live in this repository under version control.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To place all the configuration files in their ultimate location we use the `apply-dotfiles` bash script. This script requires both `git` and `stow` to be available so we wrap this in either `install.sh` to install it similar to [gitpod dotfiles](https://www.gitpod.io/docs/configure/user-settings/dotfiles#custom-installation-script) (which are also used for [coder](https://coder.com/) workspaces) or `nix-install` for my many machines that have either Nix or NixOS installed.
|
||||||
|
|
||||||
|
## Secret Management
|
||||||
|
|
||||||
|
I use `git-crypt` to keep some sensitive files in this repo. Namely my taskwarrior configuration which uses locally stored certificates in it's configuration as a means of authentication. While using `git-crypt` for this is pretty functional the process of moving PGP keys around is onerous enough that I haven't put a lot of effort into automating this portion of my dotfiles. It's there, there are scripts to interact with it but it's still mostly manual right now
|
||||||
|
|
||||||
|
### Things to watch out for
|
||||||
|
|
||||||
|
As anyone who maintains their own dotfiles long enough will know, your mileage will vary depending on your target OS. You have static configuration files setup against one version of software being moved to other machines that might use older/newer versions where configuration options have changed. You might end up getting annoying warnings (common in vim) or things just might not work at all. You may have to tune things for the lowest common denominator or create alternate configurations for specific operating system.
|
||||||
@@ -1,13 +1,35 @@
|
|||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env bash
|
||||||
#! nix-shell -p stow -i bash
|
|
||||||
|
|
||||||
stow bash
|
apply_dotfile() {
|
||||||
stow sh
|
directory_to_stow="${1}"
|
||||||
stow readline
|
stow --adopt -S -t "${HOME}" "${directory_to_stow}"
|
||||||
|
}
|
||||||
|
|
||||||
stow vim
|
# Adopt will change the files in stow to match existing files.
|
||||||
|
# We don't want this, we just want to handle existing files gracefully.
|
||||||
|
# We simply adopt all the files and then at the end restore our git repo to undo changes
|
||||||
|
restore_from_adoption() {
|
||||||
|
git restore .
|
||||||
|
}
|
||||||
|
|
||||||
stow ruby
|
apply_dotfile bash
|
||||||
stow python
|
apply_dotfile sh
|
||||||
|
apply_dotfile readline
|
||||||
|
|
||||||
stow ssh
|
apply_dotfile vim
|
||||||
|
|
||||||
|
apply_dotfile ruby
|
||||||
|
apply_dotfile python
|
||||||
|
|
||||||
|
|
||||||
|
# Check that SSH version is above 9.2 (where EnableEscapeCommandline was added) before conditionally adding
|
||||||
|
# a config file. This is then included in the main config
|
||||||
|
SSH_VERSION=$(ssh -V 2>&1 | cut -d',' -f 1 | cut -d '_' -f 2)
|
||||||
|
if [[ "${SSH_VERSION}" =~ ^9\.[1-9]{0,1}[2-9].*$ ]]; then
|
||||||
|
cat <<CONFIG > ssh/.ssh/extra.conf
|
||||||
|
EnableEscapeCommandline yes
|
||||||
|
CONFIG
|
||||||
|
fi
|
||||||
|
apply_dotfile ssh
|
||||||
|
|
||||||
|
restore_from_adoption
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env bash
|
||||||
#! nix-shell -p stow envsubst -i bash
|
|
||||||
|
|
||||||
envsubst -i taskwarrior/.taskrc.envsubst.template -o taskwarrior/.taskrc
|
envsubst -i taskwarrior/.taskrc.envsubst.template -o taskwarrior/.taskrc
|
||||||
stow taskwarrior
|
stow taskwarrior
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#{- ~/.aliases -}#
|
#{- ~/.aliases -}#
|
||||||
|
|
||||||
|
alias vim="nvim "
|
||||||
|
|
||||||
#{- FILE OPERATIONS -}#
|
#{- FILE OPERATIONS -}#
|
||||||
|
|
||||||
# Allow alias expansion for commands executed with sudo
|
# Allow alias expansion for commands executed with sudo
|
||||||
@@ -37,6 +39,13 @@ alias df="df -h"
|
|||||||
# Human readable file size inspection
|
# Human readable file size inspection
|
||||||
alias du="du -sh"
|
alias du="du -sh"
|
||||||
|
|
||||||
|
# History searches
|
||||||
|
alias hgrep='history | grep --color'
|
||||||
|
alias phgrep="cat ${PERSISTENT_HISTFILE} | grep --color"
|
||||||
|
|
||||||
|
alias hfzf='history | fzf'
|
||||||
|
alias phfzf="cat ${PERSISTENT_HISTFILE} | fzf"
|
||||||
|
|
||||||
|
|
||||||
#{- NETWORKING -}#
|
#{- NETWORKING -}#
|
||||||
|
|
||||||
@@ -46,6 +55,8 @@ alias ping="ping -c 4"
|
|||||||
# Show progress while syncing
|
# Show progress while syncing
|
||||||
alias rsync="rsync --progress"
|
alias rsync="rsync --progress"
|
||||||
|
|
||||||
|
# Force a newline at the end of curl responses to prevent artifacting
|
||||||
|
alias curl="curl -w '\n'"
|
||||||
|
|
||||||
#{- SHELL INTROSPECTION -}#
|
#{- SHELL INTROSPECTION -}#
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export HISTSIZE=-1
|
|||||||
#{- SHELL OPTIONS -}#
|
#{- SHELL OPTIONS -}#
|
||||||
|
|
||||||
# Append history to $HISTFILE when bash exits, instead of overwriting it
|
# Append history to $HISTFILE when bash exits, instead of overwriting it
|
||||||
shopt -s histappend
|
#shopt -s histappend
|
||||||
|
|
||||||
# Attempt to preserve multi-line commands in history with embedded newlines
|
# Attempt to preserve multi-line commands in history with embedded newlines
|
||||||
shopt -s cmdhist lithist
|
shopt -s cmdhist lithist
|
||||||
|
|||||||
46
bash/.bashrc
46
bash/.bashrc
@@ -2,16 +2,17 @@
|
|||||||
|
|
||||||
#{- PROMPT -}#
|
#{- PROMPT -}#
|
||||||
|
|
||||||
red="\[\033[1;31m\]"
|
red="\001$(tput bold)$(tput setaf 1)\002"
|
||||||
green="\[\033[1;32m\]"
|
green="\001$(tput bold)$(tput setaf 2)\002"
|
||||||
yellow="\[\033[1;33m\]"
|
yellow="\001$(tput bold)$(tput setaf 3)\002"
|
||||||
blue="\[\033[1;34m\]"
|
blue="\001$(tput bold)$(tput setaf 4)\002"
|
||||||
magenta="\[\033[1;35m\]"
|
magenta="\001$(tput bold)$(tput setaf 5)\002"
|
||||||
cyan="\[\033[1;36m\]"
|
cyan="\001$(tput bold)$(tput setaf 6)\002"
|
||||||
no_color="\[\033[0m\]"
|
no_color="\001$(tput sgr0)\002"
|
||||||
|
|
||||||
|
|
||||||
export PS1="${green}\$${no_color} "
|
export PS1="${green}\$${no_color} "
|
||||||
if [ "${HOSTNAME}" != "crypt" ] && [ "${HOSTNAME}" != "tomb" ]; then
|
if [ "${HOSTNAME}" != "crypt" ] && [ "${HOSTNAME}" != "tomb" ] || [ "${SSH_TTY}" != "" ]; then
|
||||||
PS1="${PS1}${blue}${HOSTNAME} ${PS1}"
|
PS1="${PS1}${blue}${HOSTNAME} ${PS1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -22,12 +23,31 @@ export PS4="${blue}#${no_color} "
|
|||||||
|
|
||||||
#{- HISTORY -}#
|
#{- HISTORY -}#
|
||||||
|
|
||||||
#shopt -s histappend
|
PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
||||||
#export PROMPT_COMMAND="history -a; histroy -c; history -r; $PROMPT_COMMAND"
|
# PROMPT_COMMAND="echo hist1; history; history -n; echo hist2; history; history -w; echo hist3; history; history -c; echo hist4; history; history -r; echo hist5; history; $PROMPT_COMMAND"
|
||||||
|
export HISTFILE="$HOME/.history/bash"
|
||||||
|
export HISTTIMEFORMAT="%F %T "
|
||||||
|
export HISTCONTROL="erasedups:ignoreboth"
|
||||||
|
export HISTFILESIZE=-1
|
||||||
|
export HISTSIZE=-1
|
||||||
|
|
||||||
export HISTCONTROL="ignoreboth:erasedups"
|
export PERSISTENT_HISTFILE="${HOME}/.persistent_history"
|
||||||
shopt -s histappend
|
log_bash_persistent_history()
|
||||||
export PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
|
{
|
||||||
|
local rc=$?
|
||||||
|
[[
|
||||||
|
$(history 1) =~ ^\ *[0-9]+\ +([^\ ]+\ [^\ ]+)\ +(.*)$
|
||||||
|
]]
|
||||||
|
local date_part="${BASH_REMATCH[1]}"
|
||||||
|
local command_part="${BASH_REMATCH[2]}"
|
||||||
|
if [ "$command_part" != "$PERSISTENT_HISTORY_LAST" ]
|
||||||
|
then
|
||||||
|
echo $date_part "|" "$rc" "|" "$command_part" >> "${PERSISTENT_HISTFILE}"
|
||||||
|
export PERSISTENT_HISTORY_LAST="$command_part"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT_COMMAND="log_bash_persistent_history; $PROMPT_COMMAND"
|
||||||
|
|
||||||
|
|
||||||
#{- SOURCING -}#
|
#{- SOURCING -}#
|
||||||
|
|||||||
@@ -15,3 +15,9 @@ maths()
|
|||||||
{
|
{
|
||||||
bc -l <<< "scale=2; $*"
|
bc -l <<< "scale=2; $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cat_with_newline()
|
||||||
|
{
|
||||||
|
cat "$@" && echo
|
||||||
|
}
|
||||||
|
alias cat="cat_with_newline"
|
||||||
|
|||||||
33
install.sh
Executable file
33
install.sh
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "CURRENT LOCATION: $PWD"
|
||||||
|
|
||||||
|
echo "Installing dotfiles..."
|
||||||
|
if [ -f /etc/os-release ]; then
|
||||||
|
echo "Idenitfying OS to install GNU stow..."
|
||||||
|
if grep -q -i debian /etc/os-release; then
|
||||||
|
echo "You've got Debian!";
|
||||||
|
sudo apt update;
|
||||||
|
sudo apt install -y stow;
|
||||||
|
elif grep -q -i rhel /etc/os-release || grep -q -i fedora /etc/os-release; then
|
||||||
|
echo "You've got RedHat (or maybe Fedora)! Which is unsupported right now sorry!";
|
||||||
|
# sudo yum install -y stow;
|
||||||
|
# sudo yum clean all;
|
||||||
|
exit 1
|
||||||
|
elif grep -q -i alpine /etc/os-release; then
|
||||||
|
echo "You've got Alpine! Which is unsupported right now sorry!";
|
||||||
|
exit 1;
|
||||||
|
# apk add --no-cache jq curl;
|
||||||
|
else
|
||||||
|
echo "ERROR: Unable to identify OS!" 1>&2;
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
else
|
||||||
|
echo "ERROR: Unable to find '/etc/os-release' information!" 1>&2;
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Apply the dotfiles with stow
|
||||||
|
echo "RUNNING APPLY DOTFILES"
|
||||||
|
./apply-dotfiles
|
||||||
|
echo "RAN APPLY DOTFILES"
|
||||||
7
nix-install
Executable file
7
nix-install
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -p stow envsubst -i bash
|
||||||
|
|
||||||
|
# Uses nix shell to setup the dotfiles
|
||||||
|
./apply-dotfiles
|
||||||
|
# Secret dotfiles need interactivity anyways, not worrying about this for now
|
||||||
|
# ./apply-secret-dotfiles
|
||||||
@@ -74,3 +74,10 @@ set keymap vi-insert
|
|||||||
Control-q: quoted-insert
|
Control-q: quoted-insert
|
||||||
Control-@: set-mark
|
Control-@: set-mark
|
||||||
Control-_: undo
|
Control-_: undo
|
||||||
|
"\e[A": history-search-backward
|
||||||
|
"\e[B": history-search-forward
|
||||||
|
set keymap vi-command
|
||||||
|
j: history-search-forward
|
||||||
|
k: history-search-backward
|
||||||
|
"\e[A": history-search-backward
|
||||||
|
"\e[B": history-search-forward
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ export LC_COLLATE="C"
|
|||||||
export EDITOR="vim"
|
export EDITOR="vim"
|
||||||
export VISUAL="vim"
|
export VISUAL="vim"
|
||||||
|
|
||||||
|
# Export browser preferences.
|
||||||
|
export BROWSER="firefox"
|
||||||
|
|
||||||
# Export pager preferences.
|
# Export pager preferences.
|
||||||
export PAGER="less"
|
export PAGER="less"
|
||||||
export LESSHISTFILE="-"
|
export LESSHISTFILE="-"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
EnableEscapeCommandline yes
|
Include ~/.ssh/extra.conf
|
||||||
|
|||||||
24
vim/.config/nvim/init.vim
Normal file
24
vim/.config/nvim/init.vim
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
set runtimepath^=~/.vim runtimepath+=~/.vim/after
|
||||||
|
let &packpath = &runtimepath
|
||||||
|
source ~/.vimrc
|
||||||
|
|
||||||
|
lua <<EOF
|
||||||
|
vim.g.mapleader = ','
|
||||||
|
|
||||||
|
require('user.lspconfig')
|
||||||
|
require('user.indentblanklines')
|
||||||
|
require('user.luasnip')
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
nnoremap <leader>ib <cmd>IBLToggle<cr>
|
||||||
|
|
||||||
|
" Beginner keybinds for telescope
|
||||||
|
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
||||||
|
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
||||||
|
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||||
|
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
||||||
|
|
||||||
|
" lua print('this also works')
|
||||||
|
|
||||||
|
command! LuaRuntimePath lua print(vim.inspect(vim.api.nvim_list_runtime_paths()))
|
||||||
8
vim/.config/nvim/lua/user/indentblanklines.lua
Normal file
8
vim/.config/nvim/lua/user/indentblanklines.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
-- Configure the 'indent-blankline' plugin
|
||||||
|
-- Look at configuring this for rainbow blocks at some point
|
||||||
|
require('ibl').setup{
|
||||||
|
enabled = false,
|
||||||
|
indent = {
|
||||||
|
char = '|'
|
||||||
|
}
|
||||||
|
}
|
||||||
85
vim/.config/nvim/lua/user/lspconfig.lua
Normal file
85
vim/.config/nvim/lua/user/lspconfig.lua
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
print('User LSP Configuration loaded')
|
||||||
|
local lsp = require('lspconfig')
|
||||||
|
|
||||||
|
-- Configure LuaLS for lua
|
||||||
|
lsp.lua_ls.setup{
|
||||||
|
on_init = function(client)
|
||||||
|
local path = client.workspace_folders[1].name
|
||||||
|
if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
||||||
|
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using
|
||||||
|
-- (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = 'LuaJIT'
|
||||||
|
},
|
||||||
|
-- Make the server aware of Neovim runtime files
|
||||||
|
workspace = {
|
||||||
|
checkThirdParty = false,
|
||||||
|
library = {
|
||||||
|
vim.env.VIMRUNTIME
|
||||||
|
-- "${3rd}/luv/library"
|
||||||
|
-- "${3rd}/busted/library",
|
||||||
|
}
|
||||||
|
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
|
||||||
|
-- library = vim.api.nvim_get_runtime_file("", true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
lsp.pylsp.setup{}
|
||||||
|
lsp.solargraph.setup{}
|
||||||
|
|
||||||
|
|
||||||
|
-- Setup LSP bindings
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
desc = 'LSP actions',
|
||||||
|
callback = function()
|
||||||
|
local bufmap = function(mode, lhs, rhs)
|
||||||
|
local opts = {buffer = true}
|
||||||
|
vim.keymap.set(mode, lhs, rhs, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Displays hover information about the symbol under the cursor
|
||||||
|
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
|
||||||
|
|
||||||
|
-- Jump to the definition
|
||||||
|
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
|
||||||
|
|
||||||
|
-- Jump to declaration
|
||||||
|
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
|
||||||
|
|
||||||
|
-- Lists all the implementations for the symbol under the cursor
|
||||||
|
bufmap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>')
|
||||||
|
|
||||||
|
-- Jumps to the definition of the type symbol
|
||||||
|
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
|
||||||
|
|
||||||
|
-- Lists all the references
|
||||||
|
bufmap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>')
|
||||||
|
|
||||||
|
-- Displays a function's signature information
|
||||||
|
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
|
||||||
|
|
||||||
|
-- Renames all references to the symbol under the cursor
|
||||||
|
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
|
||||||
|
|
||||||
|
-- Selects a code action available at the current cursor position
|
||||||
|
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
|
||||||
|
|
||||||
|
-- Show diagnostics in a floating window
|
||||||
|
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
|
||||||
|
|
||||||
|
-- Move to the previous diagnostic
|
||||||
|
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
|
||||||
|
|
||||||
|
-- Move to the next diagnostic
|
||||||
|
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
|
||||||
|
end
|
||||||
|
})
|
||||||
82
vim/.config/nvim/lua/user/luasnip.lua
Normal file
82
vim/.config/nvim/lua/user/luasnip.lua
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
local ls = require("luasnip")
|
||||||
|
|
||||||
|
local fmt = require('luasnip.extras.fmt')
|
||||||
|
local rep = require('luasnip.extras').rep
|
||||||
|
|
||||||
|
-- some shorthands...
|
||||||
|
-- Taken from video/guide. Honestly I don't like these should probably work on learning their names
|
||||||
|
local s = ls.snippet
|
||||||
|
local sn = ls.snippet_node
|
||||||
|
local t = ls.text_node
|
||||||
|
local i = ls.insert_node
|
||||||
|
local f = ls.function_node
|
||||||
|
local c = ls.choice_node
|
||||||
|
local d = ls.dynamic_node
|
||||||
|
local r = ls.restore_node
|
||||||
|
local l = require("luasnip.extras").lambda
|
||||||
|
local rep = require("luasnip.extras").rep
|
||||||
|
local p = require("luasnip.extras").partial
|
||||||
|
local m = require("luasnip.extras").match
|
||||||
|
local n = require("luasnip.extras").nonempty
|
||||||
|
local dl = require("luasnip.extras").dynamic_lambda
|
||||||
|
local fmt = require("luasnip.extras.fmt").fmt
|
||||||
|
local fmta = require("luasnip.extras.fmt").fmta
|
||||||
|
local types = require("luasnip.util.types")
|
||||||
|
local conds = require("luasnip.extras.conditions")
|
||||||
|
local conds_expand = require("luasnip.extras.conditions.expand")
|
||||||
|
|
||||||
|
ls.config.set_config {
|
||||||
|
history = true,
|
||||||
|
|
||||||
|
-- This allows dynamic snippets to update as you type
|
||||||
|
updateevents = "TextChanged,TextChangedI"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Expand if expandable, or jump forward if jumpable
|
||||||
|
-- If neither, do nothing queitly
|
||||||
|
vim.keymap.set({ "i", "s" }, "<C-K>", function()
|
||||||
|
if ls.expand_or_jumpable() then
|
||||||
|
ls.expand_or_jump()
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
-- end, { silent = true })
|
||||||
|
|
||||||
|
-- Jump backwards to the previous jumpable point
|
||||||
|
vim.keymap.set({ "i", "s" }, "<C-J>", function()
|
||||||
|
if ls.jumpable(-1) then
|
||||||
|
ls.jump(-1)
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
-- Selecting from a list of options in a choice node
|
||||||
|
vim.keymap.set({ "i" }, "<C-L>", function()
|
||||||
|
if ls.choice_active() then
|
||||||
|
ls.change_choice(1)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Allow us to hot reload snippets
|
||||||
|
vim.keymap.set("n", "<leader><leader>s", "<cmd>source ~/.config/nvim/lua/user/luasnip.lua<CR>")
|
||||||
|
|
||||||
|
ls.add_snippets('lua', {
|
||||||
|
ls.parser.parse_snippet("expand", "-- this is what was expanded!"),
|
||||||
|
ls.parser.parse_snippet("lf", "local $1 = function($2)\n $0\nend"),
|
||||||
|
ls.parser.parse_snippet("mf", "$1.$2 = function($3)\n $0\nend"),
|
||||||
|
-- Example from snippet writing guide: https://github.com/L3MON4D3/LuaSnip/blob/master/Examples/snippets.lua#L190
|
||||||
|
s(
|
||||||
|
"fmt1",
|
||||||
|
fmt("To {title} {} {}.", {
|
||||||
|
i(2, "Name"),
|
||||||
|
i(3, "Surname"),
|
||||||
|
title = c(1, { t("Mr."), t("Ms.") }),
|
||||||
|
})
|
||||||
|
),
|
||||||
|
-- Example from video: https://www.youtube.com/watch?v=Dn800rlPIho
|
||||||
|
s(
|
||||||
|
"req",
|
||||||
|
fmt("local {} = require('{}')", {
|
||||||
|
i(1, "default"),
|
||||||
|
rep(1)
|
||||||
|
})
|
||||||
|
),
|
||||||
|
})
|
||||||
Submodule vim/.vim/bundle/ale updated: fdadaed2ba...6fd9f3c54f
Submodule vim/.vim/bundle/commentary updated: 627308e306...f67e3e67ea
Submodule vim/.vim/bundle/eunuch updated: 7a48f9ff0e...8fb3904be2
Submodule vim/.vim/bundle/filetype-nix updated: 63b47b39c8...048c71f1ed
Submodule vim/.vim/bundle/fugitive updated: 2064312ad7...011cf4fcb9
Submodule vim/.vim/bundle/pathogen updated: e0a3efbda5...ac4dd9494f
Submodule vim/.vim/bundle/sleuth updated: 228e51160c...1cc4557420
Submodule vim/.vim/bundle/slime updated: a81139239d...1feef68f23
Submodule vim/.vim/bundle/supertab updated: 40fe711e08...f0093ae12a
Submodule vim/.vim/bundle/tagbar updated: 56399f446c...12edcb5944
Submodule vim/.vim/bundle/vim-terraform updated: f0b17ac9f1...21f756b933
Submodule vim/.vim/bundle/vinegar updated: fcce70f140...bb1bcddf43
@@ -53,7 +53,7 @@ exe "let s:bg_white = ' ctermbg=".s:white"'"
|
|||||||
exe "let s:fg_none = ' ctermfg=NONE'"
|
exe "let s:fg_none = ' ctermfg=NONE'"
|
||||||
exe "let s:fg_default = ' ctermfg=".s:foreground"'"
|
exe "let s:fg_default = ' ctermfg=".s:foreground"'"
|
||||||
exe "let s:fg_black = ' ctermfg=".s:black"'"
|
exe "let s:fg_black = ' ctermfg=".s:black"'"
|
||||||
exe "let s:fg_red = ' ctermfg=".s:red"'"
|
exe "let s:fg_red = ' ctermfg=".s:bright_red"'"
|
||||||
exe "let s:fg_green = ' ctermfg=".s:green"'"
|
exe "let s:fg_green = ' ctermfg=".s:green"'"
|
||||||
exe "let s:fg_yellow = ' ctermfg=".s:yellow"'"
|
exe "let s:fg_yellow = ' ctermfg=".s:yellow"'"
|
||||||
exe "let s:fg_blue = ' ctermfg=".s:blue"'"
|
exe "let s:fg_blue = ' ctermfg=".s:blue"'"
|
||||||
@@ -135,20 +135,20 @@ exe "hi! Todo" .s:fmt_bold .s:fg_magenta.s:bg_none
|
|||||||
" *Todo anything that needs extra attention; mostly the
|
" *Todo anything that needs extra attention; mostly the
|
||||||
" keywords TODO FIXME and XXX
|
" keywords TODO FIXME and XXX
|
||||||
|
|
||||||
exe "hi! StatusLine" .s:fg_dark_grey .s:bg_bright_red
|
exe "hi! StatusLine" .s:fg_blue .s:bg_none
|
||||||
exe "hi! StatusLineNC" .s:fg_dark_grey .s:bg_bright_magenta
|
exe "hi! StatusLineNC" .s:fg_blue .s:bg_none
|
||||||
|
|
||||||
exe "hi! LineNr" .s:fg_dark_grey .s:bg_none
|
exe "hi! LineNr" .s:fg_dark_grey .s:bg_none
|
||||||
exe "hi! CursorLineNr" .s:fg_bright_magenta .s:bg_none
|
exe "hi! CursorLineNr" .s:fg_bright_magenta .s:bg_none
|
||||||
|
|
||||||
exe "hi! TabLine" .s:fmt_none .s:fg_bright_red .s:bg_dark_grey
|
exe "hi! TabLine" .s:fmt_none .s:fg_black .s:bg_blue
|
||||||
exe "hi! TabLineSel" .s:fmt_none .s:fg_bright_magenta .s:bg_dark_grey
|
exe "hi! TabLineSel" .s:fmt_bold .s:fg_black .s:bg_cyan
|
||||||
exe "hi! TabLineFill" .s:fmt_none .s:fg_none .s:bg_dark_grey
|
exe "hi! TabLineFill" .s:fmt_none .s:fg_none .s:bg_bright_blue
|
||||||
|
|
||||||
exe "hi! CursorLine" .s:fmt_none .s:bg_dark_grey
|
exe "hi! CursorLine" .s:fmt_none .s:bg_blue
|
||||||
exe "hi! CursorColumn" .s:fmt_none .s:bg_dark_grey
|
exe "hi! CursorColumn" .s:fmt_none .s:bg_blue
|
||||||
|
|
||||||
exe "hi! VertSplit" .s:fg_dark_grey .s:bg_dark_grey
|
exe "hi! VertSplit" .s:fg_blue .s:bg_blue
|
||||||
|
|
||||||
"if &background == "light"
|
"if &background == "light"
|
||||||
" highlight Normal ctermfg=0 ctermbg=15
|
" highlight Normal ctermfg=0 ctermbg=15
|
||||||
|
|||||||
1
vim/.vim/nvim-bundle/LuaSnip
Submodule
1
vim/.vim/nvim-bundle/LuaSnip
Submodule
Submodule vim/.vim/nvim-bundle/LuaSnip added at 8ae1dedd98
1
vim/.vim/nvim-bundle/indent-blankline
Submodule
1
vim/.vim/nvim-bundle/indent-blankline
Submodule
Submodule vim/.vim/nvim-bundle/indent-blankline added at 12e92044d3
1
vim/.vim/nvim-bundle/nvim-lspconfig
Submodule
1
vim/.vim/nvim-bundle/nvim-lspconfig
Submodule
Submodule vim/.vim/nvim-bundle/nvim-lspconfig added at cf3dd4a290
1
vim/.vim/nvim-bundle/plenary
Submodule
1
vim/.vim/nvim-bundle/plenary
Submodule
Submodule vim/.vim/nvim-bundle/plenary added at 50012918b2
1
vim/.vim/nvim-bundle/telescope
Submodule
1
vim/.vim/nvim-bundle/telescope
Submodule
Submodule vim/.vim/nvim-bundle/telescope added at d90956833d
11
vim/.vimrc
11
vim/.vimrc
@@ -6,7 +6,7 @@ set nocompatible
|
|||||||
"{- PLUGIN MANAGER -}"
|
"{- PLUGIN MANAGER -}"
|
||||||
" Load pathogen, the plugin manager, which then loads all plugins "
|
" Load pathogen, the plugin manager, which then loads all plugins "
|
||||||
runtime bundle/pathogen/autoload/pathogen.vim
|
runtime bundle/pathogen/autoload/pathogen.vim
|
||||||
execute pathogen#infect()
|
execute pathogen#infect('bundle/{}', 'nvim-bundle/{}')
|
||||||
|
|
||||||
"{- COMMANDS -}"
|
"{- COMMANDS -}"
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ set nocompatible
|
|||||||
"{- INTERFACE -}"
|
"{- INTERFACE -}"
|
||||||
|
|
||||||
" Colors and syntax highlighting "
|
" Colors and syntax highlighting "
|
||||||
colorscheme dim
|
colorscheme halfdab
|
||||||
set background=dark
|
set background=dark
|
||||||
filetype plugin on
|
filetype plugin on
|
||||||
syntax on
|
syntax on
|
||||||
@@ -103,7 +103,8 @@ set nocompatible
|
|||||||
set complete+=kspell
|
set complete+=kspell
|
||||||
|
|
||||||
" Match the longest completion option then display menu
|
" Match the longest completion option then display menu
|
||||||
set completeopt=menuone,longest
|
"set completeopt=menuone,longest
|
||||||
|
set completeopt=menu,menuone,noselect
|
||||||
|
|
||||||
" Use UTF-8 "
|
" Use UTF-8 "
|
||||||
set encoding=utf-8
|
set encoding=utf-8
|
||||||
@@ -118,7 +119,11 @@ set nocompatible
|
|||||||
set spelllang=en_us,cjk
|
set spelllang=en_us,cjk
|
||||||
|
|
||||||
" Store the viminfo file in the .vim directory "
|
" Store the viminfo file in the .vim directory "
|
||||||
|
if !has('nvim')
|
||||||
set viminfo+=n$HOME/.vim/.viminfo
|
set viminfo+=n$HOME/.vim/.viminfo
|
||||||
|
else
|
||||||
|
set viminfo+=n$HOME/.vim/.shada
|
||||||
|
endif
|
||||||
|
|
||||||
" Don't use a pager "
|
" Don't use a pager "
|
||||||
set nomore
|
set nomore
|
||||||
|
|||||||
Reference in New Issue
Block a user