Compare commits
2 Commits
main
...
based-neov
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e84c2f591 | |||
| 28598c5e1d |
@ -19,3 +19,5 @@
|
|||||||
required = true
|
required = true
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = main
|
defaultBranch = main
|
||||||
|
[url "https://x-access-token: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@github.com/"]
|
||||||
|
insteadOf = https://github.com/
|
||||||
|
|||||||
45
.zshrc
45
.zshrc
@ -14,22 +14,31 @@ plug "zsh-users/zsh-syntax-highlighting"
|
|||||||
plug "wintermi/zsh-lsd"
|
plug "wintermi/zsh-lsd"
|
||||||
plug "romkatv/powerlevel10k"
|
plug "romkatv/powerlevel10k"
|
||||||
# plug "zap-zsh/nvm"
|
# plug "zap-zsh/nvm"
|
||||||
#
|
|
||||||
#
|
|
||||||
# # Load and initialise completion system
|
# Load and initialise completion system
|
||||||
# autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
# fpath+=~/.zfunc
|
fpath+=~/.zfunc
|
||||||
# compinit
|
compinit
|
||||||
|
|
||||||
# # nvm initialization
|
# # nvm initialization
|
||||||
# source /usr/share/nvm/init-nvm.sh
|
# source /usr/share/nvm/init-nvm.sh
|
||||||
XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-sway}"
|
|
||||||
MOZ_ENABLE_WAYLAND=1
|
|
||||||
|
|
||||||
alias v="nvim"
|
alias v="nvim"
|
||||||
alias conservation-on="sudo ectool chargecontrol normal 80 80"
|
alias conservation-on="sudo ectool chargecontrol normal 80 80"
|
||||||
alias conservation-off="sudo ectool chargecontrol normal"
|
alias conservation-off="sudo ectool chargecontrol normal"
|
||||||
alias orphans="sudo pacman -Qtdq | sudo pacman -Rns -"
|
# alias orphans="sudo pacman -Qtdq | sudo pacman -Rns -"
|
||||||
|
|
||||||
|
# Define variables for monitor names
|
||||||
|
LAPTOP_MONITOR="eDP-1"
|
||||||
|
EXTERNAL_MONITOR="DP-2"
|
||||||
|
|
||||||
|
# Alias to disable laptop screen (only if external is connected)
|
||||||
|
alias laptop-screen-off='if xrandr | grep "$EXTERNAL_MONITOR connected"; then swaymsg output $LAPTOP_MONITOR disable; echo "Laptop screen disabled."; else echo "External monitor not connected. Keeping laptop screen on."; fi'
|
||||||
|
|
||||||
|
# Alias to enable laptop screen
|
||||||
|
alias laptop-screen-on='swaymsg output $LAPTOP_MONITOR enable; echo "Laptop screen enabled."'
|
||||||
|
|
||||||
|
|
||||||
alias space="du -hsx * | sort -rh | head -10"
|
alias space="du -hsx * | sort -rh | head -10"
|
||||||
|
|
||||||
@ -38,12 +47,14 @@ export GPG_TTY=$(tty)
|
|||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
|
|
||||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||||
|
|
||||||
|
|
||||||
|
source ~/.cargo/env
|
||||||
|
|
||||||
|
export GOROOT="$HOME/.local/bin/go"
|
||||||
|
export GOPATH="$HOME/.go"
|
||||||
|
export PATH="$GOROOT/bin:$GOPATH/bin:$PATH"
|
||||||
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||||
|
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||||
|
|
||||||
|
|
||||||
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
|
|
||||||
export SDKMAN_DIR="$HOME/.sdkman"
|
|
||||||
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
|
|
||||||
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
|
||||||
|
|||||||
@ -17,5 +17,3 @@ npm config set prefix '~/.npm-global'
|
|||||||
|
|
||||||
FONT
|
FONT
|
||||||
https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/Inconsolata.zip
|
https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/Inconsolata.zip
|
||||||
- (guida per installare i nerd fonts)[https://blog.khmersite.net/p/installing-nerd-font-on-fedora/]
|
|
||||||
- (iosevka)[https://release-assets.githubusercontent.com/github-production-release-asset/27574418/da264fe4-47cc-4350-acd3-4435de81106e?sp=r&sv=2018-11-09&sr=b&spr=https&se=2025-10-23T07%3A54%3A53Z&rscd=attachment%3B+filename%3DIntelOneMono.zip&rsct=application%2Foctet-stream&skoid=96c2d410-5711-43a1-aedd-ab1947aa7ab0&sktid=398a6654-997b-47e9-b12b-9515b896b4de&skt=2025-10-23T06%3A54%3A07Z&ske=2025-10-23T07%3A54%3A53Z&sks=b&skv=2018-11-09&sig=mxyF4BWvhxi8ePVdXlPnWk6t3vY5m5xd4t7W%2BRZhL%2FU%3D&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmVsZWFzZS1hc3NldHMuZ2l0aHVidXNlcmNvbnRlbnQuY29tIiwia2V5Ijoia2V5MSIsImV4cCI6MTc2MTIwNDkzMywibmJmIjoxNzYxMjAzMTMzLCJwYXRoIjoicmVsZWFzZWFzc2V0cHJvZHVjdGlvbi5ibG9iLmNvcmUud2luZG93cy5uZXQifQ.m4n0dZ3ElI-zBBX281ciSWgdS8tedJihBq-_FfVpY1E&response-content-disposition=attachment%3B%20filename%3DIntelOneMono.zip&response-content-type=application%2Foctet-stream]
|
|
||||||
|
|||||||
4
link.sh
4
link.sh
@ -1,7 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# ln -s ~/Documents/dotfiles/alacritty ~/.config/
|
ln -s ~/Documents/dotfiles/alacritty ~/.config/
|
||||||
ln -s ~/Documents/dotfiles/foot ~/.config/
|
ln -s ~/Documents/dotfiles/foot ~/.config/
|
||||||
|
ln -s ~/Documents/dotfiles/.gitconfig ~/
|
||||||
ln -s ~/Documents/dotfiles/mako ~/.config/
|
ln -s ~/Documents/dotfiles/mako ~/.config/
|
||||||
ln -s ~/Documents/dotfiles/mpv ~/.config/
|
ln -s ~/Documents/dotfiles/mpv ~/.config/
|
||||||
ln -s ~/Documents/dotfiles/nvim ~/.config/
|
ln -s ~/Documents/dotfiles/nvim ~/.config/
|
||||||
@ -14,4 +15,3 @@ ln -s ~/Documents/dotfiles/wofi ~/.config/
|
|||||||
ln -s ~/Documents/dotfiles/yt-dlp ~/.config/
|
ln -s ~/Documents/dotfiles/yt-dlp ~/.config/
|
||||||
ln -s ~/Documents/dotfiles/zathura ~/.config/
|
ln -s ~/Documents/dotfiles/zathura ~/.config/
|
||||||
ln -s ~/Documents/dotfiles/.zshrc ~/
|
ln -s ~/Documents/dotfiles/.zshrc ~/
|
||||||
ln -s ~/Documents/dotfiles/.gitconfig ~/
|
|
||||||
|
|||||||
@ -22,6 +22,3 @@ profile=high-quality
|
|||||||
scale=ewa_lanczossharp
|
scale=ewa_lanczossharp
|
||||||
cscale=ewa_lanczossharp
|
cscale=ewa_lanczossharp
|
||||||
|
|
||||||
|
|
||||||
loop-playlist=inf
|
|
||||||
shuffle=yes
|
|
||||||
|
|||||||
@ -1,243 +0,0 @@
|
|||||||
Excellent question. The fact that this happens *sometimes* is the key to understanding the problem. It points to a race condition or a conflict between the different services managing your network, specifically `NetworkManager` and `systemd-resolved`, based on the information your router is providing.
|
|
||||||
|
|
||||||
Here's a breakdown of the moving parts and why they sometimes fail to cooperate.
|
|
||||||
|
|
||||||
### The Actors on Your System
|
|
||||||
|
|
||||||
1. **The Router (The Source of Truth):**
|
|
||||||
* When you connect to Wi-Fi, your router provides network configuration information.
|
|
||||||
* For IPv4, it uses **DHCP** to give you an IP address, a gateway, and DNS servers.
|
|
||||||
* For IPv6, it uses **Router Advertisements (RAs)** and/or **DHCPv6**. RAs can include information about which DNS servers to use.
|
|
||||||
* **The Core Issue:** Some routers, especially consumer-grade ones, are poorly configured. They advertise their own **link-local** (`fe80::...`) address as the DNS server in their IPv6 RAs. This is technically valid but problematic for many client systems.
|
|
||||||
|
|
||||||
2. **NetworkManager (The Connection Manager):**
|
|
||||||
* Its job is to manage network interfaces (like `wlp1s0`). It brings the Wi-Fi up, handles authentication, and listens for the configuration data from your router (both DHCP and RAs).
|
|
||||||
* When it receives the DNS server information, it needs to pass it on to the system's resolver.
|
|
||||||
|
|
||||||
3. **systemd-resolved (The DNS Resolver):**
|
|
||||||
* This is the service that actually performs the DNS lookups for your applications (like your web browser). It's designed to be a central clearinghouse for DNS. It maintains a list of all DNS servers learned from all network interfaces, caches results, and can handle advanced protocols like DNS-over-TLS.
|
|
||||||
|
|
||||||
### The Conflict: Who Controls `/etc/resolv.conf`?
|
|
||||||
|
|
||||||
The problem arises from how `NetworkManager` and `systemd-resolved` are configured to interact, and which one gets the final say over the `/etc/resolv.conf` file. There are two common modes:
|
|
||||||
|
|
||||||
1. **Mode A: `NetworkManager` is in control (Your likely situation).**
|
|
||||||
* In this setup, `NetworkManager` takes the DNS server information it receives from the router and writes it *directly* into `/etc/resolv.conf`.
|
|
||||||
* The file comment `# Generated by NetworkManager` is the evidence for this.
|
|
||||||
* When your router sends that bad `fe80::1%wlp1s0` address, `NetworkManager` dutifully writes it into the file, and your system's DNS breaks.
|
|
||||||
|
|
||||||
2. **Mode B: `systemd-resolved` is in control (The modern, recommended setup).**
|
|
||||||
* `NetworkManager` is configured to pass all the DNS information it learns to `systemd-resolved` via an internal system bus (D-Bus).
|
|
||||||
* `systemd-resolved` then manages the DNS servers internally.
|
|
||||||
* `/etc/resolv.conf` is then symlinked to a file managed by `systemd-resolved` (like `/run/systemd/resolve/stub-resolv.conf`), which contains only `nameserver 127.0.0.53`. This points all system queries to the local `systemd-resolved` daemon, which then intelligently forwards them to the correct upstream servers.
|
|
||||||
|
|
||||||
### Why "Sometimes"? The Race Condition
|
|
||||||
|
|
||||||
The fact that it's intermittent strongly suggests a race condition between your IPv4 and IPv6 configuration on startup or reconnect.
|
|
||||||
|
|
||||||
* **Scenario 1 (Everything Works):** Your system connects, the IPv4 DHCP negotiation finishes first. `NetworkManager` gets a valid IPv4 DNS server (e.g., `8.8.8.8` or your ISP's) and writes it to `/etc/resolv.conf`. A moment later, the problematic IPv6 RA arrives, but `NetworkManager` might prioritize or already be using the working IPv4 server.
|
|
||||||
* **Scenario 2 (DNS Breaks):** Your system connects, but the IPv6 Router Advertisement is processed first. `NetworkManager` receives the `fe80::1%wlp1s0` address and writes it to `/etc/resolv.conf`. DNS is broken from the start. A few moments later, the IPv4 address might arrive, but `NetworkManager` might not update the config file, leaving the broken one in place. This can also happen after waking from suspend. Such intermittent failures are a known class of bugs [github.com](https://github.com/systemd/systemd/issues/21123).
|
|
||||||
|
|
||||||
As one user on a forum described a similar situation, "After doing a -Syu and reboot, I no longer have access to the internet system-wide. I can ping 8.8.8.8 but not ping google.com" – this is the classic symptom you are experiencing [forum.endeavouros.com](https://forum.endeavouros.com/t/no-internet-dns-issues-after-update-networkmanager-systemd-resolved-on-kde/69865).
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### How to Verify and Fix This Permanently
|
|
||||||
|
|
||||||
The best solution is to switch to the modern setup where `systemd-resolved` is in full control.
|
|
||||||
|
|
||||||
#### Step 1: Check Your Current `resolv.conf` Setup
|
|
||||||
|
|
||||||
Run this command to see what `/etc/resolv.conf` really is:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ls -l /etc/resolv.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
* **If it shows a file (`-rw-r--r-- ...`)**, you are in the problematic Mode A.
|
|
||||||
* **If it shows a symlink (`lrwxrwxrwx ... -> ../run/systemd/resolve/stub-resolv.conf`)**, you are in Mode B, but `NetworkManager` might still be misconfigured.
|
|
||||||
|
|
||||||
#### Step 2: Configure NetworkManager to Use `systemd-resolved`
|
|
||||||
|
|
||||||
1. Edit the main NetworkManager configuration file:
|
|
||||||
```bash
|
|
||||||
sudo nano /etc/NetworkManager/NetworkManager.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
2. In the `[main]` section, add or uncomment the `dns` line and set it to `systemd-resolved`:
|
|
||||||
```ini
|
|
||||||
[main]
|
|
||||||
plugins=ifupdown,keyfile
|
|
||||||
dns=systemd-resolved
|
|
||||||
|
|
||||||
[ifupdown]
|
|
||||||
managed=false
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Save the file and exit.
|
|
||||||
|
|
||||||
#### Step 3: Enable `systemd-resolved` and Create the Correct Symlink
|
|
||||||
|
|
||||||
1. First, ensure the service is running:
|
|
||||||
```bash
|
|
||||||
sudo systemctl enable systemd-resolved.service
|
|
||||||
sudo systemctl start systemd-resolved.service
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Next, remove the static file and create the correct symlink. This forces the system to use the local `systemd-resolved` stub resolver.
|
|
||||||
```bash
|
|
||||||
# IMPORTANT: Back up the old file first
|
|
||||||
sudo mv /etc/resolv.conf /etc/resolv.conf.bak
|
|
||||||
|
|
||||||
# Create the symlink
|
|
||||||
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Step 4: Restart and Verify
|
|
||||||
|
|
||||||
Restart `NetworkManager` to apply all the changes.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo systemctl restart NetworkManager
|
|
||||||
```
|
|
||||||
|
|
||||||
Now, your DNS should work reliably. Check your `resolv.conf` to confirm it points to `127.0.0.53`. To see the *actual* DNS servers your system is now using (which it gets from `NetworkManager`), use the `resolvectl` command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
resolvectl status
|
|
||||||
```
|
|
||||||
|
|
||||||
This will give you a detailed report, showing the DNS servers for each interface (like `wlp1s0`). Even if the problematic `fe80::` address is listed there, `systemd-resolved` is smart enough to ignore or fall back from it if it doesn't work, preventing a total DNS outage.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Excellent! You've correctly identified that you're in "Mode A," where `NetworkManager` writes directly to `/etc/resolv.conf`. Switching to the modern approach where `systemd-resolved` handles everything is the most robust and permanent solution.
|
|
||||||
|
|
||||||
Let's walk through the process step-by-step. This is a standard and safe procedure on most modern Linux distributions.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Step-by-Step Guide to Switch to `systemd-resolved`
|
|
||||||
|
|
||||||
We are going to reconfigure your system so that:
|
|
||||||
1. `NetworkManager` passes DNS information to `systemd-resolved`.
|
|
||||||
2. `systemd-resolved` manages all DNS lookups.
|
|
||||||
3. `/etc/resolv.conf` points to the local `systemd-resolved` service.
|
|
||||||
|
|
||||||
#### Step 1: Configure NetworkManager
|
|
||||||
|
|
||||||
First, we need to tell `NetworkManager` to stop managing `/etc/resolv.conf` by itself and start sending its DNS information to `systemd-resolved`.
|
|
||||||
|
|
||||||
1. Open the `NetworkManager.conf` file with a text editor and `sudo` privileges:
|
|
||||||
```bash
|
|
||||||
sudo nano /etc/NetworkManager/NetworkManager.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Find the `[main]` section. Add a `dns` line and set it to `systemd-resolved`. If the line already exists but is set to something else (like `default`), change it.
|
|
||||||
|
|
||||||
**Your file should look like this:**
|
|
||||||
```ini
|
|
||||||
[main]
|
|
||||||
plugins=ifupdown,keyfile
|
|
||||||
dns=systemd-resolved
|
|
||||||
|
|
||||||
[ifupdown]
|
|
||||||
managed=false
|
|
||||||
```
|
|
||||||
*(Note: You might have other settings in the `[main]` section. Just make sure the `dns=systemd-resolved` line is present and correct.)*
|
|
||||||
|
|
||||||
3. Save the file and exit the editor (in `nano`, press `Ctrl+O`, then `Enter` to save, and `Ctrl+X` to exit).
|
|
||||||
|
|
||||||
#### Step 2: Enable and Start `systemd-resolved`
|
|
||||||
|
|
||||||
Now, let's make sure the `systemd-resolved` service is active and will start automatically on boot.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Enable the service to start on every boot
|
|
||||||
sudo systemctl enable systemd-resolved.service
|
|
||||||
|
|
||||||
# Start the service right now
|
|
||||||
sudo systemctl start systemd-resolved.service
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Step 3: Recreate `/etc/resolv.conf` as a Symlink
|
|
||||||
|
|
||||||
This is the most important step. We will replace the static file that `NetworkManager` used to write with a symbolic link to the `resolv.conf` file that `systemd-resolved` provides.
|
|
||||||
|
|
||||||
1. **Important:** Back up your current `resolv.conf` file. This lets you easily revert if something goes wrong.
|
|
||||||
```bash
|
|
||||||
sudo mv /etc/resolv.conf /etc/resolv.conf.bak
|
|
||||||
```
|
|
||||||
This command safely renames the file.
|
|
||||||
|
|
||||||
2. Create the new symbolic link:
|
|
||||||
```bash
|
|
||||||
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
|
||||||
```
|
|
||||||
This links `/etc/resolv.conf` to the "stub" resolver file, which correctly points all DNS queries to the local `systemd-resolved` daemon.
|
|
||||||
|
|
||||||
#### Step 4: Restart NetworkManager and Verify
|
|
||||||
|
|
||||||
Finally, restart `NetworkManager` to apply all the changes and verify that everything is working.
|
|
||||||
|
|
||||||
1. Restart the service:
|
|
||||||
```bash
|
|
||||||
sudo systemctl restart NetworkManager
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Verify the symlink:** Check that `/etc/resolv.conf` is now a link.
|
|
||||||
```bash
|
|
||||||
ls -l /etc/resolv.conf
|
|
||||||
```
|
|
||||||
The output should look like this (colors and dates will vary):
|
|
||||||
```
|
|
||||||
lrwxrwxrwx 1 root root 39 Nov 18 10:30 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Verify the content:** Check what's inside the new `resolv.conf`.
|
|
||||||
```bash
|
|
||||||
cat /etc/resolv.conf
|
|
||||||
```
|
|
||||||
The output should show `127.0.0.53` as the nameserver. This is the local `systemd-resolved` stub resolver.
|
|
||||||
```
|
|
||||||
# This file is managed by man:systemd-resolved(8). Do not edit.
|
|
||||||
...
|
|
||||||
nameserver 127.0.0.53
|
|
||||||
options edns0 trust-ad
|
|
||||||
```
|
|
||||||
|
|
||||||
4. **Check the REAL DNS servers:** Use `resolvectl` to see which DNS servers `systemd-resolved` is actually using (which it learned from `NetworkManager`).
|
|
||||||
```bash
|
|
||||||
resolvectl status
|
|
||||||
```
|
|
||||||
This will give you a detailed report. Look for the section corresponding to your Wi-Fi interface (`wlp1s0`). You will see the actual IP addresses of the DNS servers it is using. Even if the problematic `fe80::` address is listed, `systemd-resolved` is much more resilient and will fall back to other working servers.
|
|
||||||
|
|
||||||
5. **Final Test:**
|
|
||||||
```bash
|
|
||||||
ping archlinux.org
|
|
||||||
```
|
|
||||||
If you get a reply, congratulations! Your DNS is now being managed robustly by `systemd-resolved`.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### How to Revert (If Needed)
|
|
||||||
|
|
||||||
If anything goes wrong, you can easily go back to the old setup:
|
|
||||||
|
|
||||||
1. **Restore the old `resolv.conf`:**
|
|
||||||
```bash
|
|
||||||
sudo mv /etc/resolv.conf.bak /etc/resolv.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
2. **Edit `NetworkManager.conf` again:**
|
|
||||||
```bash
|
|
||||||
sudo nano /etc/NetworkManager/NetworkManager.conf
|
|
||||||
```
|
|
||||||
Remove the `dns=systemd-resolved` line, or change it back to `dns=default`.
|
|
||||||
|
|
||||||
3. **Restart NetworkManager:**
|
|
||||||
```bash
|
|
||||||
sudo systemctl restart NetworkManager
|
|
||||||
```
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
root = true
|
root = true
|
||||||
|
|
||||||
# Unix-style newlines with a newline ending every file
|
|
||||||
[*.lua]
|
[*.lua]
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|||||||
0
nvim/after/ftplugin/lua.lua
Normal file
0
nvim/after/ftplugin/lua.lua
Normal file
@ -1,4 +1,3 @@
|
|||||||
require("kanopo.options")
|
require("kanopo.options")
|
||||||
require("kanopo.keymaps")
|
|
||||||
require("kanopo.autocmds")
|
require("kanopo.autocmds")
|
||||||
require("kanopo.lazy")
|
require("kanopo.plugins")
|
||||||
|
|||||||
@ -1,3 +1,16 @@
|
|||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||||
|
callback = function(args)
|
||||||
|
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
|
if client:supports_method('textDocument/completion') then
|
||||||
|
-- Optional: trigger autocompletion on EVERY keypress. May be slow!
|
||||||
|
local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
|
||||||
|
client.server_capabilities.completionProvider.triggerCharacters = chars
|
||||||
|
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Highlight yanked text
|
-- Highlight yanked text
|
||||||
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
|||||||
@ -1,35 +0,0 @@
|
|||||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
|
||||||
-- See `:help hlsearch`
|
|
||||||
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
|
||||||
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
|
|
||||||
|
|
||||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
|
||||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
|
||||||
-- is not what someone will guess without a bit more experience.
|
|
||||||
--
|
|
||||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
|
||||||
-- or just use <C-\><C-n> to exit terminal mode
|
|
||||||
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
|
||||||
|
|
||||||
-- TIP: Disable arrow keys in normal mode
|
|
||||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
|
||||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
|
||||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
|
||||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
|
||||||
|
|
||||||
-- Keybinds to make split navigation easier.
|
|
||||||
-- Use CTRL+<hjkl> to switch between windows
|
|
||||||
--
|
|
||||||
-- See `:help wincmd` for a list of all window commands
|
|
||||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
|
||||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
|
||||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
|
||||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
|
||||||
|
|
||||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
|
||||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
|
||||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
-- Bootstrap lazy.nvim
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|
||||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
|
||||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
|
||||||
if vim.v.shell_error ~= 0 then
|
|
||||||
vim.api.nvim_echo({
|
|
||||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
|
||||||
{ out, "WarningMsg" },
|
|
||||||
{ "\nPress any key to exit..." },
|
|
||||||
}, true, {})
|
|
||||||
vim.fn.getchar()
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
require("lazy").setup("kanopo.plugins")
|
|
||||||
@ -1,3 +1,31 @@
|
|||||||
|
--
|
||||||
|
-- vim.o.relativenumber = true
|
||||||
|
-- vim.o.wrap = false
|
||||||
|
-- vim.o.tabstop = 4
|
||||||
|
-- vim.o.swapfile = false
|
||||||
|
-- vim.g.mapleader = " "
|
||||||
|
-- vim.g.maplocalleader = " "
|
||||||
|
-- vim.g.have_nerd_font = true
|
||||||
|
-- vim.o.termguicolors = true
|
||||||
|
-- vim.o.cursorline = true
|
||||||
|
-- vim.o.clipboard = "unnamedplus"
|
||||||
|
-- vim.o.signcolumn = "yes"
|
||||||
|
-- vim.o.colorcolumn = "100"
|
||||||
|
-- vim.o.winborder = "rounded"
|
||||||
|
-- vim.o.completeopt = "menu,menuone,noinsert,noselect"
|
||||||
|
--
|
||||||
|
-- vim.o.shortmess = vim.o.shortmess .. "c" -- reduce “match 1 of 5” messages
|
||||||
|
-- vim.opt.ignorecase = true
|
||||||
|
-- vim.opt.smartcase = true
|
||||||
|
-- vim.opt.wrap = true
|
||||||
|
-- vim.opt.breakindent = true
|
||||||
|
-- vim.opt.expandtab = true
|
||||||
|
-- vim.opt.tabstop = 2
|
||||||
|
-- vim.opt.softtabstop = 2
|
||||||
|
-- vim.opt.shiftwidth = 2
|
||||||
|
-- vim.opt.splitright = true
|
||||||
|
-- vim.opt.splitbelow = true
|
||||||
|
-- vim.opt.undofile = true
|
||||||
-- Leader keys (set early)
|
-- Leader keys (set early)
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = " "
|
vim.g.maplocalleader = " "
|
||||||
@ -21,13 +49,7 @@ vim.o.splitbelow = true -- open horizontal splits below
|
|||||||
-- Editing behavior
|
-- Editing behavior
|
||||||
vim.o.wrap = false -- do not wrap lines by default
|
vim.o.wrap = false -- do not wrap lines by default
|
||||||
vim.o.breakindent = true -- keep indentation on wrapped lines (if wrap is enabled later)
|
vim.o.breakindent = true -- keep indentation on wrapped lines (if wrap is enabled later)
|
||||||
-- Sync clipboard between OS and Neovim.
|
vim.o.clipboard = "unnamedplus" -- use system clipboard
|
||||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
|
||||||
-- See `:help 'clipboard'`
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.o.clipboard = "unnamedplus"
|
|
||||||
end)
|
|
||||||
vim.o.swapfile = false -- no swapfiles
|
vim.o.swapfile = false -- no swapfiles
|
||||||
vim.o.undofile = true -- persistent undo
|
vim.o.undofile = true -- persistent undo
|
||||||
vim.o.writebackup = false -- do not keep backup around
|
vim.o.writebackup = false -- do not keep backup around
|
||||||
@ -81,14 +103,26 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.o.mouse = "a"
|
-- Example: make files that often use 4 spaces actually use 4
|
||||||
|
-- Uncomment if you prefer 4 for these stacks
|
||||||
|
-- vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
-- group = ft_augroup,
|
||||||
|
-- pattern = { "python", "go", "rust" },
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.bo.tabstop = 4
|
||||||
|
-- vim.bo.shiftwidth = 4
|
||||||
|
-- vim.bo.softtabstop = 4
|
||||||
|
-- vim.bo.expandtab = true
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
vim.o.showmode = false
|
-- Spell checking (optional; example)
|
||||||
|
-- vim.opt.spell = true
|
||||||
vim.o.list = true
|
-- vim.opt.spelllang = "en,it"
|
||||||
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
-- local spell_dir = vim.fn.stdpath("data") .. "/spell"
|
||||||
|
-- vim.opt.spellfile = {
|
||||||
-- Preview substitutions live, as you type!
|
-- spell_dir .. "/en.utf-8.add",
|
||||||
vim.o.inccommand = "split"
|
-- spell_dir .. "/it.utf-8.add",
|
||||||
|
-- "~/.config/nvim/spell/en.proj.spl",
|
||||||
vim.o.confirm = true
|
-- "~/.config/nvim/spell/it.proj.spl",
|
||||||
|
-- }
|
||||||
|
|||||||
17
nvim/lua/kanopo/plugins/auto-pairs.lua
Normal file
17
nvim/lua/kanopo/plugins/auto-pairs.lua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
-- autopairs.lua
|
||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/windwp/nvim-autopairs" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Load packs on first InsertEnter and configure
|
||||||
|
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
pcall(function()
|
||||||
|
require("nvim-autopairs").setup({
|
||||||
|
disable_filetype = { "TelescopePrompt", "vim" },
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
@ -1,9 +0,0 @@
|
|||||||
return {
|
|
||||||
"windwp/nvim-autopairs",
|
|
||||||
event = "InsertEnter",
|
|
||||||
config = function()
|
|
||||||
require("nvim-autopairs").setup({
|
|
||||||
disable_filetype = { "TelescopePrompt", "vim" },
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
return {
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"ellisonleao/gruvbox.nvim",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local theme = require("gruvbox")
|
|
||||||
require("lualine").setup({
|
|
||||||
theme = theme,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@ -1,84 +1,28 @@
|
|||||||
return { -- Autocompletion
|
vim.pack.add({
|
||||||
"saghen/blink.cmp",
|
{ src = "https://github.com/saghen/blink.cmp", version = "1.*" },
|
||||||
event = "VimEnter",
|
{ src = "https://github.com/rafamadriz/friendly-snippets" }
|
||||||
version = "1.*",
|
})
|
||||||
dependencies = {
|
|
||||||
{
|
-- Load packs on startup (guard for nightlies without load)
|
||||||
"L3MON4D3/LuaSnip",
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
version = "2.*",
|
once = true,
|
||||||
build = (function()
|
callback = function()
|
||||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
return
|
|
||||||
end
|
-- Preload neogit module if available (optional)
|
||||||
return "make install_jsregexp"
|
pcall(function()
|
||||||
end)(),
|
require("blink").setup({
|
||||||
dependencies = {
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept):
|
||||||
-- `friendly-snippets` contains a variety of premade snippets.
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
-- See the README about individual language/framework/plugin snippets:
|
-- 'enter' for enter to accept
|
||||||
-- https://github.com/rafamadriz/friendly-snippets
|
-- 'none' for no mappings
|
||||||
{
|
-- All presets have the following mappings:
|
||||||
"rafamadriz/friendly-snippets",
|
-- C-space: Open menu or open docs if already open
|
||||||
config = function()
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
keymap = { preset = 'default' },
|
||||||
|
})
|
||||||
|
end)
|
||||||
end,
|
end,
|
||||||
},
|
})
|
||||||
},
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
"folke/lazydev.nvim",
|
|
||||||
},
|
|
||||||
--- @module 'blink.cmp'
|
|
||||||
--- @type blink.cmp.Config
|
|
||||||
opts = {
|
|
||||||
keymap = {
|
|
||||||
-- set to 'none' to disable the 'default' preset
|
|
||||||
preset = "none",
|
|
||||||
|
|
||||||
["<C-k>"] = { "select_prev", "fallback" },
|
|
||||||
["<C-j>"] = { "select_next", "fallback" },
|
|
||||||
["<C-b>"] = { "scroll_documentation_up", "fallback" },
|
|
||||||
["<C-f>"] = { "scroll_documentation_down", "fallback" },
|
|
||||||
["<Tab>"] = { "snippet_forward", "fallback" },
|
|
||||||
["<S-Tab>"] = { "snippet_backward", "fallback" },
|
|
||||||
-- ["<S-Tab>"] = { "select_prev", "fallback" },
|
|
||||||
-- ["<Tab>"] = { "select_next", "fallback" },
|
|
||||||
|
|
||||||
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
|
|
||||||
["<CR>"] = { "select_and_accept", "fallback" },
|
|
||||||
["<C-e>"] = { "hide", "fallback" },
|
|
||||||
|
|
||||||
["<C-s>"] = { "show_signature", "hide_signature", "fallback" },
|
|
||||||
},
|
|
||||||
|
|
||||||
appearance = {
|
|
||||||
nerd_font_variant = "mono",
|
|
||||||
},
|
|
||||||
|
|
||||||
completion = {
|
|
||||||
-- By default, you may press `<c-space>` to show the documentation.
|
|
||||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
|
||||||
documentation = { auto_show = false, auto_show_delay_ms = 500 },
|
|
||||||
},
|
|
||||||
|
|
||||||
sources = {
|
|
||||||
default = { "lsp", "path", "snippets", "lazydev" },
|
|
||||||
providers = {
|
|
||||||
lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
snippets = { preset = "luasnip" },
|
|
||||||
|
|
||||||
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
|
|
||||||
-- which automatically downloads a prebuilt binary when enabled.
|
|
||||||
--
|
|
||||||
-- By default, we use the Lua implementation instead, but you may enable
|
|
||||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
|
||||||
--
|
|
||||||
-- See :h blink-cmp-config-fuzzy for more information
|
|
||||||
fuzzy = { implementation = "lua" },
|
|
||||||
|
|
||||||
-- Shows a signature help window while you type arguments for a function
|
|
||||||
signature = { enabled = true },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
return {
|
|
||||||
"folke/todo-comments.nvim",
|
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
|
||||||
opts = {
|
|
||||||
signs = true,
|
|
||||||
keywords = {
|
|
||||||
TODO = { icon = "🤨", color = "info" },
|
|
||||||
WIP = { icon = "🥵", color = "warning" },
|
|
||||||
ERR = { icon = "🤬", color = "error" },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +1,19 @@
|
|||||||
return {
|
-- dressing.lua
|
||||||
"stevearc/dressing.nvim",
|
vim.pack.add({
|
||||||
opts = {
|
{ src = "https://github.com/stevearc/dressing.nvim" },
|
||||||
inputs = {
|
})
|
||||||
enable = true,
|
|
||||||
}
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
pcall(function()
|
||||||
|
require("dressing").setup({
|
||||||
|
input = {
|
||||||
|
enabled = true, -- matches your opts.inputs.enable = true
|
||||||
},
|
},
|
||||||
}
|
-- You can add selector config here if desired
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
14
nvim/lua/kanopo/plugins/fidget.lua
Normal file
14
nvim/lua/kanopo/plugins/fidget.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/j-hui/fidget.nvim", version = "main" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Load packs on startup and configure fidget safely
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
pcall(function()
|
||||||
|
require("fidget").setup({})
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
return { -- Autoformat
|
|
||||||
"stevearc/conform.nvim",
|
|
||||||
event = { "BufWritePre" },
|
|
||||||
cmd = { "ConformInfo" },
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>f",
|
|
||||||
function()
|
|
||||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
|
||||||
end,
|
|
||||||
mode = "",
|
|
||||||
desc = "[F]ormat buffer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
notify_on_error = false,
|
|
||||||
format_on_save = function(bufnr)
|
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
|
||||||
-- have a well standardized coding style. You can add additional
|
|
||||||
-- languages here or re-enable it for the disabled ones.
|
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
|
||||||
return nil
|
|
||||||
else
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_format = "fallback",
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
formatters_by_ft = {
|
|
||||||
lua = { "stylua" },
|
|
||||||
-- Conform can also run multiple formatters sequentially
|
|
||||||
-- python = { "isort", "black" },
|
|
||||||
--
|
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@ -1,16 +1,37 @@
|
|||||||
return {
|
-- Declare plugins
|
||||||
"NeogitOrg/neogit",
|
vim.pack.add({
|
||||||
dependencies = {
|
{ src = "https://github.com/NeogitOrg/neogit" },
|
||||||
"nvim-lua/plenary.nvim",
|
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
|
||||||
"sindrets/diffview.nvim",
|
})
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
},
|
-- Load packs on startup (guard for nightlies without load)
|
||||||
-- config = function()
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
-- require("neogit").setup()
|
once = true,
|
||||||
-- vim.keymap.set("n", "<leader>gg", "<cmd>Neogit<cr>", { desc = "Neogit" })
|
callback = function()
|
||||||
-- end,
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
opts = true,
|
|
||||||
keys = {
|
-- Configure gitsigns (safe pcall)
|
||||||
{ "<leader>gg", "<cmd>Neogit<cr>", desc = "Neogit" },
|
pcall(function()
|
||||||
},
|
require("gitsigns").setup()
|
||||||
}
|
end)
|
||||||
|
|
||||||
|
-- Preload neogit module if available (optional)
|
||||||
|
pcall(function()
|
||||||
|
require("neogit")
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Keymap: open Neogit (on-demand load if needed)
|
||||||
|
vim.keymap.set("n", "<leader>gg", function()
|
||||||
|
local ok, neogit = pcall(require, "neogit")
|
||||||
|
if not ok then
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
ok, neogit = pcall(require, "neogit")
|
||||||
|
end
|
||||||
|
if ok then
|
||||||
|
neogit.open({})
|
||||||
|
else
|
||||||
|
vim.notify("neogit not available yet", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end, { desc = "Open Neogit" })
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
return {
|
|
||||||
"lewis6991/gitsigns.nvim",
|
|
||||||
event = "BufRead",
|
|
||||||
opts = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
12
nvim/lua/kanopo/plugins/init.lua
Normal file
12
nvim/lua/kanopo/plugins/init.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
require("kanopo.plugins.lazydev")
|
||||||
|
require("kanopo.plugins.oil")
|
||||||
|
require("kanopo.plugins.theme")
|
||||||
|
require("kanopo.plugins.treesitter")
|
||||||
|
require("kanopo.plugins.telescope")
|
||||||
|
require("kanopo.plugins.cmp")
|
||||||
|
require("kanopo.plugins.lsp")
|
||||||
|
require("kanopo.plugins.which-key")
|
||||||
|
require("kanopo.plugins.git")
|
||||||
|
require("kanopo.plugins.fidget")
|
||||||
|
require("kanopo.plugins.dressing")
|
||||||
|
require("kanopo.plugins.auto-pairs")
|
||||||
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
return {
|
|
||||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
|
||||||
-- used for completion, annotations and signatures of Neovim apis
|
|
||||||
"folke/lazydev.nvim",
|
|
||||||
ft = "lua",
|
|
||||||
opts = {
|
|
||||||
library = {
|
|
||||||
-- Load luvit types when the `vim.uv` word is found
|
|
||||||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
10
nvim/lua/kanopo/plugins/lazydev.lua
Normal file
10
nvim/lua/kanopo/plugins/lazydev.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
"https://github.com/folke/lazydev.nvim"
|
||||||
|
})
|
||||||
|
require("lazydev").setup({
|
||||||
|
library = {
|
||||||
|
-- See the configuration section for more details
|
||||||
|
-- Load luvit types when the `vim.uv` word is found
|
||||||
|
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
|
||||||
|
},
|
||||||
|
})
|
||||||
@ -1,170 +1,192 @@
|
|||||||
return {
|
vim.pack.add({
|
||||||
"neovim/nvim-lspconfig",
|
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||||
dependencies = {
|
{ src = "https://github.com/mason-org/mason.nvim" },
|
||||||
{ "mason-org/mason.nvim", opts = {} },
|
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
|
||||||
"mason-org/mason-lspconfig.nvim",
|
{ src = "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" }, -- optional for tools later
|
||||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
|
||||||
|
|
||||||
{ "j-hui/fidget.nvim", opts = {} },
|
{ src = "https://github.com/saghen/blink.cmp", version = "1.*" },
|
||||||
|
-- { src = "https://github.com/L3MON4D3/LuaSnip" },
|
||||||
|
-- { src = "https://github.com/rafamadriz/friendly-snippets" },
|
||||||
|
})
|
||||||
|
|
||||||
"saghen/blink.cmp",
|
-- Load packs early (guard API)
|
||||||
},
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
config = function()
|
once = true,
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
callback = function()
|
||||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
callback = function(event)
|
|
||||||
local map = function(keys, func, desc, mode)
|
|
||||||
mode = mode or "n"
|
|
||||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Rename the variable under your cursor.
|
|
||||||
-- Most Language Servers support renaming across files, etc.
|
|
||||||
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
|
||||||
|
|
||||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
|
||||||
-- or a suggestion from your LSP for this to activate.
|
|
||||||
map("<leader>ca", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
|
|
||||||
|
|
||||||
-- Find references for the word under your cursor.
|
|
||||||
map("<leader>gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
|
||||||
|
|
||||||
-- Jump to the implementation of the word under your cursor.
|
|
||||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
|
||||||
map("<leader>gi", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
|
||||||
|
|
||||||
-- Jump to the definition of the word under your cursor.
|
|
||||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
|
||||||
-- To jump back, press <C-t>.
|
|
||||||
map("<leader>gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
|
||||||
|
|
||||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
|
||||||
-- For example, in C this would take you to the header.
|
|
||||||
map("<leader>gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
|
||||||
|
|
||||||
-- -- Fuzzy find all the symbols in your current document.
|
|
||||||
-- -- Symbols are things like variables, functions, types, etc.
|
|
||||||
-- map("gO", require("telescope.builtin").lsp_document_symbols, "Open Document Symbols")
|
|
||||||
--
|
|
||||||
-- -- Fuzzy find all the symbols in your current workspace.
|
|
||||||
-- -- Similar to document symbols, except searches over your entire project.
|
|
||||||
-- map("gW", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Open Workspace Symbols")
|
|
||||||
--
|
|
||||||
-- -- Jump to the type of the word under your cursor.
|
|
||||||
-- -- Useful when you're not sure what type a variable is and you want to see
|
|
||||||
-- -- the definition of its *type*, not where it was *defined*.
|
|
||||||
-- map("grt", require("telescope.builtin").lsp_type_definitions, "[G]oto [T]ype Definition")
|
|
||||||
|
|
||||||
map("<leader>e", vim.diagnostic.open_float, "Line Diagnostics")
|
|
||||||
|
|
||||||
-- The following code creates a keymap to toggle inlay hints in your
|
|
||||||
-- code, if the language server you are using supports them
|
|
||||||
--
|
|
||||||
-- This may be unwanted, since they displace some of your code
|
|
||||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
|
||||||
map("<leader>th", function()
|
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
|
|
||||||
end, "[T]oggle Inlay [H]ints")
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Diagnostic Config
|
-- Servers you want
|
||||||
-- See :help vim.diagnostic.Opts
|
local lsp_servers = {
|
||||||
vim.diagnostic.config({
|
"lua_ls",
|
||||||
severity_sort = true,
|
"ts_ls",
|
||||||
float = { border = "rounded", source = "if_many" },
|
"texlab",
|
||||||
underline = { severity = vim.diagnostic.severity.ERROR },
|
"marksman",
|
||||||
signs = vim.g.have_nerd_font and {
|
"docker_compose_language_service",
|
||||||
text = {
|
"dockerls",
|
||||||
[vim.diagnostic.severity.ERROR] = " ",
|
"tailwindcss",
|
||||||
[vim.diagnostic.severity.WARN] = " ",
|
"cssls",
|
||||||
[vim.diagnostic.severity.INFO] = " ",
|
"clangd",
|
||||||
[vim.diagnostic.severity.HINT] = " ",
|
"rust_analyzer",
|
||||||
},
|
"gopls",
|
||||||
} or {},
|
|
||||||
virtual_text = {
|
|
||||||
source = "if_many",
|
|
||||||
spacing = 2,
|
|
||||||
format = function(diagnostic)
|
|
||||||
local diagnostic_message = {
|
|
||||||
[vim.diagnostic.severity.ERROR] = diagnostic.message,
|
|
||||||
[vim.diagnostic.severity.WARN] = diagnostic.message,
|
|
||||||
[vim.diagnostic.severity.INFO] = diagnostic.message,
|
|
||||||
[vim.diagnostic.severity.HINT] = diagnostic.message,
|
|
||||||
}
|
|
||||||
return diagnostic_message[diagnostic.severity]
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
|
||||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
|
||||||
-- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities.
|
|
||||||
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
|
|
||||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
|
||||||
|
|
||||||
-- Enable the following language servers
|
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
|
||||||
--
|
|
||||||
-- Add any additional override configuration in the following tables. Available keys are:
|
|
||||||
-- - cmd (table): Override the default command used to start the server
|
|
||||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
|
||||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
|
||||||
-- - settings (table): Override the default settings passed when initializing the server.
|
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
|
||||||
local servers = {
|
|
||||||
texlab = {},
|
|
||||||
-- clangd = {},
|
|
||||||
gopls = {},
|
|
||||||
jdtls = {},
|
|
||||||
-- nil_ls = {},
|
|
||||||
ts_ls = {},
|
|
||||||
lua_ls = {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
completion = {
|
|
||||||
callSnippet = "Replace",
|
|
||||||
},
|
|
||||||
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
|
||||||
-- diagnostics = { disable = { 'missing-fields' } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Ensure the servers and tools above are installed
|
|
||||||
--
|
|
||||||
-- To check the current status of installed tools and/or manually install
|
|
||||||
-- other tools, you can run
|
|
||||||
-- :Mason
|
|
||||||
--
|
|
||||||
-- You can press `g?` for help in this menu.
|
|
||||||
--
|
|
||||||
-- `mason` had to be setup earlier: to configure its options see the
|
|
||||||
-- `dependencies` table for `nvim-lspconfig` above.
|
|
||||||
--
|
|
||||||
-- You can add other tools here that you want Mason to install
|
|
||||||
-- for you, so that they are available from within Neovim.
|
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
|
||||||
vim.list_extend(ensure_installed, {
|
|
||||||
"stylua", -- Used to format Lua code
|
|
||||||
})
|
|
||||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
|
||||||
|
|
||||||
require("mason-lspconfig").setup({
|
|
||||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
|
||||||
automatic_installation = true,
|
|
||||||
handlers = {
|
|
||||||
function(server_name)
|
|
||||||
local server = servers[server_name] or {}
|
|
||||||
-- This handles overriding only values explicitly passed
|
|
||||||
-- by the server configuration above. Useful when disabling
|
|
||||||
-- certain features of an LSP (for example, turning off formatting for ts_ls)
|
|
||||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
|
||||||
require("lspconfig")[server_name].setup(server)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Optional: tools you might install later (kept, but not used for formatting here)
|
||||||
|
local tools = {
|
||||||
|
"luacheck",
|
||||||
|
"latexindent",
|
||||||
|
"prettierd",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Mason + mason-lspconfig
|
||||||
|
do
|
||||||
|
local ok, mason = pcall(require, "mason")
|
||||||
|
if ok then mason.setup() end
|
||||||
|
|
||||||
|
local ok_mlsp, mlsp = pcall(require, "mason-lspconfig")
|
||||||
|
if ok_mlsp then
|
||||||
|
mlsp.setup({
|
||||||
|
ensure_installed = lsp_servers,
|
||||||
|
automatic_enable = true, -- v2
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If you want mason-tool-installer to fetch tools only (no config in this file):
|
||||||
|
local ok_mti, mti = pcall(require, "mason-tool-installer")
|
||||||
|
if ok_mti then
|
||||||
|
mti.setup({
|
||||||
|
ensure_installed = tools, -- harmless to keep; you can remove if you prefer
|
||||||
|
automatic_installation = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
local ok_ls, ls = pcall(require, "luasnip")
|
||||||
|
if ok_ls then
|
||||||
|
ls.config.set_config({
|
||||||
|
history = true,
|
||||||
|
enable_autosnippets = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Load VSCode-style snippets from friendly-snippets (and any other VSCode snippet dirs on rtp)
|
||||||
|
-- pcall(function()
|
||||||
|
-- require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
-- end)
|
||||||
|
|
||||||
|
-- Your Tab/Shift-Tab mappings...
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Shared on_attach: native omni + Telescope pickers
|
||||||
|
local function on_attach(_, bufnr)
|
||||||
|
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufnr })
|
||||||
|
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = bufnr })
|
||||||
|
|
||||||
|
local function map(mode, lhs, rhs, desc)
|
||||||
|
vim.keymap.set(mode, lhs, rhs, { buffer = bufnr, noremap = true, silent = true, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Telescope-powered LSP navigation (loads telescope.builtin on demand)
|
||||||
|
local function tb(fn)
|
||||||
|
return function()
|
||||||
|
local ok, builtin = pcall(require, "telescope.builtin")
|
||||||
|
if not ok then
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
ok, builtin = pcall(require, "telescope.builtin")
|
||||||
|
end
|
||||||
|
if ok and builtin[fn] then
|
||||||
|
builtin[fn]()
|
||||||
|
else
|
||||||
|
vim.notify("Telescope not available", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
map("n", "gd", tb("lsp_definitions"), "Goto Definition (Telescope)")
|
||||||
|
map("n", "gr", tb("lsp_references"), "Goto References (Telescope)")
|
||||||
|
map("n", "gI", tb("lsp_implementations"), "Goto Implementations (Telescope)")
|
||||||
|
map("n", "gt", tb("lsp_type_definitions"), "Goto Type Definitions (Telescope)")
|
||||||
|
|
||||||
|
-- LSP basics
|
||||||
|
map("n", "K", vim.lsp.buf.hover, "Hover")
|
||||||
|
map("n", "<leader>rn", vim.lsp.buf.rename, "Rename")
|
||||||
|
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, "Code Action")
|
||||||
|
map("n", "[d", vim.diagnostic.goto_prev, "Prev Diagnostic")
|
||||||
|
map("n", "]d", vim.diagnostic.goto_next, "Next Diagnostic")
|
||||||
|
map("n", "<leader>e", vim.diagnostic.open_float, "Line Diagnostics")
|
||||||
|
|
||||||
|
pcall(vim.lsp.inlay_hint.enable, true, { bufnr = bufnr })
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Global LSP defaults
|
||||||
|
vim.lsp.config("*", {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||||
|
-- capabilities = (function()
|
||||||
|
-- local caps = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
-- caps.textDocument = caps.textDocument or {}
|
||||||
|
-- caps.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true }
|
||||||
|
-- return caps
|
||||||
|
-- end)(),
|
||||||
|
})
|
||||||
|
|
||||||
|
-- -- Server-specific tweaks
|
||||||
|
-- vim.lsp.config("lua_ls", {
|
||||||
|
-- settings = {
|
||||||
|
-- Lua = {
|
||||||
|
-- diagnostics = { globals = { "vim", "require" } },
|
||||||
|
-- completion = { callSnippet = "Replace" },
|
||||||
|
-- workspace = { checkThirdParty = false },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- Enable servers (Neovim 0.11+)
|
||||||
|
vim.lsp.enable(lsp_servers)
|
||||||
|
|
||||||
|
-- -- Trigger omni (like cmp.complete)
|
||||||
|
-- vim.keymap.set("i", "<C-Space>", function()
|
||||||
|
-- if vim.bo.omnifunc == "v:lua.vim.lsp.omnifunc" then
|
||||||
|
-- return vim.api.nvim_replace_termcodes("<C-x><C-o>", true, true, true)
|
||||||
|
-- end
|
||||||
|
-- return ""
|
||||||
|
-- end, { expr = true, silent = true, desc = "Trigger omni-completion" })
|
||||||
|
--
|
||||||
|
-- -- Navigate popup menu
|
||||||
|
-- vim.keymap.set("i", "<C-j>", "<C-n>", { silent = true, desc = "Omni next item" })
|
||||||
|
-- vim.keymap.set("i", "<C-k>", "<C-p>", { silent = true, desc = "Omni prev item" })
|
||||||
|
--
|
||||||
|
-- -- Enter to confirm when pum is visible, otherwise newline
|
||||||
|
-- vim.keymap.set("i", "<CR>", function()
|
||||||
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
|
-- -- Confirm current selection; if none selected, accept first
|
||||||
|
-- return vim.api.nvim_replace_termcodes("<C-y>", true, true, true)
|
||||||
|
-- end
|
||||||
|
-- return vim.api.nvim_replace_termcodes("<CR>", true, true, true)
|
||||||
|
-- end, { expr = true, silent = true, desc = "Confirm completion or newline" })
|
||||||
|
--
|
||||||
|
-- -- Requires your existing LuaSnip setup and mappings
|
||||||
|
-- local ok_ls, ls = pcall(require, "luasnip")
|
||||||
|
-- if ok_ls then
|
||||||
|
-- -- Tab: if menu visible, next item; else snippet expand/jump; else literal Tab
|
||||||
|
-- vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
||||||
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
|
-- return vim.api.nvim_replace_termcodes("<C-n>", true, true, true)
|
||||||
|
-- elseif ls.expand_or_jumpable() then
|
||||||
|
-- return "<Plug>luasnip-expand-or-jump"
|
||||||
|
-- else
|
||||||
|
-- return "<Tab>"
|
||||||
|
-- end
|
||||||
|
-- end, { expr = true, silent = true, desc = "Next item / Snippet jump / Tab" })
|
||||||
|
--
|
||||||
|
-- -- Shift-Tab: if menu visible, prev item; else snippet jump back; else literal
|
||||||
|
-- vim.keymap.set({ "i", "s" }, "<S-Tab>", function()
|
||||||
|
-- if vim.fn.pumvisible() == 1 then
|
||||||
|
-- return vim.api.nvim_replace_termcodes("<C-p>", true, true, true)
|
||||||
|
-- elseif ls.jumpable(-1) then
|
||||||
|
-- return "<Plug>luasnip-jump-prev"
|
||||||
|
-- else
|
||||||
|
-- return "<S-Tab>"
|
||||||
|
-- end
|
||||||
|
-- end, { expr = true, silent = true, desc = "Prev item / Snippet back / Shift-Tab" })
|
||||||
|
-- end
|
||||||
|
|||||||
@ -1,9 +1,28 @@
|
|||||||
return {
|
-- Declare plugins
|
||||||
'stevearc/oil.nvim',
|
vim.pack.add({
|
||||||
opts = {},
|
{ src = "https://github.com/nvim-lua/plenary.nvim", version = "master" },
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
|
{ src = "https://github.com/stevearc/oil.nvim", version = "master" },
|
||||||
config = function()
|
})
|
||||||
require("oil").setup()
|
|
||||||
vim.keymap.set('n', '<leader>fe', "<cmd>:Oil<cr>")
|
-- Try to load packs on startup
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
if vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
|
||||||
|
-- Configure oil (guarded)
|
||||||
|
local ok, oil = pcall(require, "oil")
|
||||||
|
if ok then
|
||||||
|
pcall(oil.setup, {})
|
||||||
|
else
|
||||||
|
-- If it wasn't on rtp yet, try once shortly after
|
||||||
|
vim.schedule(function()
|
||||||
|
local ok2, oil2 = pcall(require, "oil")
|
||||||
|
if ok2 then pcall(oil2.setup, {}) end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
}
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Keymap (works whether eager or lazy)
|
||||||
|
vim.keymap.set("n", "<leader>fe", "<cmd>Oil<cr>", { desc = "Open Oil" })
|
||||||
|
|||||||
@ -1,49 +1,45 @@
|
|||||||
return { -- Fuzzy Finder (files, lsp, etc)
|
-- Ensure packs are added
|
||||||
"nvim-telescope/telescope.nvim",
|
vim.pack.add({
|
||||||
event = "VimEnter",
|
{ src = "https://github.com/nvim-lua/plenary.nvim", version = "master" },
|
||||||
dependencies = {
|
{ src = "https://github.com/nvim-telescope/telescope.nvim", version = "master" },
|
||||||
"nvim-lua/plenary.nvim",
|
-- Optional native sorter (requires a C toolchain)
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
{ src = "https://github.com/nvim-telescope/telescope-fzf-native.nvim", version = "main", build = "make" },
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
})
|
||||||
|
|
||||||
-- `build` is used to run some command when the plugin is installed/updated.
|
-- Helper: find fzf-native root and build/lib path if installed
|
||||||
-- This is only run then, not every time Neovim starts up.
|
local function fzf_native_paths()
|
||||||
build = "make",
|
local lua_file = vim.api.nvim_get_runtime_file("lua/fzf_lib.lua", true)[1]
|
||||||
|
if not lua_file then return nil end
|
||||||
|
local root = lua_file:gsub("/lua/fzf_lib.lua$", "")
|
||||||
|
local lib = root .. "/build/libfzf.so"
|
||||||
|
return { root = root, lib = lib }
|
||||||
|
end
|
||||||
|
|
||||||
-- `cond` is a condition used to determine whether this plugin should be
|
-- Try to build fzf-native if the .so is missing
|
||||||
-- installed and loaded.
|
local function ensure_fzf_native_built()
|
||||||
cond = function()
|
local p = fzf_native_paths()
|
||||||
return vim.fn.executable("make") == 1
|
if not p then return false end
|
||||||
end,
|
if vim.uv.fs_stat(p.lib) then return true end
|
||||||
},
|
-- Attempt to run `make` in the plugin directory
|
||||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
vim.notify("Building telescope-fzf-native (make)...", vim.log.levels.INFO)
|
||||||
|
local ok = pcall(function()
|
||||||
|
vim.system({ "make" }, { cwd = p.root }):wait()
|
||||||
|
end)
|
||||||
|
if ok and vim.uv.fs_stat(p.lib) then
|
||||||
|
vim.notify("telescope-fzf-native built successfully", vim.log.levels.INFO)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
vim.notify("telescope-fzf-native build failed or library missing", vim.log.levels.WARN)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
-- Configure Telescope when available; try on VimEnter, retry once
|
||||||
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
|
local function telescope_setup()
|
||||||
},
|
local ok, telescope = pcall(require, "telescope")
|
||||||
config = function()
|
if not ok then return false end
|
||||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
|
||||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
|
||||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
|
||||||
--
|
|
||||||
-- The easiest way to use Telescope, is to start by doing something like:
|
|
||||||
-- :Telescope help_tags
|
|
||||||
--
|
|
||||||
-- After running this command, a window will open up and you're able to
|
|
||||||
-- type in the prompt window. You'll see a list of `help_tags` options and
|
|
||||||
-- a corresponding preview of the help.
|
|
||||||
--
|
|
||||||
-- Two important keymaps to use while in Telescope are:
|
|
||||||
-- - Insert mode: <c-/>
|
|
||||||
-- - Normal mode: ?
|
|
||||||
--
|
|
||||||
-- This opens a window that shows you all of the keymaps for the current
|
|
||||||
-- Telescope picker. This is really useful to discover what Telescope can
|
|
||||||
-- do as well as how to actually do it!
|
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
telescope.setup({
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
|
||||||
require("telescope").setup({
|
|
||||||
pickers = {
|
pickers = {
|
||||||
find_files = {
|
find_files = {
|
||||||
theme = "ivy",
|
theme = "ivy",
|
||||||
@ -57,9 +53,6 @@ return { -- Fuzzy Finder (files, lsp, etc)
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
extensions = {
|
extensions = {
|
||||||
["ui-select"] = {
|
|
||||||
require("telescope.themes").get_dropdown(),
|
|
||||||
},
|
|
||||||
fzf = {
|
fzf = {
|
||||||
fuzzy = true,
|
fuzzy = true,
|
||||||
override_generic_sorter = true,
|
override_generic_sorter = true,
|
||||||
@ -69,44 +62,46 @@ return { -- Fuzzy Finder (files, lsp, etc)
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Enable Telescope extensions if they are installed
|
-- Load fzf extension only if built; call protected to avoid hard errors
|
||||||
pcall(require("telescope").load_extension, "fzf")
|
if ensure_fzf_native_built() then
|
||||||
pcall(require("telescope").load_extension, "ui-select")
|
pcall(telescope.load_extension, "fzf")
|
||||||
|
end
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
return true
|
||||||
local builtin = require("telescope.builtin")
|
end
|
||||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
|
|
||||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
|
||||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
|
||||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
|
||||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
|
||||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
|
||||||
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
|
||||||
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
|
|
||||||
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
|
||||||
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
|
|
||||||
|
|
||||||
-- Slightly advanced example of overriding default behavior and theme
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
vim.keymap.set("n", "<leader>/", function()
|
once = true,
|
||||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
callback = function()
|
||||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
winblend = 10,
|
if not telescope_setup() then
|
||||||
previewer = false,
|
vim.schedule(telescope_setup)
|
||||||
}))
|
end
|
||||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
|
||||||
|
|
||||||
-- It's also possible to pass additional configuration options.
|
|
||||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
|
||||||
vim.keymap.set("n", "<leader>s/", function()
|
|
||||||
builtin.live_grep({
|
|
||||||
grep_open_files = true,
|
|
||||||
prompt_title = "Live Grep in Open Files",
|
|
||||||
})
|
|
||||||
end, { desc = "[S]earch [/] in Open Files" })
|
|
||||||
|
|
||||||
-- Shortcut for searching your Neovim configuration files
|
|
||||||
vim.keymap.set("n", "<leader>sn", function()
|
|
||||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
|
||||||
end, { desc = "[S]earch [N]eovim files" })
|
|
||||||
end,
|
end,
|
||||||
}
|
})
|
||||||
|
|
||||||
|
-- Always define keymaps; they load telescope on first use if needed
|
||||||
|
local function map(lhs, fn, desc)
|
||||||
|
vim.keymap.set("n", lhs, fn, { noremap = true, silent = true, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- On-demand wrappers that require telescope.builtin when called
|
||||||
|
local function with_builtin(name)
|
||||||
|
return function()
|
||||||
|
local ok, builtin = pcall(require, "telescope.builtin")
|
||||||
|
if not ok then
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
ok, builtin = pcall(require, "telescope.builtin")
|
||||||
|
end
|
||||||
|
if ok and builtin[name] then
|
||||||
|
builtin[name]()
|
||||||
|
else
|
||||||
|
vim.notify("Telescope not available yet", vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
map("<leader>ff", with_builtin("find_files"), "Find files")
|
||||||
|
map("<leader>fg", with_builtin("live_grep"), "Live grep")
|
||||||
|
map("<leader>fb", with_builtin("buffers"), "Buffers")
|
||||||
|
map("<leader>fh", with_builtin("help_tags"), "Help tags")
|
||||||
|
|||||||
@ -1,9 +1,29 @@
|
|||||||
return {
|
vim.pack.add({
|
||||||
"ellisonleao/gruvbox.nvim",
|
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
|
||||||
priority = 1000 ,
|
{ src = "https://github.com/ellisonleao/gruvbox.nvim" },
|
||||||
config = function()
|
})
|
||||||
vim.o.background = "dark" -- or "light" for light mode
|
|
||||||
vim.cmd([[colorscheme gruvbox]])
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("VimEnter", {
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
if vim.pack and vim.pack.load then pcall(vim.pack.load) end
|
||||||
|
pcall(function()
|
||||||
|
-- Ensure colorscheme is available; set it if you want
|
||||||
|
-- vim.cmd("colorscheme gruvbox")
|
||||||
|
|
||||||
|
-- lualine theme can be specified by name or theme table.
|
||||||
|
-- Using the built-in "gruvbox" theme name is simplest:
|
||||||
|
require("lualine").setup({
|
||||||
|
options = {
|
||||||
|
theme = "gruvbox",
|
||||||
|
icons_enabled = true,
|
||||||
|
always_divide_middle = true,
|
||||||
|
component_separators = { left = "│", right = "│" },
|
||||||
|
section_separators = { left = "", right = "" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd.colorscheme("gruvbox")
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@ -1,15 +1,41 @@
|
|||||||
return {
|
-- Ensure packs are added
|
||||||
"nvim-treesitter/nvim-treesitter",
|
vim.pack.add({
|
||||||
build = ":TSUpdate",
|
{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
|
||||||
event = { "VeryLazy" },
|
})
|
||||||
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
|
|
||||||
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
|
|
||||||
opts = {
|
-- Configure after packs are loaded (PackLoad is emitted by vim.pack.load)
|
||||||
highlight = { enable = true },
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
pattern = "PackLoad",
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
local ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||||
|
if not ok then
|
||||||
|
vim.notify("nvim-treesitter not available yet", vim.log.levels.WARN)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
configs.setup({
|
||||||
|
auto_install = true,
|
||||||
|
highlight = { enable = true, additional_vim_regex_highlighting = false },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
auto_install = { enable = true }
|
})
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require("nvim-treesitter.configs").setup(opts)
|
|
||||||
end,
|
end,
|
||||||
}
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('PackChanged', {
|
||||||
|
desc = 'Handle nvim-treesitter updates',
|
||||||
|
group = vim.api.nvim_create_augroup('nvim-treesitter-pack-changed-update-handler', { clear = true }),
|
||||||
|
callback = function(event)
|
||||||
|
if event.data.kind == 'update' and event.data.spec.name == 'nvim-treesitter' then
|
||||||
|
vim.notify('nvim-treesitter updated, running TSUpdate...', vim.log.levels.INFO)
|
||||||
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
|
local ok = pcall(vim.cmd, 'TSUpdate')
|
||||||
|
if ok then
|
||||||
|
vim.notify('TSUpdate completed successfully!', vim.log.levels.INFO)
|
||||||
|
else
|
||||||
|
vim.notify('TSUpdate command not available yet, skipping', vim.log.levels.WARN)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|||||||
3
nvim/lua/kanopo/plugins/which-key.lua
Normal file
3
nvim/lua/kanopo/plugins/which-key.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/folke/which-key.nvim"},
|
||||||
|
})
|
||||||
@ -1,52 +0,0 @@
|
|||||||
return { -- Useful plugin to show you pending keybinds.
|
|
||||||
"folke/which-key.nvim",
|
|
||||||
event = "VimEnter", -- Sets the loading event to 'VimEnter'
|
|
||||||
opts = {
|
|
||||||
-- delay between pressing a key and opening which-key (milliseconds)
|
|
||||||
-- this setting is independent of vim.o.timeoutlen
|
|
||||||
delay = 0,
|
|
||||||
icons = {
|
|
||||||
-- set icon mappings to true if you have a Nerd Font
|
|
||||||
mappings = vim.g.have_nerd_font,
|
|
||||||
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
|
||||||
-- default which-key.nvim defined Nerd Font icons, otherwise define a string table
|
|
||||||
keys = vim.g.have_nerd_font and {} or {
|
|
||||||
Up = "<Up> ",
|
|
||||||
Down = "<Down> ",
|
|
||||||
Left = "<Left> ",
|
|
||||||
Right = "<Right> ",
|
|
||||||
C = "<C-…> ",
|
|
||||||
M = "<M-…> ",
|
|
||||||
D = "<D-…> ",
|
|
||||||
S = "<S-…> ",
|
|
||||||
CR = "<CR> ",
|
|
||||||
Esc = "<Esc> ",
|
|
||||||
ScrollWheelDown = "<ScrollWheelDown> ",
|
|
||||||
ScrollWheelUp = "<ScrollWheelUp> ",
|
|
||||||
NL = "<NL> ",
|
|
||||||
BS = "<BS> ",
|
|
||||||
Space = "<Space> ",
|
|
||||||
Tab = "<Tab> ",
|
|
||||||
F1 = "<F1>",
|
|
||||||
F2 = "<F2>",
|
|
||||||
F3 = "<F3>",
|
|
||||||
F4 = "<F4>",
|
|
||||||
F5 = "<F5>",
|
|
||||||
F6 = "<F6>",
|
|
||||||
F7 = "<F7>",
|
|
||||||
F8 = "<F8>",
|
|
||||||
F9 = "<F9>",
|
|
||||||
F10 = "<F10>",
|
|
||||||
F11 = "<F11>",
|
|
||||||
F12 = "<F12>",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Document existing key chains
|
|
||||||
spec = {
|
|
||||||
{ "<leader>s", group = "[S]earch" },
|
|
||||||
{ "<leader>t", group = "[T]oggle" },
|
|
||||||
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
0
nvim/main.ts
Normal file
0
nvim/main.ts
Normal file
@ -1,2 +0,0 @@
|
|||||||
# enable automatic env
|
|
||||||
sdkman_auto_env=true
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
[Sleep]
|
|
||||||
HibernateDelaySec=30min
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
```bash
|
|
||||||
|
|
||||||
sudo tee /etc/systemd/system/suspend-radios.service << 'EOF'
|
|
||||||
[Unit]
|
|
||||||
Description=Disable radios before suspend
|
|
||||||
Before=sleep.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/usr/sbin/rfkill block wifi bluetooth
|
|
||||||
ExecStop=/usr/sbin/rfkill unblock wifi bluetooth
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=sleep.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
sudo systemctl enable suspend-radios.service
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo mkdir -p /etc/systemd/sleep.conf.d
|
|
||||||
sudo tee /etc/systemd/sleep.conf.d/hibernate.conf << 'EOF'
|
|
||||||
[Sleep]
|
|
||||||
HibernateDelaySec=30min
|
|
||||||
EOF
|
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
```
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Disable radios before suspend
|
|
||||||
Before=sleep.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/usr/sbin/rfkill block wifi bluetooth
|
|
||||||
ExecStop=/usr/sbin/rfkill unblock wifi bluetooth
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=sleep.target
|
|
||||||
98
sway/config
98
sway/config
@ -4,7 +4,7 @@ set $left h
|
|||||||
set $down j
|
set $down j
|
||||||
set $up k
|
set $up k
|
||||||
set $right l
|
set $right l
|
||||||
set $term foot
|
set $term ghostty
|
||||||
# Launcher: wofi (sostituisce wmenu-run)
|
# Launcher: wofi (sostituisce wmenu-run)
|
||||||
set $menu wofi -S drun -p Search -I -b -i
|
set $menu wofi -S drun -p Search -I -b -i
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ floating_modifier $mod normal
|
|||||||
bindsym $mod+Shift+c reload
|
bindsym $mod+Shift+c reload
|
||||||
|
|
||||||
# Esci da Sway (con conferma tramite swaynag)
|
# Esci da Sway (con conferma tramite swaynag)
|
||||||
# bindsym $mod+Shift+e exec swaynag -t warning -m 'Hai premuto la scorciatoia per uscire. Vuoi davvero uscire da Sway?' -B 'Sì, esci' 'swaymsg exit'
|
bindsym $mod+Shift+e exec swaynag -t warning -m 'Hai premuto la scorciatoia per uscire. Vuoi davvero uscire da Sway?' -B 'Sì, esci' 'swaymsg exit'
|
||||||
|
|
||||||
### Navigazione e spostamento tra finestre
|
### Navigazione e spostamento tra finestre
|
||||||
# Sposta il focus
|
# Sposta il focus
|
||||||
@ -177,15 +177,36 @@ bindsym $mod+r mode "resize"
|
|||||||
### Notifiche e Controlli Audio/Luminosità
|
### Notifiche e Controlli Audio/Luminosità
|
||||||
set $notification_time 1000
|
set $notification_time 1000
|
||||||
|
|
||||||
# Audio controls
|
# Comandi per le notifiche (volume, mute, mic, luminosità)
|
||||||
bindsym XF86AudioMute exec ~/.config/sway/scripts/notification-control.sh mute-toggle
|
set $audio_notification_cmd command -v notify-send >/dev/null && \
|
||||||
bindsym XF86AudioLowerVolume exec ~/.config/sway/scripts/notification-control.sh volume-down
|
VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}') && \
|
||||||
bindsym XF86AudioRaiseVolume exec ~/.config/sway/scripts/notification-control.sh volume-up
|
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
||||||
bindsym XF86AudioMicMute exec ~/.config/sway/scripts/notification-control.sh mic-mute-toggle
|
-h "int:value:$VALUE" -t $notification_time "Volume: ${VALUE}%"
|
||||||
|
|
||||||
# Brightness controls
|
set $mute_notification_cmd command -v notify-send >/dev/null && \
|
||||||
bindsym XF86MonBrightnessDown exec ~/.config/sway/scripts/notification-control.sh brightness-down
|
VALUE=$(pactl get-sink-mute @DEFAULT_SINK@ | head -n 1 | awk '{print $2}') && \
|
||||||
bindsym XF86MonBrightnessUp exec ~/.config/sway/scripts/notification-control.sh brightness-up
|
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
||||||
|
-h "string:x-canonical-private-synchronous:audio" -t $notification_time "Mute: ${VALUE}"
|
||||||
|
|
||||||
|
set $mute_mic_notification_cmd command -v notify-send >/dev/null && \
|
||||||
|
VALUE=$(pactl get-source-mute @DEFAULT_SOURCE@ | head -n 1 | awk '{print $2}') && \
|
||||||
|
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
||||||
|
-h "string:x-canonical-private-synchronous:audio" -t $notification_time "Mic Mute: ${VALUE}"
|
||||||
|
|
||||||
|
set $brightness_notification_cmd command -v notify-send >/dev/null && \
|
||||||
|
VALUE=$(brightnessctl get) && \
|
||||||
|
MAX=255 && \
|
||||||
|
PERCENT=$((VALUE * 100 / MAX)) && \
|
||||||
|
notify-send -e -h string:x-canonical-private-synchronous:brightness \
|
||||||
|
-h "int:value:$PERCENT" -t $notification_time "Brightness: ${PERCENT}%"
|
||||||
|
|
||||||
|
# Key bindings per audio e luminosità
|
||||||
|
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle; exec $mute_notification_cmd
|
||||||
|
bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% && $audio_notification_cmd
|
||||||
|
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% && $audio_notification_cmd
|
||||||
|
bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle && $mute_mic_notification_cmd
|
||||||
|
bindsym XF86MonBrightnessDown exec brightnessctl s 10%- && $brightness_notification_cmd
|
||||||
|
bindsym XF86MonBrightnessUp exec brightnessctl s 10%+ && $brightness_notification_cmd
|
||||||
|
|
||||||
# Controlli multimediali
|
# Controlli multimediali
|
||||||
bindsym XF86AudioPlay exec playerctl play-pause
|
bindsym XF86AudioPlay exec playerctl play-pause
|
||||||
@ -193,24 +214,18 @@ bindsym XF86AudioNext exec playerctl next
|
|||||||
bindsym XF86AudioPrev exec playerctl previous
|
bindsym XF86AudioPrev exec playerctl previous
|
||||||
|
|
||||||
### Screenshot e Registrazione Schermo
|
### Screenshot e Registrazione Schermo
|
||||||
bindsym Print exec grimshot --notify copy output && \
|
bindsym Print exec grimshot --notify copy output
|
||||||
notify-send -u normal "📸 Screenshot" "Full screen copied to clipboard"
|
bindsym $mod+Print exec grimshot --notify copy area
|
||||||
|
bindsym $mod+P exec grimshot --notify copy output
|
||||||
|
bindsym $mod+Shift+P exec grimshot --notify copy area
|
||||||
|
|
||||||
# Screenshot selected area
|
bindsym $mod+XF86AudioMedia exec --no-startup-id \
|
||||||
bindsym $mod+Print exec grimshot --notify copy area && \
|
(pgrep -x wf-recorder > /dev/null && killall -s SIGINT wf-recorder && notify-send "Recording Stopped") || \
|
||||||
notify-send -u normal "📸 Screenshot" "Selected area copied to clipboard"
|
(notify-send "Recording Started + Audio." && wf-recorder --audio --file ~/Videos/$(date +'%Y-%m-%d-%H-%M-%S').mp4)
|
||||||
|
|
||||||
# Alternative bindings
|
bindsym XF86AudioMedia exec --no-startup-id \
|
||||||
bindsym $mod+P exec grimshot --notify copy output && \
|
(pgrep -x wf-recorder > /dev/null && killall -s SIGINT wf-recorder && notify-send "Recording Stopped") || \
|
||||||
notify-send -u normal "📸 Screenshot" "Full screen copied to clipboard"
|
(notify-send "Recording Started" && wf-recorder --file ~/Videos/$(date +'%Y-%m-%d-%H-%M-%S').mp4)
|
||||||
|
|
||||||
bindsym $mod+Shift+P exec grimshot --notify copy area && \
|
|
||||||
notify-send -u normal "📸 Screenshot" "Selected area copied to clipboard"
|
|
||||||
|
|
||||||
# this one includes audio track in the recording
|
|
||||||
bindsym $mod+XF86AudioMedia exec ~/.config/sway/scripts/screen-recording.sh audio
|
|
||||||
# this one not
|
|
||||||
bindsym XF86AudioMedia exec ~/.config/sway/scripts/screen-recording.sh
|
|
||||||
|
|
||||||
### Modalità per azioni di sistema (lock, logout, reboot, suspend, shutdown)
|
### Modalità per azioni di sistema (lock, logout, reboot, suspend, shutdown)
|
||||||
set $mode_system "What to do? (l) lock, (e) logout, (r) reboot, (Shift+s) shutdown"
|
set $mode_system "What to do? (l) lock, (e) logout, (r) reboot, (Shift+s) shutdown"
|
||||||
@ -233,8 +248,8 @@ bar {
|
|||||||
### Borders e Gaps
|
### Borders e Gaps
|
||||||
default_border pixel
|
default_border pixel
|
||||||
smart_gaps on
|
smart_gaps on
|
||||||
gaps outer 2
|
gaps outer 3
|
||||||
gaps inner 3
|
gaps inner 5
|
||||||
|
|
||||||
# Impostazioni dei colori per il focus delle finestre
|
# Impostazioni dei colori per il focus delle finestre
|
||||||
client.focused $gruvbox_orange $gruvbox_orange $gruvbox_bg_dark $gruvbox_orange
|
client.focused $gruvbox_orange $gruvbox_orange $gruvbox_bg_dark $gruvbox_orange
|
||||||
@ -249,15 +264,15 @@ exec_always {
|
|||||||
}
|
}
|
||||||
|
|
||||||
### Applicazioni in autostart
|
### Applicazioni in autostart
|
||||||
exec keepassxc
|
# exec keepassxc
|
||||||
# exec flatpak run org.keepassxc.KeePassXC
|
exec flatpak run org.keepassxc.KeePassXC
|
||||||
exec nextcloud
|
# exec nextcloud
|
||||||
# exec flatpak run com.nextcloud.desktopclient.nextcloud
|
exec flatpak run com.nextcloud.desktopclient.nextcloud
|
||||||
exec wlsunset -S 08:00 -s 18:00
|
exec wlsunset -S 08:00 -s 18:00
|
||||||
exec blueman-applet
|
exec blueman-applet
|
||||||
exec xss-lock -- swaylock -f -i $wallpaper
|
exec xss-lock -- swaylock -f -i $wallpaper
|
||||||
exec --no-startup-id easyeffects --gapplication-service
|
# exec --no-startup-id easyeffects --gapplication-service
|
||||||
# exec flatpak run com.github.wwmm.easyeffects --gapplication-service
|
exec flatpak run com.github.wwmm.easyeffects --gapplication-service
|
||||||
exec --no-startup-id wluma
|
exec --no-startup-id wluma
|
||||||
|
|
||||||
# Avvio del polkit agent GNOME
|
# Avvio del polkit agent GNOME
|
||||||
@ -271,8 +286,7 @@ exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CU
|
|||||||
exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME
|
exec dbus-update-activation-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP SWAYSOCK I3SOCK XCURSOR_SIZE XCURSOR_THEME
|
||||||
|
|
||||||
### Notifiche Desktop e Clip History
|
### Notifiche Desktop e Clip History
|
||||||
exec swaync
|
exec mako
|
||||||
# exec mako
|
|
||||||
exec wl-paste --type text --watch cliphist store
|
exec wl-paste --type text --watch cliphist store
|
||||||
exec wl-paste --type image --watch cliphist store
|
exec wl-paste --type image --watch cliphist store
|
||||||
|
|
||||||
@ -302,3 +316,15 @@ for_window [title="Picture in picture"] floating enable, sticky enable
|
|||||||
for_window [title="Save File"] floating enable
|
for_window [title="Save File"] floating enable
|
||||||
for_window [app_id="firefox" title="Firefox — Sharing Indicator"] kill
|
for_window [app_id="firefox" title="Firefox — Sharing Indicator"] kill
|
||||||
|
|
||||||
|
# assign [app_id="configs"] workspace configs
|
||||||
|
assign [class="Spotify"] workspace 10
|
||||||
|
|
||||||
|
for_window [app_id="keymapp"] floating enable
|
||||||
|
for_window [app_id="keymapp"] resize set width 800 px height 600 px
|
||||||
|
for_window [app_id="keymapp"] move position 100%-800px 100%-600px
|
||||||
|
for_window [app_id="keymapp"] mark pin-keymapp
|
||||||
|
no_focus [app_id="keymapp"]
|
||||||
|
exec_always ~/.config/sway/scripts/pin-keymapp.sh
|
||||||
|
|
||||||
|
# Includi eventuali configurazioni aggiuntive
|
||||||
|
# include /etc/sway/config.d/*
|
||||||
|
|||||||
@ -1,69 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
ACTION="$1"
|
|
||||||
NOTIFICATION_TIME=1000
|
|
||||||
|
|
||||||
case "$ACTION" in
|
|
||||||
volume-up)
|
|
||||||
pactl set-sink-volume @DEFAULT_SINK@ +5%
|
|
||||||
VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}')
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
|
||||||
-h "int:value:$VALUE" -t $NOTIFICATION_TIME "🔊 Volume" "${VALUE}%"
|
|
||||||
;;
|
|
||||||
|
|
||||||
volume-down)
|
|
||||||
pactl set-sink-volume @DEFAULT_SINK@ -5%
|
|
||||||
VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}')
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
|
||||||
-h "int:value:$VALUE" -t $NOTIFICATION_TIME "🔉 Volume" "${VALUE}%"
|
|
||||||
;;
|
|
||||||
|
|
||||||
mute-toggle)
|
|
||||||
pactl set-sink-mute @DEFAULT_SINK@ toggle
|
|
||||||
MUTED=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
|
|
||||||
if [ "$MUTED" = "yes" ]; then
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
|
||||||
-t $NOTIFICATION_TIME "🔇 Audio Muted" "Output muted"
|
|
||||||
else
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
|
||||||
-t $NOTIFICATION_TIME "🔊 Audio Unmuted" "Output active"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
mic-mute-toggle)
|
|
||||||
pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
|
||||||
MUTED=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk '{print $2}')
|
|
||||||
if [ "$MUTED" = "yes" ]; then
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
|
||||||
-t $NOTIFICATION_TIME "🎤 Microphone Muted" "Mic muted"
|
|
||||||
else
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:audio \
|
|
||||||
-t $NOTIFICATION_TIME "🎤 Microphone Active" "Mic unmuted"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
brightness-up)
|
|
||||||
brightnessctl s 10%+
|
|
||||||
# Get current and max brightness values
|
|
||||||
CURRENT=$(brightnessctl get)
|
|
||||||
MAX=$(brightnessctl max)
|
|
||||||
PERCENT=$((CURRENT * 100 / MAX))
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:brightness \
|
|
||||||
-h "int:value:$PERCENT" -t $NOTIFICATION_TIME "☀️ Brightness" "${PERCENT}%"
|
|
||||||
;;
|
|
||||||
|
|
||||||
brightness-down)
|
|
||||||
brightnessctl s 10%-
|
|
||||||
# Get current and max brightness values
|
|
||||||
CURRENT=$(brightnessctl get)
|
|
||||||
MAX=$(brightnessctl max)
|
|
||||||
PERCENT=$((CURRENT * 100 / MAX))
|
|
||||||
notify-send -e -h string:x-canonical-private-synchronous:brightness \
|
|
||||||
-h "int:value:$PERCENT" -t $NOTIFICATION_TIME "🔅 Brightness" "${PERCENT}%"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "Usage: $0 {volume-up|volume-down|mute-toggle|mic-mute-toggle|brightness-up|brightness-down}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
18
sway/scripts/pin-keymapp.sh
Executable file
18
sway/scripts/pin-keymapp.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Follow current workspace and place bottom-right at 800x600.
|
||||||
|
# Requires the window to be marked "pin-keymapp" and floating.
|
||||||
|
|
||||||
|
# Subscribe to workspace changes
|
||||||
|
swaymsg -t subscribe '["workspace"]' | while read -r _; do
|
||||||
|
# Ensure the window exists before issuing moves
|
||||||
|
if swaymsg -t get_tree | jq -e '.. | objects | select(.marks? and (index("pin-keymapp"))) ' >/dev/null; then
|
||||||
|
# Move to current workspace
|
||||||
|
swaymsg '[con_mark="pin-keymapp"] move container to workspace current'
|
||||||
|
# Ensure size, then place. Order matters: floating -> resize -> move.
|
||||||
|
swaymsg '[con_mark="pin-keymapp"] floating enable'
|
||||||
|
swaymsg '[con_mark="pin-keymapp"] resize set width 800 px height 600 px'
|
||||||
|
swaymsg '[con_mark="pin-keymapp"] move position 100%-800px 100%-600px'
|
||||||
|
# If needed (multi-output absolute coords), use:
|
||||||
|
# swaymsg '[con_mark="pin-keymapp"] move absolute position 100%-800px 100%-600px'
|
||||||
|
fi
|
||||||
|
done
|
||||||
@ -1,30 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
RECORD_DIR="$HOME/Videos"
|
|
||||||
TIMESTAMP=$(date +'%Y-%m-%d-%H-%M-%S')
|
|
||||||
AUDIO_FLAG="$1"
|
|
||||||
|
|
||||||
# Create directory if it doesn't exist
|
|
||||||
if [ ! -d "$RECORD_DIR" ]; then
|
|
||||||
mkdir -p "$RECORD_DIR"
|
|
||||||
notify-send -u low "📁 Directory Created" "$RECORD_DIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if pgrep -x wf-recorder > /dev/null; then
|
|
||||||
killall -s SIGINT wf-recorder
|
|
||||||
notify-send -u normal "🛑 Recording Stopped" "Saved to $RECORD_DIR/"
|
|
||||||
else
|
|
||||||
if [ "$AUDIO_FLAG" = "audio" ]; then
|
|
||||||
notify-send -u normal "🔴 Recording Started" "With audio enabled"
|
|
||||||
wf-recorder --audio --file "$RECORD_DIR/${TIMESTAMP}.mp4"
|
|
||||||
else
|
|
||||||
notify-send -u normal "🔴 Recording Started" "Video only"
|
|
||||||
wf-recorder --file "$RECORD_DIR/${TIMESTAMP}.mp4"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
notify-send -u normal "✅ Recording Complete" "Saved as ${TIMESTAMP}.mp4"
|
|
||||||
else
|
|
||||||
notify-send -u critical "❌ Recording Failed" "Check your configuration"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
@ -1,11 +1,7 @@
|
|||||||
// -*- mode: jsonc -*-
|
// -*- mode: jsonc -*-
|
||||||
{
|
{
|
||||||
"height": 34, // Waybar height (to be removed for auto height)
|
"height": 34, // Waybar height (to be removed for auto height)
|
||||||
"modules-left": [
|
"modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"],
|
||||||
// "hyprland/workspaces",
|
|
||||||
// // "hyprland/window",
|
|
||||||
"sway/workspaces", "sway/mode", "sway/scratchpad"
|
|
||||||
],
|
|
||||||
"modules-center": ["clock"],
|
"modules-center": ["clock"],
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
"idle_inhibitor",
|
"idle_inhibitor",
|
||||||
@ -17,7 +13,6 @@
|
|||||||
"backlight",
|
"backlight",
|
||||||
"battery",
|
"battery",
|
||||||
"tray",
|
"tray",
|
||||||
"custom/notification"
|
|
||||||
],
|
],
|
||||||
"sway/mode": {
|
"sway/mode": {
|
||||||
"format": "<span style=\"italic\">{}</span>",
|
"format": "<span style=\"italic\">{}</span>",
|
||||||
@ -117,24 +112,4 @@
|
|||||||
},
|
},
|
||||||
"on-click": "pavucontrol",
|
"on-click": "pavucontrol",
|
||||||
},
|
},
|
||||||
"custom/notification" : {
|
|
||||||
"tooltip" : false,
|
|
||||||
"format" : "{} {icon}",
|
|
||||||
"format-icons" : {
|
|
||||||
"notification" : "",
|
|
||||||
"none" : "",
|
|
||||||
"dnd-notification" : " ",
|
|
||||||
"dnd-none" : "",
|
|
||||||
"inhibited-notification" : " ",
|
|
||||||
"inhibited-none" : "",
|
|
||||||
"dnd-inhibited-notification" : " ",
|
|
||||||
"dnd-inhibited-none" : " ",
|
|
||||||
},
|
|
||||||
"return-type" : "json",
|
|
||||||
"exec-if" : "which swaync-client",
|
|
||||||
"exec" : "swaync-client -swb",
|
|
||||||
"on-click" : "sleep 0.1 && swaync-client -t -sw",
|
|
||||||
"on-click-right" : "sleep 0.1 && swaync-client -d -sw",
|
|
||||||
"escape" : true,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
* {
|
* {
|
||||||
font-family: "Iosevka Nerd Font", "Font Awesome 6 Free", "monospace";
|
font-family: "Iosevka Nerd Font", "Font Awesome 6 Free", "monospace";
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@define-color background #282828;
|
@define-color background #282828;
|
||||||
@ -27,18 +25,6 @@ window#waybar {
|
|||||||
background-color: @background;
|
background-color: @background;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.module-left * {
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom-notification {
|
|
||||||
/* padding: 0 20px; */
|
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 20px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#custom-scratch {
|
#custom-scratch {
|
||||||
@ -48,7 +34,6 @@ window#waybar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#workspaces button {
|
#workspaces button {
|
||||||
padding: 0 10px;
|
|
||||||
border-radius: 0px;
|
border-radius: 0px;
|
||||||
color: @foreground;
|
color: @foreground;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user