From 4178cf8213c15f4f4d5d314a1543164daf781b73 Mon Sep 17 00:00:00 2001 From: bitinbyte Date: Wed, 17 May 2023 14:28:49 +0100 Subject: [PATCH 1/4] Add: Multiple improvements to the config and apps --- .zshrc | 6 +- Brewfile | 8 +- README.md | 110 +++++------------------ nvim/lua/core/lsp/providers/php.lua | 18 ++++ nvim/lua/core/lsp/providers/tailwind.lua | 18 ++++ nvim/lua/core/null-ls/init.lua | 2 + sketchybar/items/clock.sh | 2 +- tmuxinator/conigon.yml | 69 ++++++++++++++ yabai/yabairc | 5 ++ 9 files changed, 143 insertions(+), 95 deletions(-) create mode 100644 nvim/lua/core/lsp/providers/php.lua create mode 100644 nvim/lua/core/lsp/providers/tailwind.lua create mode 100644 tmuxinator/conigon.yml diff --git a/.zshrc b/.zshrc index 3e53838..ec25985 100644 --- a/.zshrc +++ b/.zshrc @@ -128,7 +128,8 @@ alias srv3='ssh dockeraccess@192.168.178.102' alias debug='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222' alias tmuxa='tmux a -t' alias tmuxn='tmux new -s' -alias mux=tmuxinator +alias mux='tmuxinator' +alias cat='bat' # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. @@ -159,3 +160,6 @@ export PATH="/opt/homebrew/opt/node@16/bin:$PATH" # Load Angular CLI autocompletion. source <(ng completion script) + + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh diff --git a/Brewfile b/Brewfile index 825907e..1ffce4d 100644 --- a/Brewfile +++ b/Brewfile @@ -8,11 +8,14 @@ tap "jesseduffield/lazygit" tap "koekeishiya/formulae" tap "osx-cross/arm" tap "osx-cross/avr" -tap "qmk/qmk" tap "zegervdv/zathura" +brew "bat" +brew "php" +brew "composer" brew "dooit" brew "exa" -brew "hurl" +brew "fzf" +brew "httpie" brew "lazydocker" brew "neovim" brew "node@16" @@ -25,5 +28,4 @@ brew "koekeishiya/formulae/skhd" brew "koekeishiya/formulae/yabai" cask "dbeaver-community" cask "kitty" -cask "qmk-toolbox" cask "raycast" diff --git a/README.md b/README.md index a5be3c8..127a600 100644 --- a/README.md +++ b/README.md @@ -18,20 +18,25 @@ This config only works with Neovim +0.8. It is almost 100% Lua and ViM doesn't s Previously this config used yank to clipboard out of the box with no need to use registers. Now, this feature is removed from the config. Since registers handle this out of the box, just use the + register. you can yank like this: + ``` "+yy ``` + And paste it like this: + ``` "+p ``` -You can also access the register from command line: +You can also access the register from command line: + ``` :reg + ``` -And from insert mode: +And from insert mode: + ``` + ``` @@ -39,6 +44,7 @@ And from insert mode: The author plans to create a youtube video explaining how registers works. ## Window Manager + This config uses yabai to manage windows in similar way as awesome wm in arch linux. There are some settings that need to be changed though. In order to be able to use it, we need to first, create a couple of workspaces (in my case I have 4 which i think is enough) and then enable the following settings: keyboard => keyboard shortcuts => Mission Control => mission control => enable all switch to desktop options. @@ -52,6 +58,7 @@ keyboard => keyboard shortcuts => spotlight => disable all options This config also uses sketchybar. In order for you to use it, you just only need to install sketchybar and automatically hide the native menu bar: desktop & dock => Menu Bar => Automatically hide and show applications + ## External Dependencies ### Terminal/Homebrew @@ -59,15 +66,16 @@ desktop & dock => Menu Bar => Automatically hide and show applications 1. Tmux | Kitty 2. IBM Plex Font (Patched nerd font) -2. Oh My ZSH -3. Powerlevel10k (terminal) -4. Ranger -5. LazyGit -6. LazyDocker -7. Zathura PDF -8. Sketchybar -9. Yabai -10. Raycast +3. Oh My ZSH +4. Powerlevel10k (terminal) +5. Ranger +6. LazyGit +7. LazyDocker +8. Zathura PDF +9. Sketchybar +10. Yabai +11. Raycast +12. MacTex (For latex - install from official webpage) ### Neovim @@ -83,7 +91,6 @@ desktop & dock => Menu Bar => Automatically hide and show applications To install a new LSP, you just only need to go to lua => core => lsp => providers and copy the boilerplate file using the name of your lsp you want to use. Then, you need to update the lsps table in lsp => init.lua with that file you just created and that's it. Just restart neovim and Mason will install everything for you out of the box. Don't forget to also use the on_attach from args that boilerplate file already forwards. - @@ -171,81 +178,4 @@ pip install pillow ranger-fm ## Anaconda -In order to use conda command, we need to perform the following command, after anaconda installation: - -```zsh -~/opt/anaconda3/bin/conda init zsh -``` - - - - - -## NV-DAP - -It needs to get installed the javascript debugger and it uses the firefox. Refer to the dap documentation. -Found out that chrome works better that firefox to debug. - - - - - -## Treesitter - -Tressitter will also detect a new filetype and download the parser by itself. - -### Zathura PDF - -To install zathura, we need to install poppler. - -Then, we can install zathura like this: - -```zsh -brew install zathura --with-synctex -brew install zathura-pdf-poppler -``` - -We also need to follow some steps that are in the zathura brew github page. - -## Docker - -Ubuntu needs to be composed with the following command: - -```zsh -docker compose up -d -``` - -And then to run: - -```zsh -ssh -p 2022 root@localhost -``` - -## Brewfile - -To backup installed packages: - -```zsh -brew bundle dump -``` - -To install from brew file: - -```zsh -brew bundle -``` - - - - - - - - - - - - -## Fonts - -To install a patched font, download all of the fonts you want to use (at least regular, italic and bold) and on the folder where you downloaded them, select all of them, right click of the mouse on the selection and then open. This will ensure that all of the fonts are grouped installed and linked +In order to use conda command, we need to perform the following command, after a diff --git a/nvim/lua/core/lsp/providers/php.lua b/nvim/lua/core/lsp/providers/php.lua new file mode 100644 index 0000000..1909542 --- /dev/null +++ b/nvim/lua/core/lsp/providers/php.lua @@ -0,0 +1,18 @@ +-- local status, lspconfig = pcall(require, "lspconfig") +-- if not status then +-- return +-- end + +local M = {} + +--- Function to load the params needed for lsp +---@param args {} on this case will be on_attach, capabilities and flags +function M.load(args) + require("lspconfig").phpactor.setup({ + on_attach = args.on_attach, + flags = args.flags, + capabilities = args.capabilities, + }) +end + +return M diff --git a/nvim/lua/core/lsp/providers/tailwind.lua b/nvim/lua/core/lsp/providers/tailwind.lua new file mode 100644 index 0000000..991cacd --- /dev/null +++ b/nvim/lua/core/lsp/providers/tailwind.lua @@ -0,0 +1,18 @@ +-- local status, lspconfig = pcall(require, "lspconfig") +-- if not status then +-- return +-- end + +local M = {} + +--- Function to load the params needed for lsp +---@param args {} on this case will be on_attach, capabilities and flags +function M.load(args) + require("lspconfig").tailwindcss.setup({ + on_attach = args.on_attach, + flags = args.flags, + capabilities = args.capabilities, + }) +end + +return M diff --git a/nvim/lua/core/null-ls/init.lua b/nvim/lua/core/null-ls/init.lua index 3976b1d..3ee51d6 100644 --- a/nvim/lua/core/null-ls/init.lua +++ b/nvim/lua/core/null-ls/init.lua @@ -37,6 +37,8 @@ null_ls.setup({ -- end, -- }), formatting.prettierd, + formatting.phpcsfixer, + formatting.blade_formatter, -- formatting.prettier, -- require("typescript.extensions.null-ls.code-actions"), }, diff --git a/sketchybar/items/clock.sh b/sketchybar/items/clock.sh index f88cd23..e42052e 100644 --- a/sketchybar/items/clock.sh +++ b/sketchybar/items/clock.sh @@ -2,7 +2,7 @@ sketchybar --add item clock right \ --set clock update_freq=10 \ - icon= \ + icon= \ icon.padding_left=8 \ icon.color=$BAR_COLOR \ icon.padding_right=0 \ diff --git a/tmuxinator/conigon.yml b/tmuxinator/conigon.yml new file mode 100644 index 0000000..57d5f28 --- /dev/null +++ b/tmuxinator/conigon.yml @@ -0,0 +1,69 @@ +# /Users/joaopedro/.config/tmuxinator/conigon.yml + +name: conigon +root: ~/Documents/data/work + +# Optional tmux socket +# socket_name: foo + +# Note that the pre and post options have been deprecated and will be replaced by +# project hooks. + +# Project hooks + +# Runs on project start, always +# on_project_start: command + +# Run on project start, the first time +# on_project_first_start: command + +# Run on project start, after the first time +# on_project_restart: command + +# Run on project exit ( detaching from tmux session ) +# on_project_exit: command + +# Run on project stop +# on_project_stop: command + +# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions. +# pre_window: rbenv shell 2.0.0-p247 + +# Pass command line options to tmux. Useful for specifying a different tmux.conf. +# tmux_options: -f ~/.tmux.mac.conf + +# Change the command to call tmux. This can be used by derivatives/wrappers like byobu. +# tmux_command: byobu + +# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used. +# startup_window: editor + +# Specifies (by index) which pane of the specified window will be selected on project startup. If not set, the first pane is used. +# startup_pane: 1 + +# Controls whether the tmux session should be attached to automatically. Defaults to true. +# attach: false + +windows: + - post: + root: ~/Documents/data/work/portal-station + layout: 0f86,135x38,0,0[135x28,0,0,0,135x9,0,29{67x9,0,29,1,67x9,68,29,2}] + # Synchronize all panes of this window, can be enabled before or after the pane commands run. + # 'before' represents legacy functionality and will be deprecated in a future release, in favour of 'after' + # synchronize: after + panes: + - nv + - # + - # + - adib: + root: ~/Documents/data/work/react-portal + layout: 3f48,135x38,0,0[135x28,0,0,3,135x9,0,29,4] + panes: + - nv + - # + - toolkit: + root: ~/Documents/data/work/toolkit-template + layout: 3f51,135x38,0,0[135x28,0,0,5,135x9,0,29,6] + panes: + - nv + - # diff --git a/yabai/yabairc b/yabai/yabairc index 11f7aa1..2636c6a 100755 --- a/yabai/yabairc +++ b/yabai/yabairc @@ -41,6 +41,11 @@ yabai -m rule --add app="^Terminal$" manage=off yabai -m rule --add app="^Mail$" manage=off yabai -m rule --add app="^Calendar$" manage=off yabai -m rule --add app="^Notes$" manage=off +yabai -m rule --add app="^Messages$" manage=off +yabai -m rule --add app="^Font Book$" manage=off +yabai -m rule --add app="^Maps$" manage=off +yabai -m rule --add app="^Docker Desktop$" manage=off +yabai -m rule --add app="^Installer$" manage=off # yabai -m rule --add app="^Karabiner-Elements$" manage=off From 23ceeb63b1bf1530d499442b55da81fe2d6b4b44 Mon Sep 17 00:00:00 2001 From: bitinbyte Date: Wed, 24 May 2023 15:17:24 +0100 Subject: [PATCH 2/4] Add: Fixed issue of the toggle window only toggling 2 --- skhd/skhdrc | 16 +++++++++++++--- yabai/yabairc | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/skhd/skhdrc b/skhd/skhdrc index 66f1c4f..16ac4c9 100644 --- a/skhd/skhdrc +++ b/skhd/skhdrc @@ -6,14 +6,24 @@ alt - k : yabai -m window --focus north alt - h : yabai -m window --focus west alt - l : yabai -m window --focus east -alt - tab : yabai -m window --focus next || yabai -m window --focus prev +# Wrong behaviour because it reaches the end and +# toggles between last and before last +# alt - tab : yabai -m window --focus next || yabai -m window --focus prev +# +# Correct behaviour +# Reaches the end and start on first again +alt - tab : yabai -m window --focus next || yabai -m window --focus first +# alt - tab : yabai -m window --focus next +# shift + alt - tab : yabai -m window --focus prev +# +# Test # alt - tab : yabai -m window --focus "$(yabai -m query --windows | jq -re "sort_by(.display, .space, .frame.x, .frame.y, .id) | map(select(.\"is-visible\" == true and .role != \"AXUnknown\")) | reverse | nth(index(map(select(.\"has-focus\" == true))) - 1).id")" # alt - tab : yabai -m window --focus "$(yabai -m query --windows --space | jq -re "[sort_by(.id, .frame) | reverse | .[] | select(.role == \"AXWindow\" and .subrole == \"AXStandardWindow\") | .id] | nth(index($(yabai -m query --windows --window | jq -re ".id")) - 1)")" # alt + shift - tab : yabai -m window --focus prev || yabai -m window --focus next # change focus between external displays (left and right) -alt - H : yabai -m display --focus west -alt - L : yabai -m display --focus east +shift + ctrl + alt - h : yabai -m display --focus west +shift + ctrl + alt - l : yabai -m display --focus east # Modifying the Layout shift + alt - r : yabai -m space --rotate 270 diff --git a/yabai/yabairc b/yabai/yabairc index 2636c6a..2616cc5 100755 --- a/yabai/yabairc +++ b/yabai/yabairc @@ -46,6 +46,7 @@ yabai -m rule --add app="^Font Book$" manage=off yabai -m rule --add app="^Maps$" manage=off yabai -m rule --add app="^Docker Desktop$" manage=off yabai -m rule --add app="^Installer$" manage=off +yabai -m rule --add app="^Books$" manage=off # yabai -m rule --add app="^Karabiner-Elements$" manage=off From 50f38fb2b8239d6400bdad85130bf5d027cb5f1e Mon Sep 17 00:00:00 2001 From: bitinbyte Date: Wed, 24 May 2023 15:57:31 +0100 Subject: [PATCH 3/4] Add: New focus toggle improvement to go backwards --- skhd/skhdrc | 1 + 1 file changed, 1 insertion(+) diff --git a/skhd/skhdrc b/skhd/skhdrc index 16ac4c9..1ff0492 100644 --- a/skhd/skhdrc +++ b/skhd/skhdrc @@ -13,6 +13,7 @@ alt - l : yabai -m window --focus east # Correct behaviour # Reaches the end and start on first again alt - tab : yabai -m window --focus next || yabai -m window --focus first +shift + alt - tab : yabai -m window --focus prev || yabai -m window --focus last # alt - tab : yabai -m window --focus next # shift + alt - tab : yabai -m window --focus prev # From ed1ab6a3fae2d02732fd4c51869ae26b1c684999 Mon Sep 17 00:00:00 2001 From: bitinbyte Date: Wed, 24 May 2023 15:57:39 +0100 Subject: [PATCH 4/4] Bump: warp --- Brewfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Brewfile b/Brewfile index 1ffce4d..3ced2a7 100644 --- a/Brewfile +++ b/Brewfile @@ -29,3 +29,4 @@ brew "koekeishiya/formulae/yabai" cask "dbeaver-community" cask "kitty" cask "raycast" +cask "warp"