diff --git a/dotfiles/kitty/kitty.conf b/dotfiles/kitty/kitty.conf index 0720b2a..fd6f1e7 100644 --- a/dotfiles/kitty/kitty.conf +++ b/dotfiles/kitty/kitty.conf @@ -76,17 +76,18 @@ map ctrl+shift+left resize_window narrower map ctrl+shift+right resize_window wider map ctrl+shift+up resize_window taller map ctrl+shift+down resize_window shorter 3 +map ctrl+shift+enter new_window_with_cwd # reset all windows in the tab to default sizes map ctrl+shift+0 resize_window reset confirm_os_window_close 0 enable_audio_bell no -window_padding_width 6 +window_padding_width 2 #hide_window_decorations yes font_size 14.0 -#background_opacity 1 -background_opacity 0.98 +background_opacity 1 +#background_opacity 0.98 #background_image ~/Nextcloud/Images/Wallpapers/kitty-bg.png #background_image_layout cscaled #background_tint 0.99 diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua index a02cf30..d26b886 100644 --- a/dotfiles/nvim/init.lua +++ b/dotfiles/nvim/init.lua @@ -79,6 +79,10 @@ require("nvim-tree").setup { quit_on_open = true, }, }, + filters = { + custom = { ".git" }, + exclude = { ".gitignore" }, + }, } local autocmd = vim.api.nvim_create_autocmd @@ -101,6 +105,37 @@ local function open_nvim_tree(data) -- open the tree require("nvim-tree.api").tree.open() + + -- Get a list of all buffers + local buffers = vim.api.nvim_list_bufs() + + -- Iterate over each buffer + for _, bufnr in ipairs(buffers) do + -- Check if the buffer is empty and doesn't have a name + if + vim.api.nvim_buf_is_loaded(bufnr) + and vim.api.nvim_buf_get_name(bufnr) == "" + and vim.api.nvim_buf_get_option(bufnr, "buftype") == "" + then + -- Get all lines in the buffer + local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) + + -- Initialize a variable to store the total number of characters + local total_characters = 0 + + -- Iterate over each line and calculate the number of characters + for _, line in ipairs(lines) do + total_characters = total_characters + #line + end + + -- Close the buffer if it's empty: + if total_characters == 0 then + vim.api.nvim_buf_delete(bufnr, { + force = true, + }) + end + end + end end autocmd({ "VimEnter" }, { callback = open_nvim_tree }) diff --git a/dotfiles/nvim/lua/chadrc.lua b/dotfiles/nvim/lua/chadrc.lua index 93d9627..959cec6 100644 --- a/dotfiles/nvim/lua/chadrc.lua +++ b/dotfiles/nvim/lua/chadrc.lua @@ -1,6 +1,6 @@ --- This file needs to have same structure as nvconfig.lua +-- This file needs to have same structure as nvconfig.lua -- https://github.com/NvChad/ui/blob/v3.0/lua/nvconfig.lua --- Please read that file to know all available options :( +-- Please read that file to know all available options :( ---@type ChadrcConfig local M = {} @@ -16,6 +16,6 @@ M.ui = { } M.nvdash = { - load_on_startup = true, + load_on_startup = false, } return M diff --git a/dotfiles/nvim/lua/configs/conform.lua b/dotfiles/nvim/lua/configs/conform.lua index ab05207..2d2eb34 100644 --- a/dotfiles/nvim/lua/configs/conform.lua +++ b/dotfiles/nvim/lua/configs/conform.lua @@ -4,11 +4,14 @@ local options = { css = { "prettier" }, html = { "prettier" }, js = { "prettier" }, + javascript = { "prettier" }, + typescript = { "prettier" }, php = { "php_cs_fixer" }, + python = { "black" }, }, format_on_save = { - timeout_ms = 500, + timeout_ms = 15000, lsp_fallback = true, }, } diff --git a/dotfiles/nvim/lua/configs/lspconfig.lua b/dotfiles/nvim/lua/configs/lspconfig.lua index bbb41a2..a87a3fd 100644 --- a/dotfiles/nvim/lua/configs/lspconfig.lua +++ b/dotfiles/nvim/lua/configs/lspconfig.lua @@ -3,19 +3,19 @@ require("nvchad.configs.lspconfig").defaults() local lspconfig = require "lspconfig" --- EXAMPLE +-- cf. https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md local servers = { "html", "cssls", "phpactor", "gopls", - -- "intelephense", "jsonls", "lua_ls", "nixd", + "pylsp", "tailwindcss", "templ", - "vuels", + -- "volar", } local nvlsp = require "nvchad.configs.lspconfig" diff --git a/dotfiles/nvim/lua/plugins/init.lua b/dotfiles/nvim/lua/plugins/init.lua index 9e3a3c7..0a58b26 100644 --- a/dotfiles/nvim/lua/plugins/init.lua +++ b/dotfiles/nvim/lua/plugins/init.lua @@ -45,6 +45,44 @@ return { "ThePrimeagen/harpoon", branch = "harpoon2", dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + menu = { + width = vim.api.nvim_win_get_width(0) - 4, + }, + settings = { + save_on_toggle = true, + }, + }, + keys = function() + local keys = { + { + "H", + function() + require("harpoon"):list():add() + end, + desc = "Harpoon File", + }, + { + "h", + function() + local harpoon = require "harpoon" + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, + desc = "Harpoon Quick Menu", + }, + } + + for i = 1, 6 do + table.insert(keys, { + "", + function() + require("harpoon"):list():select(i) + end, + desc = "Harpoon to File " .. i, + }) + end + return keys + end, }, { "nvim-treesitter/nvim-treesitter", @@ -64,6 +102,7 @@ return { "php", "python", "rust", + "templ", "toml", "tsx", "typescript", diff --git a/dotfiles/tmux/tmux.conf b/dotfiles/tmux/tmux.conf index 202f183..123d1e5 100644 --- a/dotfiles/tmux/tmux.conf +++ b/dotfiles/tmux/tmux.conf @@ -8,15 +8,15 @@ set -g escape-time 0 # zero-out escape time delay set -g history-limit 1000000 # increase history size (from 2,000) set -g renumber-windows on # renumber all windows when any window is closed set -g set-clipboard on # use system clipboard -set -g status-position top # macOS / darwin style +set -g status-position bottom # macOS / darwin style set -g default-terminal "${TERM}" set -g pane-active-border-style 'fg=magenta,bg=default' set -g pane-border-style 'fg=brightblack,bg=default' set -g mouse on #bind-key -r B run-shell "~/.config/tmux/scripts/sessionizer.sh ~/omerxx/omerxx.com" -set -g @fzf-url-fzf-options '-p 60%,30% --prompt=" " --border-label=" Open URL "' -set -g @fzf-url-history-limit '2000' +#set -g @fzf-url-fzf-options '-p 60%,30% --prompt=" " --border-label=" Open URL "' +#set -g @fzf-url-history-limit '2000' # Vim style pane selection bind h select-pane -L @@ -31,18 +31,18 @@ set-window-option -g pane-base-index 1 set-option -g renumber-windows on # Use Alt-arrow keys without prefix key to switch panes -bind -n M-Left select-pane -L -bind -n M-Right select-pane -R -bind -n M-Up select-pane -U -bind -n M-Down select-pane -D +#bind -n M-Left select-pane -L +#bind -n M-Right select-pane -R +#bind -n M-Up select-pane -U +#bind -n M-Down select-pane -D # Shift arrow to switch windows -bind -n S-Left previous-window -bind -n S-Right next-window +#bind -n S-Left previous-window +#bind -n S-Right next-window # Shift Alt vim keys to switch windows -bind -n M-H previous-window -bind -n M-L next-window +#bind -n M-H previous-window +#bind -n M-L next-window # set vi-mode set-window-option -g mode-keys vi @@ -51,45 +51,45 @@ bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel -bind '"' split-window -v -c "#{pane_current_path}" -bind % split-window -h -c "#{pane_current_path}" +#bind '"' split-window -v -c "#{pane_current_path}" +#bind % split-window -h -c "#{pane_current_path}" set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' -set -g @plugin 'fcsonline/tmux-thumbs' -set -g @plugin 'sainnhe/tmux-fzf' -set -g @plugin 'wfxr/tmux-fzf-url' -set -g @plugin 'omerxx/catppuccin-tmux' # My fork that holds the meetings script bc I'm lazy af -set -g @plugin 'omerxx/tmux-sessionx' +#set -g @plugin 'fcsonline/tmux-thumbs' +#set -g @plugin 'sainnhe/tmux-fzf' +#set -g @plugin 'wfxr/tmux-fzf-url' +#set -g @plugin 'omerxx/catppuccin-tmux' # My fork that holds the meetings script bc I'm lazy af +#set -g @plugin 'omerxx/tmux-sessionx' -set -g @sessionx-bind 'o' -set -g @sessionx-x-path '~/dotfiles' -set -g @sessionx-window-height '85%' -set -g @sessionx-window-width '75%' -set -g @sessionx-zoxide-mode 'on' -set -g @continuum-restore 'on' -set -g @resurrect-strategy-nvim 'session' -set -g @catppuccin_window_left_separator "" -set -g @catppuccin_window_right_separator " " -set -g @catppuccin_window_middle_separator " █" -set -g @catppuccin_window_number_position "right" -set -g @catppuccin_window_default_fill "number" -set -g @catppuccin_window_default_text "#W" -set -g @catppuccin_window_current_fill "number" -set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}" -set -g @catppuccin_status_modules_right "directory date_time" -set -g @catppuccin_status_modules_left "session" -set -g @catppuccin_status_left_separator " " -set -g @catppuccin_status_right_separator " " -set -g @catppuccin_status_right_separator_inverse "no" -set -g @catppuccin_status_fill "icon" -set -g @catppuccin_status_connect_separator "no" -set -g @catppuccin_directory_text "#{b:pane_current_path}" +#set -g @sessionx-bind 'o' +#set -g @sessionx-x-path '~/dotfiles' +#set -g @sessionx-window-height '85%' +#set -g @sessionx-window-width '75%' +#set -g @sessionx-zoxide-mode 'on' +#set -g @continuum-restore 'on' +#set -g @resurrect-strategy-nvim 'session' +#set -g @catppuccin_window_left_separator "" +#set -g @catppuccin_window_right_separator " " +#set -g @catppuccin_window_middle_separator " █" +#set -g @catppuccin_window_number_position "right" +#set -g @catppuccin_window_default_fill "number" +#set -g @catppuccin_window_default_text "#W" +#set -g @catppuccin_window_current_fill "number" +#set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(),}" +#set -g @catppuccin_status_modules_right "directory date_time" +#set -g @catppuccin_status_modules_left "session" +#set -g @catppuccin_status_left_separator " " +#set -g @catppuccin_status_right_separator " " +#set -g @catppuccin_status_right_separator_inverse "no" +#set -g @catppuccin_status_fill "icon" +#set -g @catppuccin_status_connect_separator "no" +#set -g @catppuccin_directory_text "#{b:pane_current_path}" #set -g @catppuccin_meetings_text "#($HOME/.config/tmux/scripts/cal.sh)" -set -g @catppuccin_meetings_text "" -set -g @catppuccin_date_time_text "%H:%M" +#set -g @catppuccin_meetings_text "" +#set -g @catppuccin_date_time_text "%H:%M" run '~/.config/tmux/plugins/tpm/tpm' diff --git a/home-manager/mrflos-cli.nix b/home-manager/mrflos-cli.nix index 52261ec..e2fb2c0 100644 --- a/home-manager/mrflos-cli.nix +++ b/home-manager/mrflos-cli.nix @@ -8,6 +8,7 @@ ansible atuin bat + black btop cargo catnip @@ -24,6 +25,7 @@ gnugrep gnumake gnupg + go imagemagick jq git @@ -54,7 +56,9 @@ php83Packages.php-cs-fixer phpactor pinentry + python312 python312Packages.pip + python312Packages.python-lsp-server ripgrep slides starship @@ -239,8 +243,6 @@ enable = true; settings = with builtins; fromTOML (readFile ../dotfiles/starship/starship.toml); }; - - zsh = { enable = true; diff --git a/machines/Segotep-desktop-tower-configuration.nix b/machines/dragon/configuration.nix similarity index 52% rename from machines/Segotep-desktop-tower-configuration.nix rename to machines/dragon/configuration.nix index 2005eb8..31f40fa 100644 --- a/machines/Segotep-desktop-tower-configuration.nix +++ b/machines/dragon/configuration.nix @@ -12,8 +12,7 @@ networking.hostName = "dragon"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.extraHosts = - '' + networking.extraHosts = '' 163.172.173.184 aleks-test-install-bookworm.test ''; @@ -42,47 +41,94 @@ LC_TIME = "fr_FR.UTF-8"; }; - # Enable the X11 windowing system. - services.xserver.enable = true; - services.xserver.videoDrivers = [ "amdgpu" ]; - - # Configure keymap in X11 + hardware.graphics = { + enable = true; + }; + + nixpkgs.config.allowUnfree = true; + nixpkgs.config.nvidia.acceptLicense = true; + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.latest; + }; services.xserver = { + enable = true; + videoDrivers = [ + "intel" + "nvidia" + ]; xkb.layout = "us"; xkb.variant = ""; }; - fileSystems."/mnt/nas/music" = - { - device = "192.168.1.2:/volume1/music"; - options = [ "nfsvers=4.2" "x-systemd.automount" "noauto" "rw" "relatime" "user" "acl" "defaults"]; - fsType = "nfs"; - }; + fileSystems."/mnt/nas/music" = { + device = "192.168.1.2:/volume1/music"; + options = [ + "nfsvers=4.2" + "x-systemd.automount" + "noauto" + "rw" + "relatime" + "user" + "acl" + "defaults" + ]; + fsType = "nfs"; + }; services.rpcbind.enable = true; # needed for NFS - systemd.mounts = [{ - type = "nfs"; - mountConfig = { - Options = "defaults,acl,user,noauto,relatime,rw"; - }; - what = "192.168.1.2:/volume1/music"; - where = "/mnt/nas/music"; - }]; - - systemd.automounts = [{ - wantedBy = [ "multi-user.target" ]; - automountConfig = { - TimeoutIdleSec = "600"; - }; - where = "/mnt/nas/music"; - }]; + systemd.mounts = [ + { + type = "nfs"; + mountConfig = { + Options = "defaults,acl,user,noauto,relatime,rw"; + }; + what = "192.168.1.2:/volume1/music"; + where = "/mnt/nas/music"; + } + ]; + systemd.automounts = [ + { + wantedBy = [ "multi-user.target" ]; + automountConfig = { + TimeoutIdleSec = "600"; + }; + where = "/mnt/nas/music"; + } + ]; # Enable CUPS to print documents. services.printing.enable = true; # Enable sound with pipewire. - sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { @@ -102,12 +148,12 @@ # services.xserver.libinput.enable = true; imports = [ - ../modules/console.nix - ../modules/desktop.nix - ../modules/fonts.nix - ../modules/home-config.nix - ../modules/local-dev.nix - ../modules/nixos.nix + ../../modules/console.nix + ../../modules/desktop.nix + ../../modules/fonts.nix + ../../modules/home-config.nix + ../../modules/local-dev.nix + ../../modules/nixos.nix ]; # This value determines the NixOS release from which the default diff --git a/machines/Segotep-desktop-tower-hardware-configuration.nix b/machines/dragon/hardware-configuration.nix similarity index 65% rename from machines/Segotep-desktop-tower-hardware-configuration.nix rename to machines/dragon/hardware-configuration.nix index 8c51513..ab1a35c 100644 --- a/machines/Segotep-desktop-tower-hardware-configuration.nix +++ b/machines/dragon/hardware-configuration.nix @@ -1,29 +1,34 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ config, lib, modulesPath, ... }: { imports = - [ (modulesPath + "/installer/scan/not-detected.nix") + [ + (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "uas" "sd_mod" ]; - boot.initrd.kernelModules = [ "amdgpu" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "uas" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/65b2e400-b6f1-4158-9586-1f5bab13f664"; - fsType = "ext4"; + { + device = "/dev/disk/by-uuid/1257f6f4-52bf-4c9a-aa00-86080ecd044c"; + fsType = "btrfs"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/685D-B6DB"; + { + device = "/dev/disk/by-uuid/C182-445E"; fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; }; - swapDevices = [ ]; + swapDevices = + [{ device = "/dev/disk/by-uuid/96a0423d-a4c0-4376-9d34-5a99b764010a"; }]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's @@ -31,7 +36,6 @@ # with explicit per-interface declarations with `networking.interfaces..useDHCP`. networking.useDHCP = lib.mkDefault true; # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp0s20f0u1.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/modules/console.nix b/modules/console.nix index 297c497..b5df943 100644 --- a/modules/console.nix +++ b/modules/console.nix @@ -1,12 +1,5 @@ # cli programs should be available on servers and desktop { config, pkgs, ... }: -let - unstable = - import - (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/7afa2c97ebb0585d00c64c112344483e89e00545") - # reuse the current configuration - { config = config.nixpkgs.config; }; -in { programs.zsh.enable = true; programs.fzf = { @@ -14,13 +7,13 @@ in keybindings = true; }; - # programs.neovim = { - # enable = true; - # defaultEditor = true; - # package = unstable.neovim; - # viAlias = true; - # vimAlias = true; - # }; + # programs.neovim = { + # enable = true; + # defaultEditor = true; + # package = pkgs.neovim; + # viAlias = true; + # vimAlias = true; + #}; # List packages installed in system profile. To search, run: # $ nix search wget @@ -57,7 +50,8 @@ in mpd mpv neofetch - unstable.neovim + nixd + neovim ollama pandoc pass diff --git a/modules/desktop.nix b/modules/desktop.nix index 0499cd8..63bc621 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -1,7 +1,6 @@ # Window Manager and desktop programs { lib, pkgs, ... }: { - sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; @@ -138,7 +137,7 @@ signal-desktop thunderbird tigervnc - transmission-qt + transmission_4-qt unetbootin vlc diff --git a/modules/home-config.nix b/modules/home-config.nix index b6a1c00..16787ae 100644 --- a/modules/home-config.nix +++ b/modules/home-config.nix @@ -240,6 +240,7 @@ in #tmux = "tmux -f ~/.config/tmux/tmux.conf attach || tmux -f ~/.config/tmux/tmux.conf new"; bunx = "bun --bun x"; g = "lazygit"; + t = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer"; kdenix = "nix run github:pjones/plasma-manager --extra-experimental-features nix-command --extra-experimental-features flakes > /home/mrflos/Developpements/nixos-config/modules/home-plasma.nix"; icat = "kitty +kitten icat"; nixedit = "vi /etc/nixos"; @@ -248,7 +249,7 @@ in socks = "ssh -N -f -C -D 9090 mrflos@yunohost.yeswiki.net -p 6742"; vi = "/run/current-system/sw/bin/nvim"; vim = "/run/current-system/sw/bin/nvim"; - yeswiki-updater = "cd /home/mrflos/Developpements/yeswiki-installer/ && sudo php yeswiki-updater.php"; + yeswiki-updater = "cd /home/mrflos/Code/yeswiki-installer/ && sudo php yeswiki-updater.php"; }; initExtra = '' export BUN_INSTALL="$HOME/.bun" diff --git a/dotfiles/init_yeswiki_repos.sh b/scripts/init_yeswiki_repos.sh old mode 100644 new mode 100755 similarity index 96% rename from dotfiles/init_yeswiki_repos.sh rename to scripts/init_yeswiki_repos.sh index 9367ddf..92a6fcc --- a/dotfiles/init_yeswiki_repos.sh +++ b/scripts/init_yeswiki_repos.sh @@ -13,7 +13,7 @@ #printf "================ End install script dependencies ============\n" corebranch="doryphore-dev" -curdir="$HOME/Developpements" #${PWD} +curdir="$HOME/Code" #${PWD} repos=$(curl --request GET --url "https://api.github.com/orgs/yeswiki/repos?per_page=200" | jq '.[].full_name' | tr -d "\"" | sort) # core @@ -75,4 +75,6 @@ printf "================ End install YesWiki misc from forge.mrflos.pw ========= printf "\n================ Install other projects ================\n" dir="framemo" [ ! -d $curdir/$dir ] && git clone ssh://git@framagit.org/colibris/framemo.git +dir="nixin-web" +[ ! -d $curdir/$dir ] && git clone ssh://forgejo@git.distrilab.fr:NixiN/nixin-web.git printf "================ End install other projects ============\n" diff --git a/scripts/tmux-sessionizer b/scripts/tmux-sessionizer new file mode 100755 index 0000000..ca3f019 --- /dev/null +++ b/scripts/tmux-sessionizer @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +pushd ~/Code +if [[ $# -eq 1 ]]; then + selected=$1 +else + selected=$(find . -mindepth 1 -maxdepth 1 -type d | fzf) +fi + +if [[ -z $selected ]]; then + exit 0 +fi + +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) + +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected + exit 0 +fi + +if ! tmux has-session -t=$selected_name 2> /dev/null; then + tmux new-session -ds $selected_name -c $selected +fi + +tmux switch-client -t $selected_name +popd