diff options
| author | Alec Goncharow <alec@goncharow.dev> | 2024-01-12 08:48:32 -0500 |
|---|---|---|
| committer | Alec Goncharow <alec@goncharow.dev> | 2024-01-12 08:48:32 -0500 |
| commit | 803274ed25384b4ffb134f35c910347c022999fd (patch) | |
| tree | 7ae72fc76bedac20c36e289afcbad0bb250369b7 | |
| parent | 7ccc0f409ededaf3a19395f1bc1fb5e2686c37a0 (diff) | |
binding exploration
| -rw-r--r-- | .config/alacritty/alacritty.toml | 3 | ||||
| -rw-r--r-- | .config/nvim/lua/ls.lua | 10 | ||||
| -rw-r--r-- | .config/nvim/lua/lsp.lua | 11 | ||||
| -rw-r--r-- | .config/nvim/lua/mappings.lua | 8 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins.lua | 34 | ||||
| -rw-r--r-- | .config/nvim/lua/powerline.lua | 2 | ||||
| -rw-r--r-- | .config/nvim/lua/settings.lua | 47 | ||||
| -rw-r--r-- | .config/sway/config | 9 | ||||
| -rw-r--r-- | .gitconfig | 22 | ||||
| -rwxr-xr-x | bin/memezoom | 21 | ||||
| -rwxr-xr-x | bin/safequit | 14 |
11 files changed, 130 insertions, 51 deletions
diff --git a/.config/alacritty/alacritty.toml b/.config/alacritty/alacritty.toml index 14a9578..eecaf50 100644 --- a/.config/alacritty/alacritty.toml +++ b/.config/alacritty/alacritty.toml @@ -1,5 +1,5 @@ [font] -size = 12 +size = 13 [font.bold] family = "FiraMono" @@ -20,6 +20,7 @@ mods = "Alt|Shift" [window] opacity = 0.95 +dynamic_title = true [colors.primary] background = "#062625" diff --git a/.config/nvim/lua/ls.lua b/.config/nvim/lua/ls.lua index 7a93ec4..2361fda 100644 --- a/.config/nvim/lua/ls.lua +++ b/.config/nvim/lua/ls.lua @@ -54,11 +54,11 @@ require 'jabs'.setup { -- Keymaps keymap = { - close = "<c-d>", -- Close buffer. Default D - jump = "<cr>", -- Jump to buffer. Default <cr> - h_split = "h", -- Horizontally split buffer. Default s - v_split = "v", -- Vertically split buffer. Default v - preview = "p", -- Open buffer preview. Default P + close = "x", -- Close buffer. Default D + jump = "<cr>", -- Jump to buffer. Default <cr> + h_split = "h", -- Horizontally split buffer. Default s + v_split = "v", -- Vertically split buffer. Default v + preview = "p", -- Open buffer preview. Default P }, -- Whether to use nvim-web-devicons next to filenames diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index f2ec79a..aa156b5 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -20,7 +20,8 @@ local on_attach = function(client, bufnr) local bufopts = { noremap = true, silent = true, buffer = bufnr } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gk', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', '<leader><leader>', vim.lsp.buf.hover, bufopts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) @@ -72,10 +73,10 @@ lspconfig.bashls.setup({ }) -require'lspconfig'.sqlls.setup({ - server = { - on_attach = on_attach, - } +require 'lspconfig'.sqlls.setup({ + server = { + on_attach = on_attach, + } }) -- https://github.com/nikeee/dot-language-server diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 1e338f4..a5f50b2 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -31,8 +31,14 @@ Nmap("<c-j>", ":wincmd j<CR>") Nmap("<c-h>", ":wincmd h<CR>") Nmap("<c-l>", ":wincmd l<CR>") +--- pane resize +Nmap("_", ":resize -1<CR>") +Nmap("+", ":resize +1<CR>") +Nmap("<", ":vertical:resize -1<CR>") +Nmap(">", ":vertical:resize +1<CR>") + -- pane spawn -Nmap("t", ':split<CR>:wincmd j<CR>:term<CR>a') +Nmap("t", ':split<CR>:wincmd j<CR>:term<CR>') Nmap("s", ':vs<CR>:wincmd l<CR>') -- escape terminal mode easier diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index ec13e3d..c97cb15 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -54,25 +54,14 @@ return require('packer').startup(function() use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } use 'scrooloose/nerdcommenter' -- commenting shortcuts - use { - "folke/which-key.nvim", - config = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - require("which-key").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - } - end - } - use 'tpope/vim-eunuch' -- wrappers UNIX commands - use 'tpope/vim-surround' -- surround characters shortcuts - use 'tpope/vim-vinegar' -- make explore better - use 'tpope/vim-endwise' -- wisely add - use 'tpope/vim-repeat' -- repeat for plugins + use 'tpope/vim-eunuch' -- wrappers UNIX commands + use 'tpope/vim-surround' -- surround characters shortcuts + use 'tpope/vim-vinegar' -- make explore better + use 'tpope/vim-endwise' -- wisely add + use 'tpope/vim-repeat' -- repeat for plugins use { - 'prichrd/netrw.nvim', -- particles for ^ + 'prichrd/netrw.nvim', -- particles for ^ config = function() require("netrw").setup { directory = '', -- Directory icon @@ -129,4 +118,15 @@ return require('packer').startup(function() use 'tpope/vim-dadbod' -- SQL use 'nanotee/sqls.nvim' + + use { + 'rmagatti/auto-session', + config = function() + vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" + require("auto-session").setup { + log_level = "error", + auto_session_suppress_dirs = { "~/", "~/Downloads", "/" }, + } + end + } end) diff --git a/.config/nvim/lua/powerline.lua b/.config/nvim/lua/powerline.lua index 9c29b12..5fe3c93 100644 --- a/.config/nvim/lua/powerline.lua +++ b/.config/nvim/lua/powerline.lua @@ -38,7 +38,7 @@ require('lualine').setup { lualine_b = {}, lualine_c = {}, lualine_x = {}, - lualine_y = {}, + lualine_y = { require('auto-session.lib').current_session_name, }, lualine_z = { 'tabs' } }, winbar = {}, diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 837f22a..bfc771c 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -39,37 +39,46 @@ vim.o.showbreak = '↪' -- character to show when line is broken vim.opt.clipboard = 'unnamedplus' +-- title string +vim.opt.title = true +vim.opt.titlestring = 'neovim' + -- Sidebar vim.o.number = true -- line number on the left vim.o.numberwidth = 3 -- always reserve 3 spaces for line number -vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check +vim.o.signcolumn = 'yes' -- keep 1 column for check vim.o.modelines = 0 vim.o.showcmd = true -- display command in bottom bar +-- make term better +vim.api.nvim_command('autocmd TermOpen * setlocal nonumber norelativenumber signcolumn=no') +-- do insert on enter term +-- vim.api.nvim_command('autocmd BufWinEnter,WinEnter term://* startinsert') + -- Search -vim.o.incsearch = true -- starts searching as soon as typing, without enter needed -vim.o.ignorecase = true -- ignore letter case when searching -vim.o.smartcase = true -- case insentive unless capitals used in search +vim.o.incsearch = true -- starts searching as soon as typing, without enter needed +vim.o.ignorecase = true -- ignore letter case when searching +vim.o.smartcase = true -- case insentive unless capitals used in search -vim.o.matchtime = 2 -- delay before showing matching paren -vim.o.mps = vim.o.mps .. ",<:>" +vim.o.matchtime = 2 -- delay before showing matching paren +vim.o.mps = vim.o.mps .. ",<:>" -- White characters -vim.o.autoindent = true -vim.o.smartindent = true -vim.o.tabstop = 2 -- 1 tab = 2 spaces -vim.o.shiftwidth = 2 -- indentation rule -vim.o.formatoptions = -'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word -vim.o.expandtab = true -- expand tab to spaces +vim.o.autoindent = true +vim.o.smartindent = true +vim.o.tabstop = 2 -- 1 tab = 2 spaces +vim.o.shiftwidth = 2 -- indentation rule +vim.o.formatoptions = +'qnj1' -- q - comment formatting; n - numbered lists; j - remove comment when joining lines; 1 - don't break after one-letter word +vim.o.expandtab = true -- expand tab to spaces -- Backup files -vim.o.backup = true -- use backup files -vim.o.writebackup = false -vim.o.swapfile = false -- do not use swap file -vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files -vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups -vim.o.directory = '/.vim/tmp/swap//' -- swap files +vim.o.backup = true -- use backup files +vim.o.writebackup = false +vim.o.swapfile = false -- do not use swap file +vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files +vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups +vim.o.directory = '/.vim/tmp/swap//' -- swap files vim.cmd([[ au FileType python set ts=4 sw=4 diff --git a/.config/sway/config b/.config/sway/config index e9d8861..1379257 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -30,7 +30,7 @@ set $my-term alacritty bindsym $mod+Return exec --no-startup-id $my-term # kill focused window -bindsym $mod+Shift+q kill +bindsym $mod+Shift+q exec --no-startup-id ~/bin/safequit # start dmenu (a program launcher) bindsym $mod+d exec --no-startup-id fuzzel @@ -189,6 +189,7 @@ bindsym ctrl+Mod1+Tab exec --no-startup-id "xinput set-prop 'pointer:Logitech M #Dunst exec_always --no-startup-id dunst +bindsym $mod+Escape exec --no-startup-id "dunstctl close-all" # polkit exec /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 @@ -217,6 +218,8 @@ bar { # Set inner/outer gaps gaps inner 10 gaps outer 0 +smart_gaps on +smart_borders on for_window { [class="firefox"] border none @@ -257,7 +260,9 @@ bindswitch --reload --locked lid:off output $laptop_screen enable workspace 1 output 'LG Electronics LG ULTRAGEAR 107NTDVCR242' eDP-1 workspace 2 output 'Dell Inc. DELL P2723QE 3940MP3' eDP-1 -bindsym --release Print exec grim -g "$(slurp)" -t png - | wl-copy -t image/png +bindsym --release Print exec ~/bin/screenshot +bindsym --release Scroll_Lock exec ~/bin/memezoom +bindsym --release XF86AudioMedia exec ~/bin/memezoom # Sway display things output 'LG Electronics LG ULTRAGEAR 107NTDVCR242' { diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..bea41ee --- /dev/null +++ b/.gitconfig @@ -0,0 +1,22 @@ +[user] + name = Alec Goncharow + email = alec@goncharow.dev +[core] + editor = nvim +[pull] + rebase = true +[init] + defaultBranch = main +[diff] + tool = difftastic +[difftool] + prompt = false +[difftool "difftastic"] + cmd = difft "$LOCAL" "$REMOTE" +[pager] + difftool = true +# `git dft` is less to type than `git difftool`. +[alias] + difft = difftool + dift = difftool + dft = difftool diff --git a/bin/memezoom b/bin/memezoom new file mode 100755 index 0000000..f7dbb44 --- /dev/null +++ b/bin/memezoom @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + +FOCUSED=$(swaymsg -t get_outputs | jq '.[] | select(.focused) | .rect | "\(.x),\(.y) \(.width)x\(.height)"') +TMP="" + +main() { + TMP=$(mktemp) + grim -g "$(eval echo "$FOCUSED")" "$TMP" + imv -u nearest_neighbour "$TMP" -f + #swaymsg '[app_id="imv"] fullscreen enable' +} + +main "$@" +rm "$TMP" diff --git a/bin/safequit b/bin/safequit new file mode 100755 index 0000000..6b366ba --- /dev/null +++ b/bin/safequit @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +FOCUSED=$(swaymsg -t get_tree | jq -r '.. | (.nodes? // empty)[] | select(.focused) | .name') + +main() { + echo "$FOCUSED" + if [[ "$FOCUSED" == neovim* ]]; then + notify-send "pls dont kill neovims like this" + exit 0 + fi + + swaymsg kill +} + +main "$@" |
