feat: vim config extracted from dot files

This commit is contained in:
Matthieu Bessat 2024-01-17 22:38:37 +01:00
commit 3f510aa1df
5 changed files with 1766 additions and 0 deletions

68
.xinitrc Normal file
View file

@ -0,0 +1,68 @@
#!/bin/sh
# Setup display
xrandr --auto && xrandr --output HDMI1 --mode 1920x1080 --left-of eDP1
# Setup dependencies (this section is REQUIRED, don't remove)
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
# to only use the HDM1 output use the command:
# xrandr --output HDMI1 --mode 1920x1080 --output
# setup remap
[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap
# touchpad deamon with synaptic
# disable the touchpad when the user is typing to avoid confusion
syndaemon -i 0.5 -K -R -d
picom &
# old xflux (with french location)
#xflux -l 49.1754262 -g 1.3301737 &
# Start xflux in location russia
xflux -l 54.784568 -g 37.106110 &
# Start notification deamon
dunst &
# Start network manager applet
# nm-applet
# Prevent paste mouseblock
# I had to install it without using pacman
~/.apps/XMousePasteBlock/xmousepasteblock &
# Start greenclip
greenclip daemon &
# Start batterytator
/usr/bin/batterytator mbess BAT0 &
# old: start laptop monitor (now replaced with batterytator)
#env LAPTOP_MONITOR_PERIOD_IN_MINUTES=2 /home/mbess/dots/laptop_monitor & > /home/mbess/dots/monitor.log
# setup keychain
eval $(gnome-keyring-daemon --start)
export SSH_AUTH_SOCK
# Start blueman
blueman-applet &
# Start network manager applet
nm-applet &
sh $HOME/dots/scripts/refresh_wallpapers.sh &
xautolock -detectsleep -time 5 -locker ~/dots/scripts/lock.sh -notify 30 -notifier "notify-send -u critical -t 10000 -- 'locking screen in 30 seconds'" &
element-desktop &
i3

1529
nvim/init.lua Normal file

File diff suppressed because it is too large Load diff

9
nvim/lua/popequer.lua Normal file
View file

@ -0,0 +1,9 @@
print("WOOWOWO! Popequer enabled from dedicated file!!!!")
-- modify neotree config to add custom command
vim.api.nvim_create_user_command('PopequerMakeNote', function ()
-- get the user current working directory opened on Neotree
end, {})
vim.cmd("set autowriteall")

View file

@ -0,0 +1,19 @@
local builtin = {}
-- Ref: https://github.com/tjdevries/lazy.nvim
local function require_on_exported_call(mod)
return setmetatable({}, {
__index = function(_, picker)
return function(...)
return require(mod)[picker](...)
end
end,
})
end
builtin.git_status = require_on_exported_call("pickers").files
builtin = apply_config(builtin)
return builtin

View file

@ -0,0 +1,141 @@
local actions = require "telescope.actions"
local action_state = require "telescope.actions.state"
local finders = require "telescope.finders"
local make_entry = require "telescope.make_entry"
local operators = require "telescope.operators"
local pickers = require "telescope.pickers"
local previewers = require "telescope.previewers"
local utils = require "telescope.utils"
local entry_display = require "telescope.pickers.entry_display"
local strings = require "plenary.strings"
local Path = require "plenary.path"
local conf = require("telescope.config").values
local git_command = utils.__git_command
local ppq_pickers = {}
local get_git_command_output = function(args, opts)
return utils.get_os_command_output(git_command(args, opts), opts.cwd)
end
ppq_pickers.files = function(opts)
if opts.is_bare then
utils.notify("builtin.git_files", {
msg = "This operation must be run in a work tree",
level = "ERROR",
})
return
end
local show_untracked = vim.F.if_nil(opts.show_untracked, false)
local recurse_submodules = vim.F.if_nil(opts.recurse_submodules, false)
if show_untracked and recurse_submodules then
utils.notify("builtin.git_files", {
msg = "Git does not support both --others and --recurse-submodules",
level = "ERROR",
})
return
end
-- By creating the entry maker after the cwd options,
-- we ensure the maker uses the cwd options when being created.
opts.entry_maker = vim.F.if_nil(opts.entry_maker, make_entry.gen_from_file(opts))
opts.git_command = vim.F.if_nil(opts.git_command, git_command({ "ls-files", "--exclude-standard", "--cached" }, opts))
pickers
.new(opts, {
prompt_title = "Git Files",
finder = finders.new_oneshot_job(
vim.tbl_flatten {
opts.git_command,
show_untracked and "--others" or nil,
recurse_submodules and "--recurse-submodules" or nil,
},
opts
),
previewer = conf.file_previewer(opts),
sorter = conf.file_sorter(opts),
})
:find()
end
local get_current_buf_line = function(winnr)
local lnum = vim.api.nvim_win_get_cursor(winnr)[1]
return vim.trim(vim.api.nvim_buf_get_lines(vim.api.nvim_win_get_buf(winnr), lnum - 1, lnum, false)[1])
end
local try_worktrees = function(opts)
local worktrees = conf.git_worktrees
if vim.tbl_isarray(worktrees) then
for _, wt in ipairs(worktrees) do
if vim.startswith(opts.cwd, wt.toplevel) then
opts.toplevel = wt.toplevel
opts.gitdir = wt.gitdir
if opts.use_git_root then
opts.cwd = wt.toplevel
end
return
end
end
end
error(opts.cwd .. " is not a git directory")
end
local current_path_toplevel = function()
local gitdir = vim.fn.finddir(".git", vim.fn.expand "%:p" .. ";")
if gitdir == "" then
return nil
end
return Path:new(gitdir):parent():absolute()
end
local set_opts_cwd = function(opts)
opts.use_git_root = vim.F.if_nil(opts.use_git_root, true)
if opts.cwd then
opts.cwd = vim.fn.expand(opts.cwd)
elseif opts.use_file_path then
opts.cwd = current_path_toplevel()
if not opts.cwd then
opts.cwd = vim.fn.expand "%:p:h"
try_worktrees(opts)
return
end
else
opts.cwd = vim.loop.cwd()
end
local toplevel, ret = utils.get_os_command_output({ "git", "rev-parse", "--show-toplevel" }, opts.cwd)
if ret ~= 0 then
local in_worktree = utils.get_os_command_output({ "git", "rev-parse", "--is-inside-work-tree" }, opts.cwd)
local in_bare = utils.get_os_command_output({ "git", "rev-parse", "--is-bare-repository" }, opts.cwd)
if in_worktree[1] ~= "true" and in_bare[1] ~= "true" then
try_worktrees(opts)
elseif in_worktree[1] ~= "true" and in_bare[1] == "true" then
opts.is_bare = true
end
else
if opts.use_git_root then
opts.cwd = toplevel[1]
end
end
end
local function apply_checks(mod)
for k, v in pairs(mod) do
mod[k] = function(opts)
opts = vim.F.if_nil(opts, {})
set_opts_cwd(opts)
v(opts)
end
end
return mod
end
return apply_checks(ppq_pickers)