Merge branch 'master' of git.blakenorth.net/home/git/dotfiles
This commit is contained in:
commit
581f5255a6
7 changed files with 256 additions and 48 deletions
|
@ -49,6 +49,7 @@ M.treesitter = function()
|
||||||
"rust",
|
"rust",
|
||||||
"toml",
|
"toml",
|
||||||
"vim",
|
"vim",
|
||||||
|
"yaml",
|
||||||
},
|
},
|
||||||
--ignore_install = { "javascript", "java" }, -- List of parsers to ignore installing
|
--ignore_install = { "javascript", "java" }, -- List of parsers to ignore installing
|
||||||
highlight = {
|
highlight = {
|
||||||
|
@ -107,8 +108,12 @@ M.cmp = function()
|
||||||
-- nvim-cmp supports additional completion capabilities
|
-- nvim-cmp supports additional completion capabilities
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||||
-- nvim-cmp setup
|
-- If you want insert `(` after select function or method item
|
||||||
local cmp = require 'cmp'
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
local cmp = require('cmp')
|
||||||
|
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
||||||
|
-- add a lisp filetype (wrap my-function), FYI: Hardcoded = { "clojure", "clojurescript", "fennel", "janet" }
|
||||||
|
cmp_autopairs.lisp[#cmp_autopairs.lisp+1] = "racket" -- nvim-cmp setup
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
mapping = {
|
mapping = {
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
@ -158,11 +163,9 @@ M.cmp = function()
|
||||||
}),
|
}),
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(':', {
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'path' }
|
{ name = 'path' },
|
||||||
},
|
|
||||||
{
|
|
||||||
{ name = 'cmdline' }
|
{ name = 'cmdline' }
|
||||||
})
|
}),
|
||||||
}),
|
}),
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
|
@ -182,6 +185,9 @@ M.cmp = function()
|
||||||
return vim_item
|
return vim_item
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
end -- <<<
|
end -- <<<
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,64 @@ M.neoscroll = function()
|
||||||
end
|
end
|
||||||
-- <<<
|
-- <<<
|
||||||
|
|
||||||
|
-- indent_blankline >>>
|
||||||
|
M.indent_blankline = function()
|
||||||
|
vim.cmd [[
|
||||||
|
let g:indent_blankline_show_first_indent_level = v:true
|
||||||
|
let g:indent_blankline_show_foldtext = v:false
|
||||||
|
let g:indent_blankline_buftype_exclude = ['terminal']
|
||||||
|
let g:indent_blankline_use_treesitter = v:true
|
||||||
|
let g:indent_blankline_show_current_context = v:true
|
||||||
|
]]
|
||||||
|
require("indent_blankline").setup {
|
||||||
|
-- for example, context is off by default, use this to turn it on
|
||||||
|
show_current_context = true,
|
||||||
|
show_current_context_start = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
-- <<<
|
||||||
|
|
||||||
|
-- ZenMode >>>
|
||||||
|
M.zenmode = function()
|
||||||
|
-- map :ZM to :ZenMode
|
||||||
|
vim.cmd 'command! ZM ZenMode'
|
||||||
|
require("zen-mode").setup {
|
||||||
|
window = {
|
||||||
|
backdrop = 1, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
|
||||||
|
-- height and width can be:
|
||||||
|
-- * an absolute number of cells when > 1
|
||||||
|
-- * a percentage of the width / height of the editor when <= 1
|
||||||
|
-- * a function that returns the width or the height
|
||||||
|
width = 120, -- width of the Zen window
|
||||||
|
height = 51-2, -- height of the Zen window
|
||||||
|
-- by default, no options are changed for the Zen window
|
||||||
|
-- uncomment any of the options below, or add other vim.wo options you want to apply
|
||||||
|
options = { -- uncomment to do what the sign says
|
||||||
|
-- signcolumn = "no", -- signcolumn
|
||||||
|
number = false, -- number column
|
||||||
|
-- relativenumber = false, -- relative numbers
|
||||||
|
-- cursorline = false, -- cursorline
|
||||||
|
cursorcolumn = false, -- cursor column
|
||||||
|
-- foldcolumn = "0", -- fold column
|
||||||
|
-- list = false, -- whitespace characters
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins = {
|
||||||
|
-- disable some global vim options (vim.o...)
|
||||||
|
-- comment the lines to not apply the options
|
||||||
|
options = {
|
||||||
|
enabled = true,
|
||||||
|
ruler = false, -- disables the ruler text in the cmd line area
|
||||||
|
showcmd = false, -- disables the command in the last line of the screen
|
||||||
|
},
|
||||||
|
twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
|
||||||
|
gitsigns = { enabled = true }, -- disables git signs
|
||||||
|
tmux = { enabled = false }, -- disables the tmux statusline
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
-- <<<
|
||||||
|
|
||||||
-- Autosession >>>
|
-- Autosession >>>
|
||||||
M.autosession = function()
|
M.autosession = function()
|
||||||
local opts = {
|
local opts = {
|
||||||
|
|
|
@ -206,8 +206,7 @@ return require('packer').startup({function()
|
||||||
use { -- Zen mode (:ZenMode or :ZM)
|
use { -- Zen mode (:ZenMode or :ZM)
|
||||||
"folke/zen-mode.nvim",
|
"folke/zen-mode.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd 'command! ZM ZenMode'
|
require('blake.other').zenmode()
|
||||||
require("zen-mode").setup()
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
use { -- dim text outside paragraph or function
|
use { -- dim text outside paragraph or function
|
||||||
|
@ -224,19 +223,14 @@ return require('packer').startup({function()
|
||||||
-- 'ggandor/lightspeed.nvim',
|
-- 'ggandor/lightspeed.nvim',
|
||||||
-- }
|
-- }
|
||||||
use { -- indentline: Line indent indicators
|
use { -- indentline: Line indent indicators
|
||||||
'Yggdroot/indentLine',
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd [[
|
require('blake.other').indent_blankline()
|
||||||
let g:indentLine_char = '▏'
|
|
||||||
let g:indentLine_conceallevel = 1
|
|
||||||
let g:indentLine_fileTypeExclude = ['markdown', 'help', 'packer']
|
|
||||||
autocmd TermOpen * IndentLinesDisable
|
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
use { -- targets.vim: fix ci' and other things to work right
|
-- use { -- targets.vim: fix ci' and other things to work right
|
||||||
'wellle/targets.vim',
|
-- 'wellle/targets.vim',
|
||||||
}
|
-- }
|
||||||
|
|
||||||
-- Conveniences
|
-- Conveniences
|
||||||
use { -- Ghost: Web browser integration
|
use { -- Ghost: Web browser integration
|
||||||
|
@ -271,6 +265,9 @@ return require('packer').startup({function()
|
||||||
require('nvim-autopairs').setup()
|
require('nvim-autopairs').setup()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
use { -- accelerated jk movement
|
||||||
|
'rhysd/accelerated-jk'
|
||||||
|
}
|
||||||
use { -- Alignment
|
use { -- Alignment
|
||||||
'junegunn/vim-easy-align',
|
'junegunn/vim-easy-align',
|
||||||
}
|
}
|
||||||
|
@ -285,10 +282,8 @@ return require('packer').startup({function()
|
||||||
-- Only calculate commentstring for tsx filetypes
|
-- Only calculate commentstring for tsx filetypes
|
||||||
if vim.bo.filetype == 'typescriptreact' then
|
if vim.bo.filetype == 'typescriptreact' then
|
||||||
local U = require('Comment.utils')
|
local U = require('Comment.utils')
|
||||||
|
|
||||||
-- Detemine whether to use linewise or blockwise commentstring
|
-- Detemine whether to use linewise or blockwise commentstring
|
||||||
local type = ctx.ctype == U.ctype.line and '__default' or '__multiline'
|
local type = ctx.ctype == U.ctype.line and '__default' or '__multiline'
|
||||||
|
|
||||||
-- Determine the location where to calculate commentstring from
|
-- Determine the location where to calculate commentstring from
|
||||||
local location = nil
|
local location = nil
|
||||||
if ctx.ctype == U.ctype.block then
|
if ctx.ctype == U.ctype.block then
|
||||||
|
@ -296,7 +291,6 @@ return require('packer').startup({function()
|
||||||
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
||||||
location = require('ts_context_commentstring.utils').get_visual_start_location()
|
location = require('ts_context_commentstring.utils').get_visual_start_location()
|
||||||
end
|
end
|
||||||
|
|
||||||
return require('ts_context_commentstring.internal').calculate_commentstring({
|
return require('ts_context_commentstring.internal').calculate_commentstring({
|
||||||
key = type,
|
key = type,
|
||||||
location = location,
|
location = location,
|
||||||
|
@ -306,6 +300,12 @@ return require('packer').startup({function()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
use { -- rhysd: committia: better commit editing window
|
||||||
|
'rhysd/committia.vim',
|
||||||
|
}
|
||||||
|
use { -- rhysd: conflict-marker: mark git conflicts - [x ]x
|
||||||
|
'rhysd/conflict-marker.vim',
|
||||||
|
}
|
||||||
-- use { -- lewis6991: spellsitter: Spell checking in treesitter files
|
-- use { -- lewis6991: spellsitter: Spell checking in treesitter files
|
||||||
-- 'lewis6991/spellsitter.nvim',
|
-- 'lewis6991/spellsitter.nvim',
|
||||||
-- config = function()
|
-- config = function()
|
||||||
|
|
|
@ -38,7 +38,8 @@ set.showcmd = true
|
||||||
set.signcolumn = 'yes'
|
set.signcolumn = 'yes'
|
||||||
set.makeprg = 'make -j$(nproc)'
|
set.makeprg = 'make -j$(nproc)'
|
||||||
set.ruler = false
|
set.ruler = false
|
||||||
set.listchars = "eol:↴,trail:~,tab:'»',nbsp:␣,space:·"
|
set.listchars = "trail:~,tab:│ ,nbsp:␣,lead:·,extends:…,precedes:…"
|
||||||
|
set.list = false
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
--- Key bindings (needs to be translated?) ---
|
--- Key bindings (needs to be translated?) ---
|
||||||
|
|
122
.config/shell/bin/ned
Executable file
122
.config/shell/bin/ned
Executable file
|
@ -0,0 +1,122 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# NEd: Note Editor (and your best friend!)
|
||||||
|
# Ned can edit and create notes in a folder you tell him to!
|
||||||
|
# Depends: fzf
|
||||||
|
|
||||||
|
# shellcheck disable=SC2068,SC2178,SC2128
|
||||||
|
|
||||||
|
# set default values if things are unset
|
||||||
|
NOTES_DIR="${NOTES_DIR:-"$HOME/Documents/college/current"}"
|
||||||
|
EDITOR="nvim"
|
||||||
|
EDITOR_CMD="nvim -c :ZenMode"
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<-EOF
|
||||||
|
Usage:
|
||||||
|
ned <verb>
|
||||||
|
new <folder> [note name] create a new note in the matched class folder
|
||||||
|
edit [folder] search for and edit a text document in a folder
|
||||||
|
help print this message
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
Right now, only the first letter of each option is considered, so \`ned n\` and \`ned neww\` do the same thing
|
||||||
|
Folder and file names are globbed
|
||||||
|
Will automatically activate the ZenMode nvim extension
|
||||||
|
Current repository path: $NOTES_DIR
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
edit() {
|
||||||
|
check_setup
|
||||||
|
|
||||||
|
NOTE_PATH="$(fd -at f "$2" "$NOTES_DIR")"
|
||||||
|
# if there was more than one result
|
||||||
|
if [ "$(echo "$NOTE_PATH" | wc -l)" -gt 1 ]; then
|
||||||
|
NOTE_PATH="$(echo "$NOTE_PATH" | fzy)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$EDITOR_CMD "$NOTE_PATH"
|
||||||
|
}
|
||||||
|
|
||||||
|
new() {
|
||||||
|
check_setup
|
||||||
|
|
||||||
|
# Find out note name
|
||||||
|
if [ -z "$3" ]; then
|
||||||
|
NOTE_NAME="$(date +'%F').md"
|
||||||
|
else
|
||||||
|
NOTE_NAME="$3.md"
|
||||||
|
fi
|
||||||
|
|
||||||
|
NOTE_PATH="$(fd -ad 1 "^$2" "$NOTES_DIR")"
|
||||||
|
# check if there were no results
|
||||||
|
if [ -z "$NOTE_PATH" ]; then
|
||||||
|
echo "No directories found for '$2'."
|
||||||
|
echo "All possible directories:"
|
||||||
|
(cd "$NOTES_DIR" && fd -d 1 -t d "$NOTES_DIR")
|
||||||
|
exit
|
||||||
|
|
||||||
|
# if there was more than one result
|
||||||
|
elif [ "$(echo "$NOTE_PATH" | wc -l)" -gt 1 ]; then
|
||||||
|
NOTE_PATH="$(echo "$NOTE_PATH" | fzy)" || exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: allow setting location for files to go with $3, and $4 for file name
|
||||||
|
# check if there is a notes directory in the note path
|
||||||
|
if [ -d "$NOTE_PATH/notes" ]; then
|
||||||
|
NOTE_PATH="$NOTE_PATH/notes"
|
||||||
|
|
||||||
|
# if there is no notes directory
|
||||||
|
else
|
||||||
|
PROMPT="Place note in… "
|
||||||
|
NOTE_PATH="$(cd "$NOTE_PATH" && fd -ad 1 -t d | fzy -p "$PROMPT")" || exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$NOTE_PATH/$NOTE_NAME" ]; then
|
||||||
|
echo "File already exists. Opening..."
|
||||||
|
$EDITOR_CMD "$NOTE_PATH/$NOTE_NAME"
|
||||||
|
else
|
||||||
|
cd "$NOTE_PATH" || exit
|
||||||
|
# apply a template for notes
|
||||||
|
cat <<-EOF >> "$NOTE_PATH/$NOTE_NAME"
|
||||||
|
|
||||||
|
<!-- vim: wrap nonu nornu
|
||||||
|
-->
|
||||||
|
EOF
|
||||||
|
$EDITOR_CMD "$NOTE_PATH/$NOTE_NAME"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
subshell() {
|
||||||
|
echo 'entering subshell'
|
||||||
|
$SHELL
|
||||||
|
}
|
||||||
|
|
||||||
|
shell() {
|
||||||
|
cd "$NOTES_DIR" && subshell
|
||||||
|
}
|
||||||
|
|
||||||
|
check_setup() {
|
||||||
|
# perform preliminary checks to make sure the script can run properly
|
||||||
|
if ! [ -d "$NOTES_DIR" ]; then
|
||||||
|
echo "Error: Notes directory ($NOTES_DIR) does not exist or is not a directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse arguments (first character only)
|
||||||
|
case "${1:0:1}" in
|
||||||
|
# help
|
||||||
|
'h') usage;;
|
||||||
|
# create and edit new note
|
||||||
|
'n') new $@;;
|
||||||
|
# edit an existing document or file
|
||||||
|
'e') edit $@;;
|
||||||
|
# run a shell (cd to) in the directory
|
||||||
|
'c'|'x'|'s') shell;;
|
||||||
|
# me: edit ned (the file you are looking at)
|
||||||
|
'm') $EDITOR "$(realpath "$0")";;
|
||||||
|
*) echo "no such option";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# vim: et sw=3 ts=3 ft=bash
|
21
.config/shell/bin/sced
Executable file
21
.config/shell/bin/sced
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# sced (script edit) edit a script or function that's somewhere inside the shell configuration
|
||||||
|
# Usage: bined <script name>
|
||||||
|
# Depends: fd
|
||||||
|
|
||||||
|
# start in the directory above the script
|
||||||
|
cd "$(dirname "$(realpath "$0")")"/.. || exit 1
|
||||||
|
|
||||||
|
# get the path to the file if there was an argument
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
FILE="$(fd --exact-depth 2 --max-results=1 -at f "$1")"
|
||||||
|
if [ "$FILE" = '' ]; then
|
||||||
|
FILE="$(dirname "$(realpath "$0")")/../$1"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# edit >this< script by default
|
||||||
|
FILE="$(realpath "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# edit the file
|
||||||
|
"${EDITOR:-$(which nvim)}" "${FILE:-$(realpath "$0")}"
|
|
@ -263,7 +263,7 @@
|
||||||
# directory will be shortened only when prompt doesn't fit or when other parameters demand it
|
# directory will be shortened only when prompt doesn't fit or when other parameters demand it
|
||||||
# (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below).
|
# (see POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT below).
|
||||||
# If set to `0`, directory will always be shortened to its minimum length.
|
# If set to `0`, directory will always be shortened to its minimum length.
|
||||||
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=80
|
typeset -g POWERLEVEL9K_DIR_MAX_LENGTH=70
|
||||||
# When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this
|
# When `dir` segment is on the last prompt line, try to shorten it enough to leave at least this
|
||||||
# many columns for typing commands.
|
# many columns for typing commands.
|
||||||
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
|
typeset -g POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS=40
|
||||||
|
|
Loading…
Add table
Reference in a new issue