diff --git a/nvim/init.lua b/nvim/init.lua index 1bc84bd..c186b01 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,10 +1,9 @@ - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -vim.opt.cmdheight = 0 +vim.opt.cmdheight = 0 -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true @@ -76,20 +75,19 @@ vim.opt.scrolloff = 10 -- quickfix to search and replace vim.api.nvim_create_user_command('SearchAndReplace', function() -- Prompt for the first string (the one to replace) - local stringOne = vim.fn.input('Enter the string to replace: ') + local stringOne = vim.fn.input 'Enter the string to replace: ' -- Prompt for the second string (the replacement) - local stringTwo = vim.fn.input('Enter the replacement string: ') - + local stringTwo = vim.fn.input 'Enter the replacement string: ' + -- Perform the search and replace in the quickfix list vim.cmd('cfdo %s/' .. stringOne .. '/' .. stringTwo .. '/g | update') - + -- Optionally close the buffers - vim.cmd('bd') + vim.cmd 'bd' end, {}) -- Map R to the LadderR command -vim.api.nvim_set_keymap('n', 'R', ':SearchAndReplace', { noremap = true, silent = true, desc = 'Search And [R]eplace'}) - +vim.api.nvim_set_keymap('n', 'R', ':SearchAndReplace', { noremap = true, silent = true, desc = 'Search And [R]eplace' }) -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -204,7 +202,7 @@ require('lazy').setup({ -- after the plugin has been loaded: -- config = function() ... end - { -- Useful plugin to show you pending keybinds. + { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' opts = { @@ -247,7 +245,7 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, + { 'c', group = '[C]ode', mode = { 'n', 'x' } }, { 'd', group = '[D]ocument' }, { 'r', group = '[R]ename' }, { 's', group = '[S]earch' }, @@ -287,7 +285,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -382,7 +380,7 @@ require('lazy').setup({ }, }, }, - { 'Bilal2453/luvit-meta', lazy = true }, + { 'Bilal2453/luvit-meta', lazy = true }, { -- Main LSP Configuration 'neovim/nvim-lspconfig', @@ -394,7 +392,7 @@ require('lazy').setup({ -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, + { 'j-hui/fidget.nvim', opts = {} }, -- Allows extra capabilities provided by nvim-cmp 'hrsh7th/cmp-nvim-lsp', @@ -574,7 +572,6 @@ require('lazy').setup({ -- You can press `g?` for help in this menu. require('mason').setup() - -- 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 {}) @@ -636,7 +633,7 @@ require('lazy').setup({ -- python = { "isort", "black" }, -- -- You can use 'stop_after_first' to run the first available formatter from the list - javascript = { "prettier", stop_after_first = true }, + javascript = { 'prettier', stop_after_first = true }, }, }, }, @@ -780,7 +777,6 @@ require('lazy').setup({ end, }, - -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, @@ -856,16 +852,16 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - require 'kickstart.plugins.debug', + require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', - require 'kickstart.plugins.autopairs', - require 'kickstart.plugins.neo-tree', - require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- My plugins - require 'kickstart.plugins.bufferline', - -- require 'kickstart.plugins.bottomline' + require 'kickstart.plugins.bufferline', + -- require 'kickstart.plugins.bottomline' -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/scripts/wofi-wifi.sh b/scripts/wofi-wifi.sh index 47df965..d1fd8ed 100755 --- a/scripts/wofi-wifi.sh +++ b/scripts/wofi-wifi.sh @@ -78,6 +78,8 @@ forget_network() { fi } +# Function to connect to a network + # Function to connect to a network connect_to_network() { while true; do @@ -113,6 +115,21 @@ connect_to_network() { exit 1 fi + # Check if there's an existing connection profile for this network + if nmcli connection show | grep -q "$chosen_network"; then + # Try to connect using the saved profile + nmcli connection up "$chosen_network" + if [ $? -eq 0 ]; then + # Connection successful + notify-send "Connected to $chosen_network using saved profile." + break + else + # If connection fails, delete the saved profile and prompt for a new password + nmcli connection delete "$chosen_network" + notify-send "Failed to connect with saved password. Enter a new password." + fi + fi + # Check if the network is secured security_check=$(nmcli -t -f SSID,SECURITY dev wifi | grep "$chosen_network" | awk -F':' '{print $2}') @@ -133,6 +150,7 @@ connect_to_network() { done } + # Main menu function main_menu() { network_info=$(get_network_info)