Compare commits

..

20 commits

Author SHA1 Message Date
7dfe2ca68b change breakpoint icon 2024-11-03 19:53:47 +01:00
b48b531d3d Swith to rustaceanvim and set up Rust debugging 2024-11-03 18:15:52 +01:00
9259e7b2ba Update alacritty - config format 2024-11-02 12:37:30 +01:00
2844c29a9c sway: fix screenshot capture 2024-10-22 20:37:15 +02:00
db05b6ba8e nvim: remove rename shortcut 2024-10-14 10:02:09 +02:00
db4a1cf198 sway: date formatted screenshots in home 2024-10-14 09:59:52 +02:00
a3b0b8754b nvim: remove dart, move autoformat extensions to var 2024-10-14 09:59:14 +02:00
563995032c nvim: ignore .venv/ in telescope 2024-10-07 12:10:05 +02:00
51495f158d bash: do a better 'bash is running' check 2024-10-07 11:59:07 +02:00
1a207b0c7a rg: add config file 2024-10-07 11:49:10 +02:00
fa4426d193 bash: restore pythonuserbase 2024-10-07 11:48:31 +02:00
ae7733a776 sway: green color on active window title 2024-10-07 11:47:54 +02:00
bf0e8daf49 nvim: set title 2024-10-07 11:47:16 +02:00
62fd64ddb8 bash: lesspipe + checkwinsize 2024-10-07 11:46:59 +02:00
12f9dcceb9 bash: set terminal window title 2024-10-07 11:45:56 +02:00
750cd50c3d nvim: ignore .git/ in telescope 2024-10-07 08:43:18 +02:00
c0245c9d1c sway: fix keyboard language display 2024-10-07 01:16:41 +02:00
f1a244178f Update readme - Before=basic.service 2024-10-06 22:35:42 +02:00
8b3b22432a nvim: rg everywhere!
:)
2024-10-06 22:29:00 +02:00
c571328361 mako: change style 2024-10-06 09:55:58 +02:00
15 changed files with 216 additions and 77 deletions

View file

@ -6,8 +6,7 @@ Save this service config to `$XDG_CONFIG_HOME/systemd/user/dotfiles.service`:
[Unit] [Unit]
Description=Stow dotfiles linker Description=Stow dotfiles linker
Documentation=man:stow(1) Documentation=man:stow(1)
Before=wayland-session.target Before=basic.target
Conflicts=wayland-session.target
[Service] [Service]
Type=oneshot Type=oneshot
@ -20,7 +19,7 @@ ExecStop=/usr/bin/stow --target=%h --delete dotfiles/
WantedBy=default.target WantedBy=default.target
``` ```
(and enable it:) Update `WorkingDirectory=%h/dev/dotfiles` and enable the service:
```sh ```sh
systemctl --user enable --now dotfiles.service systemctl --user enable --now dotfiles.service

View file

@ -15,23 +15,20 @@ shopt -s histappend
[[ -f $HOME/.bash_colors ]] && source "$HOME/.bash_colors" [[ -f $HOME/.bash_colors ]] && source "$HOME/.bash_colors"
[[ -f $HOME/.bash_functions ]] && source "$HOME/.bash_functions" [[ -f $HOME/.bash_functions ]] && source "$HOME/.bash_functions"
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
while read -r completion ; do source "$completion" ; done < <(find $HOME/.bash_completion/ -maxdepth 1 -not -type d)
# Save working dir on every prompt. # Save working dir on every prompt.
export PROMPT_COMMAND='pwd > $HOME/.cwd' export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"; pwd > $HOME/.cwd'
export PS1="${Yellow}\d \A ${Off}${Green}\u@\h: ${Off}\w ${Red}\$(parse_branch git)${BRed}\$(parse_branch fossil)${Off}\n-$ " export PS1="${Yellow}\d \A ${Off}${Green}\u@\h: ${Off}\w ${Red}\$(parse_branch git)${BRed}\$(parse_branch fossil)${Off}\n-$ "
# Use fzf if installed. # Use fzf if installed.
hash fzf 2>/dev/null && eval "$(fzf --bash)" hash fzf 2>/dev/null && eval "$(fzf --bash)"
export FZF_DEFAULT_OPTS='--border=horizontal --info=inline --no-reverse --height=50%' export FZF_DEFAULT_OPTS='--border=horizontal --info=inline --no-reverse --height=50%'
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# Use gpg-agent as ssh agent (and get a nice graphical prompt). # Use gpg-agent as ssh agent (and get a nice graphical prompt).
unset SSH_AGENT_PID unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then

