Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua config v2 #14

Merged
merged 4 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
9 changes: 6 additions & 3 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -25,5 +28,5 @@ brew "koekeishiya/formulae/skhd"
brew "koekeishiya/formulae/yabai"
cask "dbeaver-community"
cask "kitty"
cask "qmk-toolbox"
cask "raycast"
cask "warp"
110 changes: 20 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,33 @@ 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:

```
<C-r>+
```

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.
Expand All @@ -52,22 +58,24 @@ 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

1. Tmux | Kitty
2. IBM Plex Font (Patched nerd font)
<!-- 2. Cascadia code font (To got the most of this config, use a patched font from nerd fonts) -->
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

Expand All @@ -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.


<!-- ### Packer -->
<!---->
<!-- In order to be able to benefit from the lazyloading, packer need to be synchronized and/or compiled to create the lazy loading file. Trust me, it's a huge difference on startup time, I've discovered in my hard way. -->
Expand Down Expand Up @@ -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
```

<!-- ## Web Development -->
<!---->
<!-- We need to install some stuff regarding web development. emmet-ls, tserver and intelephense from npm. -->

## 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.

<!-- ### Treesiter Commands -->
<!---->
<!-- For treesitter, only for neovim, you can install language interpreter by :TSInstall <language> -->

## 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
```

<!-- To install zathura, we need to install the meson: -->
<!-- ```Python -->
<!-- pip3 install meson -->
<!-- ``` -->
<!---->
<!-- We also need to install popler, we can install it from the homebrew. -->
<!---->
<!-- Then, we need to install girara, zathura and zathura-pdf-popler. We only need to follow the steps on the website. -->
<!---->
<!-- Then, we need to download Zathura and build it with meson and ninja. -->

## 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
18 changes: 18 additions & 0 deletions nvim/lua/core/lsp/providers/php.lua
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions nvim/lua/core/lsp/providers/tailwind.lua
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions nvim/lua/core/null-ls/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ null_ls.setup({
-- end,
-- }),
formatting.prettierd,
formatting.phpcsfixer,
formatting.blade_formatter,
-- formatting.prettier,
-- require("typescript.extensions.null-ls.code-actions"),
},
Expand Down
2 changes: 1 addition & 1 deletion sketchybar/items/clock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
17 changes: 14 additions & 3 deletions skhd/skhdrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@ 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
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
#
# 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
Expand Down
69 changes: 69 additions & 0 deletions tmuxinator/conigon.yml
Original file line number Diff line number Diff line change
@@ -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
- #
6 changes: 6 additions & 0 deletions yabai/yabairc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ 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="^Books$" manage=off
# yabai -m rule --add app="^Karabiner-Elements$" manage=off


Expand Down