initial commit - lf and nvim

This commit is contained in:
tjp 2023-11-11 18:58:28 -07:00
commit 7bf84c0890
22 changed files with 1069 additions and 0 deletions

24
LICENSE.txt Normal file
View File

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

3
lf/bat-preview Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/local/bin/bat -p --color always "$1"

359
lf/icons Normal file
View File

@ -0,0 +1,359 @@
# vim:ft=conf
# These examples require Nerd Fonts or a compatible font to be used.
# See https://www.nerdfonts.com for more information.
# default values from lf (with matching order)
# ln l # LINK
# or l # ORPHAN
# tw t # STICKY_OTHER_WRITABLE
# ow d # OTHER_WRITABLE
# st t # STICKY
# di d # DIR
# pi p # FIFO
# so s # SOCK
# bd b # BLK
# cd c # CHR
# su u # SETUID
# sg g # SETGID
# ex x # EXEC
# fi - # FILE
# file types (with matching order)
ln  # LINK
or  # ORPHAN
tw  # STICKY_OTHER_WRITABLE
ow  # OTHER_WRITABLE
st  # STICKY
di  # DIR
pi 󰟥 # FIFO
so 󰐧 # SOCK
bd 󱊟 # BLK
cd 󱊟 # CHR
su  # SETUID
sg 󰭘 # SETGID
ex  # EXEC
fi  # FILE
# file extensions (vim-devicons)
*.styl 
*.sass 
*.scss 
*.htm 
*.html 
*.slim 
*.haml 
*.ejs 
*.css 
*.less 
*.md 
*.mdx 
*.markdown 
*.rmd 
*.json 
*.webmanifest 
*.js 
*.mjs 
*.jsx 
*.rb 
*.gemspec 
*.rake 
*.php 
*.py 
*.pyc 
*.pyo 
*.pyd 
*.coffee 
*.mustache 
*.hbs 
*.conf 
*.ini 
*.yml 
*.yaml 
*.toml 
*.bat 
*.mk 
*.jpg 
*.jpeg 
*.bmp 
*.png 
*.webp 
*.gif 
*.ico 
*.twig 
*.cpp 
*.c++ 
*.cxx 
*.cc 
*.cp 
*.c 
*.cs 󰌛
*.h 
*.hh 
*.hpp 
*.hxx 
*.hs 
*.lhs 
*.nix 
*.lua 
*.java 
*.sh 
*.fish 
*.bash 
*.zsh 
*.ksh 
*.csh 
*.awk 
*.ps1 
*.ml λ
*.mli λ
*.diff 
*.db 
*.sql 
*.dump 
*.clj 
*.cljc 
*.cljs 
*.edn 
*.scala 
*.go 
*.dart 
*.xul 
*.sln 
*.suo 
*.pl 
*.pm 
*.t 
*.rss 
'*.f#' 
*.fsscript 
*.fsx 
*.fs 
*.fsi 
*.rs 
*.rlib 
*.d 
*.erl 
*.hrl 
*.ex 
*.exs 
*.eex 
*.leex 
*.heex 
*.vim 
*.ai 
*.psd 
*.psb 
*.ts 
*.tsx 
*.jl 
*.pp 
*.vue 
*.elm 
*.swift 
*.xcplayground 
*.tex 󰙩
*.r 󰟔
*.rproj 󰗆
*.sol 󰡪
*.pem 
# file names (vim-devicons) (case-insensitive not supported in lf)
*go.mod 
*go.sum 
*gruntfile.coffee 
*gruntfile.js 
*gruntfile.ls 
*gulpfile.coffee 
*gulpfile.js 
*gulpfile.ls 
*mix.lock 
*dropbox 
*.ds_store 
*.gitconfig 
*.gitignore 
*.gitattributes 
*.gitlab-ci.yml 
*.bashrc 
*.zshrc 
*.zshenv 
*.zprofile 
*.vimrc 
*.gvimrc 
*_vimrc 
*_gvimrc 
*.bashprofile 
*favicon.ico 
*license 
*node_modules 
*react.jsx 
*procfile 
*dockerfile 
*docker-compose.yml 
*rakefile 
*config.ru 
*gemfile 
*makefile 
*cmakelists.txt 
*robots.txt 󰚩
# file names (case-sensitive adaptations)
*Gruntfile.coffee 
*Gruntfile.js 
*Gruntfile.ls 
*Gulpfile.coffee 
*Gulpfile.js 
*Gulpfile.ls 
*Dropbox 
*.DS_Store 
*LICENSE 
*React.jsx 
*Procfile 
*Dockerfile 
*Docker-compose.yml 
*Rakefile 
*Gemfile 
*Makefile 
*CMakeLists.txt 
# file patterns (vim-devicons) (patterns not supported in lf)
# .*jquery.*\.js$ 
# .*angular.*\.js$ 
# .*backbone.*\.js$ 
# .*require.*\.js$ 
# .*materialize.*\.js$ 
# .*materialize.*\.css$ 
# .*mootools.*\.js$ 
# .*vimrc.* 
# Vagrantfile$ 
# file patterns (file name adaptations)
*jquery.min.js 
*angular.min.js 
*backbone.min.js 
*require.min.js 
*materialize.min.js 
*materialize.min.css 
*mootools.min.js 
*vimrc 
Vagrantfile 
# archives or compressed (extensions from dircolors defaults)
*.tar 
*.tgz 
*.arc 
*.arj 
*.taz 
*.lha 
*.lz4 
*.lzh 
*.lzma 
*.tlz 
*.txz 
*.tzo 
*.t7z 
*.zip 
*.z 
*.dz 
*.gz 
*.lrz 
*.lz 
*.lzo 
*.xz 
*.zst 
*.tzst 
*.bz2 
*.bz 
*.tbz 
*.tbz2 
*.tz 
*.deb 
*.rpm 
*.jar 
*.war 
*.ear 
*.sar 
*.rar 
*.alz 
*.ace 
*.zoo 
*.cpio 
*.7z 
*.rz 
*.cab 
*.wim 
*.swm 
*.dwm 
*.esd 
# image formats (extensions from dircolors defaults)
*.jpg 
*.jpeg 
*.mjpg 
*.mjpeg 
*.gif 
*.bmp 
*.pbm 
*.pgm 
*.ppm 
*.tga 
*.xbm 
*.xpm 
*.tif 
*.tiff 
*.png 
*.svg 
*.svgz 
*.mng 
*.pcx 
*.mov 
*.mpg 
*.mpeg 
*.m2v 
*.mkv 
*.webm 
*.ogm 
*.mp4 
*.m4v 
*.mp4v 
*.vob 
*.qt 
*.nuv 
*.wmv 
*.asf 
*.rm 
*.rmvb 
*.flc 
*.avi 
*.fli 
*.flv 
*.gl 
*.dl 
*.xcf 
*.xwd 
*.yuv 
*.cgm 
*.emf 
*.ogv 
*.ogx 
# audio formats (extensions from dircolors defaults)
*.aac 
*.au 
*.flac 
*.m4a 
*.mid 
*.midi 
*.mka 
*.mp3 
*.mpc 
*.ogg 
*.ra 
*.wav 
*.oga 
*.opus 
*.spx 
*.xspf 
# other formats
*.pdf 