View file

@ -1,9 +1,9 @@
live_config_reload = true [general]
working_directory = "None"
import = [ import = [
"~/.config/alacritty/light.toml" "~/.config/alacritty/light.toml"
] ]
live_config_reload = true
working_directory = "None"
[cursor] [cursor]
thickness = 0.2 thickness = 0.2
@ -414,7 +414,7 @@ history = 100000
save_to_clipboard = true save_to_clipboard = true
semantic_escape_chars = ",│`|:\"' ()[]{}<>\t" semantic_escape_chars = ",│`|:\"' ()[]{}<>\t"
[shell] [terminal.shell]
program = "/bin/bash" program = "/bin/bash"
[window] [window]

View file

@ -17,15 +17,16 @@ border-radius=10
background-color=#eff1f5E0 background-color=#eff1f5E0
text-color=#4c4f69 text-color=#4c4f69
border-color=#fe640b border-color=#40a02b
progress-color=over #ccd0da progress-color=over #ccd0da
[urgency=low]
border-color=#c1ca8c
[urgency=high] [urgency=high]
border-color=#fe040b border-color=#fe040b
background-color=#ffe1e5 background-color=#ffe1e5
border-size=5
[urgency=critical] [urgency=critical]
border-color=#fe040b border-color=#fe040b
background-color=#ffe1e5 background-color=#ffe1e5
border-size=5

View file

