Skip to content

Commit

Permalink
Add exrc and lua snippet for local config
Browse files Browse the repository at this point in the history
  • Loading branch information
Jendker committed Oct 23, 2024
1 parent 213a12d commit c4b8e25
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 2 deletions.
1 change: 1 addition & 0 deletions stow/common/dot-config/nvim/lua/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ vim.o.updatetime = 200 -- CursorHold time default is 4s. Way too long
vim.opt.showcmd = false -- prevent flickering if j/k is being held
vim.opt.title = true -- turn on for tmux and terminal apps tab title
vim.o.splitright = true
vim.o.exrc = true -- search local directory for .nvim.lua config

-- Clipboard
vim.opt.clipboard:append("unnamedplus")
Expand Down
72 changes: 72 additions & 0 deletions stow/common/dot-config/nvim/snippets/lua.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"Print string": {
"prefix": "ps",
"body": ["print(string.format(\"$1\", $2))"]
},
"vim.log.levels": {
"prefix": "vll",
"body": ["vim.log.levels.$0"]
},
"string.format": {
"prefix": "sf",
"body": ["string.format(\"${1:$TM_SELECTED_TEXT}\", $2)"]
},
"vim.inspect": {
"prefix": "vi",
"body": ["vim.inspect(${1:$TM_SELECTED_TEXT})"]
},
"vim.api.nvim_": {
"prefix": "nv",
"body": ["vim.api.nvim_"]
},
"for ipairs": {
"prefix": "fori",
"body": [
"for ${1:i},${2:v} in ipairs($3) do",
" ${0:$TM_SELECTED_TEXT}",
"end"
]
},
"for pairs": {
"prefix": "forp",
"body": [
"for ${1:k},${2:v} in pairs($3) do",
" ${0:$TM_SELECTED_TEXT}",
"end"
]
},
"if": {
"prefix": "if",
"body": ["if $1 then", " ${0:$TM_SELECTED_TEXT}", "end"]
},
"if-else": {
"prefix": "ife",
"body": ["if $1 then", " ${1:$TM_SELECTED_TEXT}", "else", " $0", "end"]
},
"profile.log_start": {
"prefix": "pls",
"body": ["profile.log_start($1)"]
},
"profile.log_end": {
"prefix": "ple",
"body": ["profile.log_end($1)"]
},
"profile.log": {
"prefix": "pl",
"body": [
"profile.log_start($1)",
"$TM_SELECTED_TEXT",
"profile.log_end($1)"
]
},
"local conform config": {
"prefix": ["conform", "cfg"],
"body": [
"require(\"conform\").setup({",
" formatters_by_ft = {",
" python = { \"isort\", \"yapf\" },",
" },",
"})"
]
}
}
8 changes: 6 additions & 2 deletions stow/common/dot-config/nvim/snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"path": "global.code-snippets"
},
{
"language": "sh",
"path": "shellscript.json"
"language": "lua",
"path": "lua.json"
},
{
"language": "markdown",
Expand All @@ -16,6 +16,10 @@
{
"language": "python",
"path": "python.json"
},
{
"language": "sh",
"path": "shellscript.json"
}
]
}
Expand Down

0 comments on commit c4b8e25

Please sign in to comment.