113
lf/lfrc Normal file
View File

@ -0,0 +1,113 @@
# interpreter for shell commands
set shell sh
set icons true
# set '-eu' options for shell commands
# These options are used to have safer shell commands. Option '-e' is used to
# exit on error and option '-u' is used to give error for unset variables.
# Option '-f' disables pathname expansion which can be useful when $f, $fs, and
# $fx variables contain names with '*' or '?' characters. However, this option
# is used selectively within individual commands as it can be limiting at
# times.
set shellopts '-eu'
# set internal field separator (IFS) to "\n" for shell commands
# This is useful to automatically split file names in $fs and $fx properly
# since default file separator used in these variables (i.e. 'filesep' option)
# is newline. You need to consider the values of these options and create your
# commands accordingly.
set ifs "\n"
# leave some space at the top and the bottom of the screen
set scrolloff 10
# use a `bat` wrapper script as the previewer
set previewer ~/.config/lf/bat-preview
# Use the `dim` attribute instead of underline for the cursor in the preview pane
set cursorpreviewfmt "\033[7;2m"
# use enter for shell commands
map <enter> shell
# show the result of execution of previous commands
map ` !true
# execute current file (must be executable)
map x $$f
map X !$f
# dedicated keys for file opener actions
map o &mimeopen $f
map O $mimeopen --ask $f
# define a custom 'open' command
# This command is called when current file is not a directory. You may want to
# use either file extensions and/or mime types here. Below uses an editor for
# text files and a file opener for the rest.
cmd open &{{
case $(file --mime-type -Lb $f) in
text/*) lf -remote "send $id \$$EDITOR \$fx";;
*) for f in $fx; do $OPENER $f > /dev/null 2> /dev/null & done;;
esac
}}
# mkdir command. See wiki if you want it to select created dir
map a :push %mkdir<space>
# define a custom 'rename' command without prompt for overwrite
# cmd rename %[ -e $1 ] && printf "file exists" || mv $f $1
# map r push :rename<space>
# make sure trash folder exists
# %mkdir -p ~/.trash
# move current file or selected files to trash folder
# (also see 'man mv' for backup/overwrite options)
cmd trash %set -f; mv $fx ~/.trash
# define a custom 'delete' command
# cmd delete ${{
# set -f
# printf "$fx\n"
# printf "delete?[y/n]"
# read ans
# [ "$ans" = "y" ] && rm -rf $fx
# }}
# use '<delete>' key for either 'trash' or 'delete' command
# map <delete> trash
# map <delete> delete
# extract the current file with the right command
# (xkcd link: https://xkcd.com/1168/)
cmd extract ${{
set -f
case $f in
*.tar.bz|*.tar.bz2|*.tbz|*.tbz2) tar xjvf $f;;
*.tar.gz|*.tgz) tar xzvf $f;;
*.tar.xz|*.txz) tar xJvf $f;;
*.zip) unzip $f;;
*.rar) unrar x $f;;
*.7z) 7z x $f;;
esac
}}
# compress current file or selected files with tar and gunzip
cmd tar ${{
set -f
mkdir $1
cp -r $fx $1
tar czf $1.tgz $1
rm -rf $1
}}
# compress current file or selected files with zip
cmd zip ${{
set -f
mkdir $1
cp -r $fx $1
zip -r $1.zip $1
rm -rf $1
}}

96
manage Executable file
View File

@ -0,0 +1,96 @@
#!/usr/bin/env bash
# TODO: add colors to the echo statements
set -euo pipefail
HERE="$(cd $(dirname $0); pwd)"
CONF="${XDG_CONFIG_HOME:-$HOME/.config}"
help() {
cat <<EOF
Add or remove symlinks from directories in this repository to
XDG_CONFIG_HOME. With NAME, it will only add or remove the one
directory. Otherwise it loops through all of them.
Usage:
$0 link [ NAME ]
$0 unlink [ NAME ]
$0 help
EOF
}
link() {
if [[ "${1:-}" != "" ]]; then
name="$1"
src="$HERE/$name"
if [[ ! -d $src ]]; then return; fi
echo -n "$name..."
tgt="$CONF/$name"
bu="${tgt}_bu"
if [[ -e $bu ]]; then
echo -n "removing old _bu..."
rm -rf ${bu}
fi
if [[ -e $tgt ]]; then
echo -n "moving existing config to ${name}_bu..."
mv $tgt $bu
fi
echo -n "linking..."
ln -s $src $tgt
echo "LINKED"
else
for path in $HERE/*; do
link $(basename $path)
done
fi
}
unlink() {
if [[ "${1:-}" != "" ]]; then
name="$1"
src="$HERE/$name"
if [[ ! -d $src ]]; then return; fi
echo -n "$name..."
tgt="$CONF/$name"
bu="${tgt}_bu"
if [[ ! -e $tgt ]]; then
echo "WAS NOT LINKED"
return
fi
echo -n "unlinking..."
rm $tgt
if [[ -e $bu ]]; then
echo -n "restoring from ${name}_bu..."
mv $bu $tgt
fi
echo "UNLINKED"
else
for path in $HERE/*; do
unlink $(basename $path)
done
fi
}
case "${1:-}" in
link | unlink | help)
"$@"
;;
*)
help
exit 1
;;
esac

1
nvim/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
lazy-lock.json

1
nvim/ftplugin/norg.lua Normal file
View File

@ -0,0 +1 @@
vim.api.nvim_buf_set_keymap(0, 'i', '<c-l>', '{::}<esc>hi', { desc = 'Insert a file link' })

21
nvim/init.lua Normal file
View File

@ -0,0 +1,21 @@
require 'settings'
require 'keys'
require 'filetypes'
-- lazy.nvim bootstrap
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require ('lazy').setup('plugins')
vim.keymap.set('n', '<leader>L', '<cmd>Lazy<cr>', { desc = 'Open Lazy UI' })

12
nvim/lua/filetypes.lua Normal file
View File

@ -0,0 +1,12 @@
local function on_filetype(ftype, cb)
vim.api.nvim_create_autocmd('FileType', {
pattern = { ftype },
callback = cb,
})
end
on_filetype('html', function() _G.tabs(4) end)
on_filetype('typescript', function() _G.tabs(2) end)
on_filetype('zig', function() _G.spaces(4) end)
on_filetype('lua', function() _G.spaces(2) end)
on_filetype('sh', function() _G.tabs(2) end)

45
nvim/lua/keys.lua Normal file
View File

@ -0,0 +1,45 @@
-- searching improvements
vim.keymap.set('n', '/', '/\\v')
vim.keymap.set('n', '?', '?\\v')
vim.keymap.set('n', '*', function()
vim.api.nvim_exec('/\\v<' .. vim.fn.expand('<cword>') .. '>', false)
end)
vim.keymap.set('n', '#', function()
vim.api.nvim_exec('?\\v<' .. vim.fn.expand('<cword>') .. '>', false)
end)
vim.keymap.set('n', '<leader>n', '<cmd>nohlsearch<cr>', { desc = 'Clear incremental search highlight' })
vim.keymap.set('n', '<leader>e', '<cmd>e!<cr>', { desc = 'Refresh display of the current buffer' })
vim.keymap.set('n', '<leader>g', "<cmd>grep '\\b<cword>\\b'<cr>", { desc = 'Grep for the word under the cursor' })
vim.keymap.set('n', '<leader>x', '<cmd>!chmod a+x %<cr>', { desc = 'Chmod the current file to world-executable' })
--[[ old mapping, not figuring out how to port right now:
" map \ac (apostrophe comma) to wrap a buffer's lines in single quotes and add
" commas to the ends
nnoremap <leader>ac :<c-u>g/^$/d<cr>:%s/^.*$/'\0',/<cr>:nohlsearch<cr>G$xgg0
]]
-- quickfix list
vim.keymap.set('n', '<leader>qo', '<cmd>copen<cr>', { desc = 'Open Quickfix list' })
vim.keymap.set('n', '<leader>qc', '<cmd>cclose<cr>', { desc = 'Close Quickfix list' })
vim.keymap.set('n', '<leader>qn', '<cmd>cnext<cr>', { desc = 'Next Quickfix list item' })
vim.keymap.set('n', '<leader>qp', '<cmd>cprevious<cr>', { desc = 'Previous Quickfix list item' })
-- location list
vim.keymap.set('n', '<leader>lo', '<cmd>lopen<cr>', { desc = 'Open Location list' })
vim.keymap.set('n', '<leader>lc', '<cmd>lclose<cr>', { desc = 'Close Location list' })
vim.keymap.set('n', '<leader>ln', '<cmd>lnext<cr>', { desc = 'Next Location list item' })
vim.keymap.set('n', '<leader>lp', '<cmd>lprevious<cr>', { desc = 'Previous Location list item' })
-- bash terminals
vim.keymap.set('n', '<leader>bb', '<cmd>e term://bash<cr>', { desc = 'Open a bash shell in current window' })
vim.keymap.set('n', '<leader>bt', '<cmd>tabe term://bash<cr>', { desc = 'Open a bash shell in a new tab' })
vim.keymap.set('n', '<leader>bs', '<cmd>split term://bash<cr>', { desc = 'Open a bash shell in a new horizontal split' })
vim.keymap.set('n', '<leader>bv', '<cmd>vsplit term://bash<cr>', { desc = 'Open a bash shell in a new vertical split' })
vim.keymap.set('t', '<c-w>', '<c-\\><c-n>', { desc = 'Escape to normal mode' })
-- find merge conflicts
vim.keymap.set('n', '<leader>d', '/\\v\\<{7}<cr>', { desc = 'Search for diff markings (<<<<<<<)' })
-- open vim config folder
vim.keymap.set('n', '<leader>c', '<cmd>e ~/.config/nvim/lua<cr><cmd>Lf<cr>', { desc = 'Open the vim lua config folder' })

View File

@ -0,0 +1,59 @@
return {
{
'catppuccin/nvim',
name = 'catppuccin',
enabled = false,
config = function()
vim.cmd('colorscheme catppuccin')
end,
},
{
'rebelot/kanagawa.nvim',
--enabled = false,
opts = {
theme = 'wave',
},
config = function(_, opts)
require('kanagawa').setup(opts)
vim.cmd('colorscheme kanagawa')
end,
},
{
'savq/melange-nvim',
enabled = false,
config = function()
vim.cmd('colorscheme melange')
end,
},
{
'dracula/vim',
name = 'dracula',
enabled = false,
config = function()
vim.cmd('colorscheme dracula')
end,
},
{
'folke/tokyonight.nvim',
enabled = false,
opts = {
style = 'moon'
},
config = function(_, opts)
require('tokyonight').setup(opts)
vim.cmd('colorscheme tokyonight')
end,
},
}

View File

@ -0,0 +1,17 @@
return {
{
'voldikss/vim-floaterm',
keys = {
{ '<leader>tt', '<cmd>FloatermToggle<cr>', mode = 'n', desc = 'Toggle a floaterm' },
{ '<leader>to', '<cmd>FloatermNew bash<cr>', mode = 'n', desc = 'Create a new floaterm running a bash shell' },
{ '<leader>th', '<cmd>FloatermHide<cr>', mode = 'n', desc = 'Hide the current floaterm' },
{ '<leader>tk', '<cmd>FloatermKill<cr>', mode = 'n', desc = 'Kill the latest floaterm' },
{ '<leader>tp', '<cmd>FloatermPrev<cr>', mode = 'n', desc = 'Go to the previous floaterm' },
{ '<leader>tn', '<cmd>FloatermNext<cr>', mode = 'n', desc = 'Go to the next floaterm' },
{ '<leader>ts', '<cmd>FloatermShow<cr>', mode = 'n', desc = 'Show the latest floaterm' },
{ '<leader>tg', '<cmd>FloatermNew lazygit<cr>', mode = 'n', desc = 'Create a new floaterm running lazygit' },
{ '<leader>bf', '<cmd>FloatermNew bash<cr>', mode = 'n', desc = 'Create a new floaterm running a bash shell' },
},
},
}

View File

@ -0,0 +1,15 @@
return {
{
'ThePrimeagen/harpoon',
keys = {
{ '<leader>hm', function() require('harpoon.mark').add_file() end, mode = 'n', desc = 'Harpoon mark the current file' },
{ '<leader>hh', function() require('harpoon.ui').toggle_quick_menu() end, mode = 'n', desc = 'Open Harpoon menu' },
{ '<leader>h1', function() require('harpoon.ui').nav_file(1) end, mode = 'n', desc = 'Navigate to Harpoon mark 1' },
{ '<leader>h2', function() require('harpoon.ui').nav_file(2) end, mode = 'n', desc = 'Navigate to Harpoon mark 2' },
{ '<leader>h3', function() require('harpoon.ui').nav_file(3) end, mode = 'n', desc = 'Navigate to Harpoon mark 3' },
{ '<leader>h4', function() require('harpoon.ui').nav_file(4) end, mode = 'n', desc = 'Navigate to Harpoon mark 4' },
{ '<leader>h5', function() require('harpoon.ui').nav_file(5) end, mode = 'n', desc = 'Navigate to Harpoon mark 5' },
},
},
}

22
nvim/lua/plugins/lf.lua Normal file
View File

@ -0,0 +1,22 @@
return {
{
'lmburns/lf.nvim',
lazy = false,
dependencies = { 'akinsho/toggleterm.nvim' },
config = function(_, opts)
require('lf').setup(opts)
end,
keys = {
{ '-', '<cmd>Lf<cr>', mode = 'n', desc = 'Open an Lf floaterm' },
},
init = function()
--vim.g.lf_map_keys = 0
vim.g.lf_netrw = true
end,
},
}

85
nvim/lua/plugins/lsp.lua Normal file
View File

@ -0,0 +1,85 @@
return {
{
'hrsh7th/nvim-cmp',
config = function()
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(_) return nil end
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
}),
})
end,
dependencies = {
'neovim/nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
},
},
{
'neovim/nvim-lspconfig',
dependencies = { 'williamboman/mason-lspconfig.nvim' },
config = function()
local lconf = require('lspconfig')
lconf.util.default_config = vim.tbl_extend(
'force',
lconf.util.default_config,
{ capabilities = require('cmp_nvim_lsp').default_capabilities() }
)
end,
keys = {
-- overrides for default keybinds, enhancing with LSP magic
{ 'K', vim.lsp.buf.hover, mode = 'n', desc = 'Hover documentation on the object under the cursor' },
{ '<c-]>', vim.lsp.buf.definition, mode = 'n', desc = 'Jump to the definition of the object under the cursor' },
{ '<c-[>', vim.lsp.buf.references, mode = 'n', desc = 'Open references in the Quickfix list' },
{ '<c-\\>', vim.lsp.buf.type_definition, mode = 'n', desc = 'Jump to the type definition of the object under the cursor' },
-- auto-format
{ '<c-f>', vim.lsp.buf.format, mode = 'n', desc = 'Run applicable formatters on the current buffer' },
},
},
{
'williamboman/mason-lspconfig.nvim',
dependencies = { 'williamboman/mason.nvim' },
config = function(_, opts)
local c = require('mason-lspconfig')
c.setup_handlers({
function(server_name)
require('lspconfig')[server_name].setup {}
end,
['lua_ls'] = function()
require('lspconfig').lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
})
end,
})
c.setup(opts)
end,
},
{
'williamboman/mason.nvim',
config = function(_, opts)
require('mason').setup(opts)
end,
keys = {
{ '<leader>M', '<cmd>Mason<cr>', mode = 'n', desc = 'Open Mason UI' },
},
}
}

View File

@ -0,0 +1,23 @@
return {
{
'nvim-neorg/neorg',
dependencies = { 'nvim-lua/plenary.nvim' },
ft = 'norg',
opts = {
load = {
['core.defaults'] = {},
['core.concealer'] = {},
['core.summary'] = {},
['core.export'] = {},
['core.export.markdown'] = { config = {
extensions = 'all',
}},
--['core.ui.calendar'] = {},
},
},
keys = {
{ '<leader>j.', '<cmd>Neorg journal today<cr>', mode = 'n', desc = "Open today's Neorg journal" },
{ '<leader>j>', '<cmd>Neorg journal tomorrow<cr>', mode = 'n', desc = "Open tomorrow's Neorg journal" },
},
},
}

View File

@ -0,0 +1,3 @@
return {
{ 'mtth/scratch.vim' },
}

View File

@ -0,0 +1,3 @@
return {
{ 'tpope/vim-surround' },
}

View File

@ -0,0 +1,38 @@
return {
{
'nvim-telescope/telescope.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons',
'nvim-telescope/telescope-fzf-native.nvim',
},
keys = {
{ '<leader>ff', '<cmd>Telescope find_files<cr>', mode = 'n', desc = 'Telescope find_files' },
{ '<leader>fg', '<cmd>Telescope live_grep<cr>', mode = 'n', desc = 'Telescope live_grep' },
{ '<leader>fb', '<cmd>Telescope buffers<cr>', mode = 'n', desc = 'Telescope buffers' },
{ '<leader>fh', '<cmd>Telescope help_tags<cr>', mode = 'n', desc = 'Telescope help_tags' },
{ '<leader>ft', '<cmd>Telescope<cr>', mode = 'n', desc = 'Telescope' },
},
opts = {
defaults = {
mappings = {
i = {
-- set i_<c-u> back to clearing the line
["<c-u>"] = function() vim.cmd([[norm 0lld$A]]) end,
-- telescope's default i_ mappings are terrible. how do you mess up hjkl?
["<c-j>"] = "preview_scrolling_down",
["<c-k>"] = "preview_scrolling_up",
["<c-h>"] = "preview_scrolling_left",
["<c-l>"] = "preview_scrolling_right",
["<c-d>"] = false,
["<c-f>"] = false,
},
},
},
},
},
}

View File

@ -0,0 +1,40 @@
return {
{
'nvim-treesitter/nvim-treesitter',
opts = {
highlight = { enable = true },
incremental_selection = { enable = true },
indent = { enable = true },
auto_install = true,
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
require("nvim-treesitter.parsers").get_parser_configs().templ = {
install_info = {
url = "https://github.com/vrischmann/tree-sitter-templ.git",
files = { "src/parser.c", "src/scanner.c" },
branch = "master",
},
}
vim.treesitter.language.register('templ', 'templ')
end,
},
{
'nvim-treesitter/nvim-treesitter-context',
opts = {
enable = true,
max_lines = 0,
min_window_height = 0,
multiline_threshold = 20,
trim_scope = 'inner',
mode = 'cursor',
separator = nil,
on_attach = nil,
},
},
{
'vrischmann/tree-sitter-templ',
opts = {},
}
}

View File

@ -0,0 +1,6 @@
return {
{
'folke/which-key.nvim',
opts = {},
},
}

83
nvim/lua/settings.lua Normal file
View File

@ -0,0 +1,83 @@
local o = vim.opt
local l = vim.opt_local
-- show relative line numbers
o.number = true
o.relativenumber = true
-- concealing
o.conceallevel = 2
o.concealcursor = 'nc'
-- more color support
o.termguicolors = true
-- min number width to 2
o.numberwidth = 2
-- support mouse everywhere
o.mouse = 'a'
-- round > and < commands to nearest tabstop
o.shiftround = true
-- shorter update time
o.updatetime = 200
-- don't show |ins-completion-menu| messages
o.shortmess = o.shortmess + 'c'
-- always show the signcolumn
o.signcolumn = 'yes'
-- additional patterns to skip in glob matching
o.wildignore = o.wildignore + { '*.pyc', '*.sw?', '*/.mypy_cache/*' }
-- customize the completion menu
o.completeopt = { 'menu', 'menuone', 'noselect' }
-- timeouts
o.timeout = true
o.timeoutlen = 250
-- use a global dictionary file
if (vim.fn.filereadable('/usr/share/dict/words'))
then
o.dictionary = '/usr/share/dict/words'
end
-- preserve cursor position
vim.api.nvim_create_autocmd('BufReadPost', {
pattern = { '*' },
callback = function()
local line = vim.fn.line
if (line("'\"") >= 1 and line("'\"") <= line("$"))
then
vim.api.nvim_exec("normal! g`\"", false)
end
end,
})
-- user commands to set hard tabs or spaces and tabstop width
local function settabs(expand)
return function(conf)
local n = tonumber(conf.args)
l.expandtab = expand
l.tabstop = n
l.shiftwidth = n
l.softtabstop = -1
end
end
vim.api.nvim_create_user_command("Tabs", settabs(false), { nargs = 1 })
vim.api.nvim_create_user_command("Spaces", settabs(true), { nargs = 1 })
_G.tabs = function(width) settabs(false)({ args = width }) end
_G.spaces = function(width) settabs(true)({ args = width }) end
-- set grep program to ripgrep
if vim.fn.executable('rg')
then
o.grepprg = 'rg --vimgrep'
o.grepformat = '%f:%l:%c:%m,%f:%l:%m'
end