@ -1,3 +1,5 @@
local autoformat_files = '*.py,*.rs,*.tf'
local common_on_attach = function(client, bufnr) local common_on_attach = function(client, bufnr)
-- Mappings. -- Mappings.
vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>") vim.keymap.set("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>")
@ -7,18 +9,16 @@ local common_on_attach = function(client, bufnr)
vim.keymap.set("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>") vim.keymap.set("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>")
vim.keymap.set("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>") vim.keymap.set("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>")
vim.keymap.set("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>") vim.keymap.set("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>")
vim.keymap.set("n", "<leader>r", "<cmd>lua vim.lsp.buf.rename()<CR>")
-- Autoformat on save. -- Autoformat on save.
if client.supports_method("textDocument/formatting") then if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", { vim.api.nvim_create_autocmd("BufWritePre", {
pattern = '*.py,*.rs', pattern = autoformat_files,
callback = function() callback = function()
vim.lsp.buf.format() vim.lsp.buf.format()
end, end,
}) })
end end
-- Use vim's default coloring. -- Use vim's default coloring.
client.server_capabilities.semanticTokensProvider = nil client.server_capabilities.semanticTokensProvider = nil
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
@ -26,30 +26,29 @@ local common_on_attach = function(client, bufnr)
end end
end end
local nvim_lsp = require('lspconfig') -- LSP diagnostics.
local capabilities = vim.lsp.protocol.make_client_capabilities() vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = false,
underline = true,
signs = true,
update_in_insert = false
})
-- LSPs -- Setup rust outside of lspconfig.
local servers = { vim.g.rustaceanvim = function()
"clangd", return {
"dartls", -- Plugin configuration.
"gleam", tools = {
"lua_ls", },
"ocamllsp", -- LSP configuration.
"pyright", server = {
"rnix", on_attach = function(client, bufnr)
"terraformls", common_on_attach(client, bufnr)
"vimls", end,
} default_settings = {
for _, lsp in ipairs(servers) do -- rust-analyzer language server configuration
nvim_lsp[lsp].setup { capabilities = capabilities, on_attach = common_on_attach } ['rust-analyzer'] = {
end
nvim_lsp.rust_analyzer.setup({
on_attach = common_on_attach,
capabilities = capabilities,
settings = {
["rust-analyzer"] = {
imports = { imports = {
granularity = { granularity = {
group = "module", group = "module",
@ -67,9 +66,31 @@ nvim_lsp.rust_analyzer.setup({
checkOnSave = { checkOnSave = {
command = "clippy", command = "clippy",
}, },
},
},
-- DAP configuration.
dap = {
},
} }
} }
}) end
local nvim_lsp = require('lspconfig')
local capabilities = vim.lsp.protocol.make_client_capabilities()
-- LSPs
local servers = {
"clangd",
"lua_ls",
"ocamllsp",
"pyright",
"rnix",
"terraformls",
"vimls",
}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { capabilities = capabilities, on_attach = common_on_attach }
end
nvim_lsp.ruff.setup({ nvim_lsp.ruff.setup({
on_attach = function (client) on_attach = function (client)
@ -84,12 +105,3 @@ nvim_lsp.ruff.setup({
} }
}, },
}) })
-- LSP diagnostics.
vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = false,
underline = true,
signs = true,
update_in_insert = false
})

View file

@ -0,0 +1,89 @@
local dap, dapui = require('dap'), require('dapui')
-- Open dapui once dap starts.
dapui.setup()
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.dapui_config = function()
dapui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
dapui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
dapui.close()
end
-- Keybindings used in probably all editors/IDEs.
vim.keymap.set('n', '<F5>', dap.continue)
vim.keymap.set('n', '<F10>', dap.step_over)
vim.keymap.set('n', '<F11>', dap.step_into)
vim.keymap.set('n', '<F12>', dap.step_out)
-- Breakpoints.
vim.keymap.set('n', '<Leader>b', dap.toggle_breakpoint)
vim.keymap.set('n', '<Leader>B', dap.set_breakpoint)
vim.keymap.set('n', '<Leader>lp', function() dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end)
-- Repl, run and dap-ui bindings.
vim.keymap.set('n', '<Leader>dr', dap.repl.open)
vim.keymap.set('n', '<Leader>dl', dap.run_last)
vim.keymap.set({'n', 'v'}, '<Leader>dh', function() require('dap.ui.widgets').hover() end)
vim.keymap.set({'n', 'v'}, '<Leader>dp', function() require('dap.ui.widgets').preview() end)
vim.keymap.set('n', '<Leader>df', function() local widgets = require('dap.ui.widgets') widgets.centered_float(widgets.frames) end)
vim.keymap.set('n', '<Leader>ds', function() local widgets = require('dap.ui.widgets') widgets.centered_float(widgets.scopes) end)
vim.fn.sign_define('DapBreakpoint', {text='󰬪', texthl='', linehl='', numhl=''})
-- Set up lldb (LLVM debugger)
-- Install archlinux: sudo pacman -S lldb
-- Install ubuntu: sudo apt
dap.adapters.lldb = {
type = 'server',
port = "${port}",
executable = {
command = '/usr/bin/lldb-dap',
args = { "--port", "${port}" },
},
}
-- Custom debuggable build runs (on top of rust-analyzer debuggables).
local ExecTypes = {
TEST = "cargo build --tests -q --message-format=json",
BIN = "cargo build -q --message-format=json"
}
local function runBuild(type)
local lines = vim.fn.systemlist(type)
local output = table.concat(lines, "\n")
local filename = output:match('^.*"executable":"(.*)",.*\n.*,"success":true}$')
if filename == nil then
return error("failed to build cargo project")
end
return filename
end
-- Custom debuggable configurations.
dap.configurations.rust = {
{
name = "Debug Test",
type = "lldb",
request = "launch",
program = function ()
return runBuild(ExecTypes.TEST)
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
showDisassembly = "never"
},
{
name = "Debug Bin",
type = "lldb",
request = "launch",
program = function ()
return runBuild(ExecTypes.BIN)
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
showDisassembly = "never"
}
}

View file

@ -3,6 +3,7 @@ require('plugins.packer_setup')
require('packer').startup(function() require('packer').startup(function()
-- Packer can manage itself as an optional plugin -- Packer can manage itself as an optional plugin
use { 'wbthomason/packer.nvim', opt = true } use { 'wbthomason/packer.nvim', opt = true }
use { 'glepnir/nerdicons.nvim', cmd = 'NerdIcons', config = function() require('nerdicons').setup({}) end }
-- Fuzzy finder -- Fuzzy finder
use { use {
@ -38,14 +39,29 @@ require('packer').startup(function()
-- LSP and related -- LSP and related
use { 'neovim/nvim-lspconfig' } use { 'neovim/nvim-lspconfig' }
use { 'aznhe21/actions-preview.nvim' } use { 'aznhe21/actions-preview.nvim' }
use { 'folke/trouble.nvim' } -- lsp diagnostics use { 'folke/trouble.nvim' } -- diagnostics
-- Plugins to extend builtin language support -- Plugins to extend builtin lsp
use { 'cespare/vim-toml' } use { 'cespare/vim-toml' }
use { 'gleam-lang/gleam.vim' } use { 'gleam-lang/gleam.vim' }
use { 'rust-lang/rust.vim' }
use { 'folke/neodev.nvim' } use { 'folke/neodev.nvim' }
use { 'hashivim/vim-terraform' } use { 'hashivim/vim-terraform' }
use {
'mrcjkb/rustaceanvim',
requires = {
'mfussenegger/nvim-dap'
}
}
-- Debugging
use { 'mfussenegger/nvim-dap' }
use {
"rcarriga/nvim-dap-ui",
requires = {
"mfussenegger/nvim-dap",
"nvim-neotest/nvim-nio",
}
}
-- Git -- Git
use { use {
@ -70,6 +86,7 @@ end)
require('plugins.catppuccin') require('plugins.catppuccin')
require('plugins.cmp') require('plugins.cmp')
require('plugins.dap')
require('plugins.gitsigns') require('plugins.gitsigns')
require('plugins.luasnip_config') require('plugins.luasnip_config')
require('plugins.neogit') require('plugins.neogit')

View file

@ -43,7 +43,8 @@ telescope.setup {
treesitter = false treesitter = false
}, },
file_ignore_patterns = { file_ignore_patterns = {
'.git', '.git/',
'.venv/',
}, },
}, },
pickers = { pickers = {
@ -72,7 +73,7 @@ vim.keymap.set('n', '<leader>fh', builtin.help_tags)
vim.keymap.set('n', '<leader>fs', builtin.lsp_dynamic_workspace_symbols) vim.keymap.set('n', '<leader>fs', builtin.lsp_dynamic_workspace_symbols)
-- Grep (the only one). -- Grep (the only one).
vim.keymap.set('n', '<leader>gg', builtin.live_grep) vim.keymap.set('n', '<leader>rg', builtin.live_grep)
-- LSP navigation. -- LSP navigation.
vim.keymap.set('n', '<leader>gd', builtin.lsp_definitions) vim.keymap.set('n', '<leader>gd', builtin.lsp_definitions)

View file

@ -42,6 +42,7 @@ vim.api.nvim_create_autocmd({'InsertLeave', 'BufEnter'}, {
}) })
vim.cmd([[ vim.cmd([[
set title
set noautoread set noautoread
autocmd CursorHold * checktime autocmd CursorHold * checktime
autocmd TextYankPost * lua vim.highlight.on_yank {on_visual = false} autocmd TextYankPost * lua vim.highlight.on_yank {on_visual = false}

View file

@ -1,6 +1,6 @@
# Remove title from windows # Remove title from windows
default_border pixel 1 default_border pixel 2
default_floating_border normal default_floating_border normal
bindsym $mod+t border toggle bindsym $mod+t border toggle
@ -15,14 +15,14 @@ set $bi #3f3f3f
# Foreground active # Foreground active
set $fa #eff1f5 set $fa #eff1f5
# Foreground inactive # Foreground inactive
set $fi #646464 set $fi #8a8a8a
# Border active # Border active
set $bra #9a9a9a set $bra #449a64
# Border inactive # Border inactive
set $bri #000000 set $bri #000000
# class border backgr. text indicator child_border # class border backgr. text indicator child_border
client.focused $bra $bra $bg $bg $bra client.focused $bra $bra $fa $bg $bra
client.focused_inactive $bra $ba $fa $bg $bri client.focused_inactive $bra $ba $fa $bg $bri
client.unfocused $bri $bi $fi $bg $bri client.unfocused $bri $bi $fi $bg $bri
#client.urgent $br $br $fg $bg $br #currently not implemented #client.urgent $br $br $fg $bg $br #currently not implemented

View file

@ -122,9 +122,9 @@
bindsym $mod+z exec swaylock -c 000000 bindsym $mod+z exec swaylock -c 000000
# Take full screen screenshot with PrtScr # Take full screen screenshot with PrtScr
bindsym Print exec grim -t png /tmp/screen.png bindsym Print exec grim -t png ~/screenshot-$(date +%Y-%m-%d-%H%M%S).png
# Take area screenshot with Shift+PrtScr # Take area screenshot with Shift+PrtScr
bindsym Shift+Print exec grim -g "$(slurp)" /tmp/screen.png bindsym Shift+Print exec grim -g "$(slurp)" ~/screenshot-$(date +%Y-%m-%d-%H%M%S).png
# #
# Resizing containers: # Resizing containers:

View file

@ -4,7 +4,7 @@
"height": 30, "height": 30,
"modules-left": ["sway/workspaces", "sway/mode", "sway/window"], "modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
"modules-center": [], "modules-center": [],
"modules-right": ["temperature", "network", "battery", "pulseaudio", "backlight", "cpu", "memory", "custom/layout", "clock", "tray"], "modules-right": ["temperature", "network", "battery", "pulseaudio", "backlight", "cpu", "memory", "clock", "sway/language", "tray"],
// Module config // Module config
"sway/mode": { "sway/mode": {
"tooltip": true, "tooltip": true,
@ -73,10 +73,8 @@
"memory": { "memory": {
"format": " {}%" "format": " {}%"
}, },
"custom/layout": { "sway/language": {
"exec": "~/.config/waybar/keyboard-layout.py", "format": "| <span color='#bdbd45'>{short} {variant}</span>",
"return-type": "json",
"format": "| <span color='#ef9f33'>{}</span>"
}, },
"clock": { "clock": {
"tooltip": false, "tooltip": false,

View file

@ -11,9 +11,12 @@ export RIPGREP_CONFIG_PATH=$HOME/.ripgreprc
export SYSTEMD_EDITOR=$EDITOR export SYSTEMD_EDITOR=$EDITOR
export TERM=alacritty export TERM=alacritty
export PYTHONDONTWRITEBYTECODE=1 export PYTHONDONTWRITEBYTECODE=1
export PYTHONUSERBASE=$HOME/.env/python
export TZ="Europe/Belgrade" export TZ="Europe/Belgrade"
export FZF_DEFAULT_OPTS='--border=horizontal --info=inline --no-reverse --height=50%'
# Local user bins # Local user bins
add_path() case :$PATH: in *:$1:*) ;; *) PATH=$1:$PATH;; esac add_path() case :$PATH: in *:$1:*) ;; *) PATH=$1:$PATH;; esac
add_path $HOME/.local/bin add_path $HOME/.local/bin
add_path $PYTHONUSERBASE/bin
add_path $HOME/.cargo/bin add_path $HOME/.cargo/bin

View file

@ -1,7 +1,7 @@
# vim: set ft=sh: # vim: set ft=sh:
[ -f $HOME/.environ ] && source $HOME/.environ [ -f $HOME/.environ ] && source $HOME/.environ
[ $BASH == "/usr/bin/bash" ] && source $HOME/.bashrc [ -n "$BASH_VERSION" ] && source $HOME/.bashrc
MOZ_ENABLE_WAYLAND=1 MOZ_ENABLE_WAYLAND=1
XDG_CURRENT_DESKTOP=sway XDG_CURRENT_DESKTOP=sway

21
dotfiles/.ripgreprc Normal file
View file

@ -0,0 +1,21 @@
# Don't let ripgrep vomit really long lines to my terminal, and show a preview.
--max-columns=150
--max-columns-preview
# Add my 'web' type.
--type-add
web:*.{html,css,js}*
# Search hidden files / directories (e.g. dotfiles) by default
--hidden
# Using glob patterns to include/exclude files or folders
--glob
!.git/*
# Set the colors.
--colors=line:none
--colors=line:style:bold
# Because who cares about case!?
--smart-case