This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local M = {} | |
| local ignore_dirs = { '.git', 'node_modules', '.cache', '.next', '.nuxt', 'dist', 'build', 'target', 'out', '.cargo', 'vendor', '.vscode' } | |
| ---@type integer | |
| local ns = vim.api.nvim_create_namespace('picker_ns') | |
| ---@class PickerState | |
| ---@field win_id integer|nil | |
| ---@field buf_id integer|nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local M = {} | |
| M.config = { | |
| remotes = { 'fork', 'origin', 'upstream' }, | |
| default_base = nil, | |
| browser_commands = { | |
| mac = 'open', | |
| unix = 'xdg-open', | |
| win = 'start', | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vim.keymap.set('n', '<leader>f', function() | |
| local ext = vim.fn.expand '%:e' | |
| local confirm = | |
| vim.fn.input('proceed with formatting ' .. ext .. ' files? [y/n] ') | |
| if confirm:lower() ~= 'y' then | |
| print 'operation cancelled' | |
| return | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with builtins; | |
| let | |
| printChild = prefix: x: | |
| let | |
| names = attrNames x; | |
| in | |
| if isAttrs x && length names == 1 | |
| then "." + head names + printChild prefix x.${head names} | |
| else " = " + print prefix x | |
| ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Calls GPT-4 to fill holes in the current file, | |
| " omitting collapsed folds to save prompt space | |
| local M = {} | |
| local function save_visible_lines(dest) | |
| local visible_lines = {} | |
| local lnum = 1 | |
| while lnum <= vim.fn.line('$') do | |
| if vim.fn.foldclosed(lnum) == -1 then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| variant=$1 | |
| if [ -z "$WAYLAND_DISPLAY" ]; then | |
| if [ "$variant" = "intl" ]; then | |
| setxkbmap -layout us -variant intl | |
| notify-send -t 2000 "Keyboard layout" "Switched to international" | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| config_file="$HOME/.config/datsvault.json" | |
| if [ ! -e "$config_file" ]; then | |
| echo "Config file '$config_file' does not exist. Creating one..." | |
| mkdir -p "$HOME/.config" | |
| echo '{"vault_path": "'"$HOME/.config/datsvault"'", "terminal": "alacritty", "vault_repo": "null"}' > "$config_file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local M = {} | |
| local function return_project_root() | |
| local path = vim.fn.expand "%:p:h" | |
| local git_path = vim.fn.finddir(".git", path .. ";") | |
| local git_file = vim.fn.findfile(".git", path .. ";") | |
| if git_path == "" and git_file == "" then | |
| return nil | |
| else | |
| return vim.fn.fnamemodify(git_path, ":h") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local ok, formatter = pcall(require, "formatter") | |
| if not ok then | |
| return | |
| end | |
| local util = require "formatter.util" | |
| local find_git_ancestor = function () | |
| local path = util.get_current_buffer_file_path() | |
| local root = path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| vim.opt.cmdheight = 1 | |
| vim.opt.encoding = "utf-8" | |
| vim.scriptencoding = "utf-8" | |
| vim.opt.fileencoding = "utf-8" | |
| vim.opt.expandtab = true | |
| vim.opt.hidden = true | |
| vim.opt.hlsearch = true | |
| vim.opt.ignorecase = true | |
| vim.opt.incsearch = true | |
| vim.opt.laststatus = 3 |
NewerOlder