From b40d6c8ea41a907456adbc54f40f3fa1ca16deb4 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Wed, 14 May 2025 07:03:31 +0200 Subject: [PATCH] Updated scripts --- README.md | 2 +- config/alacritty/alacritty.toml | 6 +- config/hypr/hyprland.conf | 3 + config/nvim/init.lua | 1343 ++++++++++++++++--------------- tmux.conf | 49 +- update_arch.sh | 18 +- 6 files changed, 725 insertions(+), 696 deletions(-) diff --git a/README.md b/README.md index fd50751..02e4794 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # linuxbox ## WSL Ubuntu -Script and dotfiles for setting up complete dev environment based on Ubuntu 22.04 (and 24.04) + Script and dotfiles for setting up complete dev environment based on Ubuntu 22.04 (and 24.04) If Win11 is used as main terminal/client then pleas configure following: * Windows Terminal (Preview) diff --git a/config/alacritty/alacritty.toml b/config/alacritty/alacritty.toml index 7e5d9e0..6779625 100644 --- a/config/alacritty/alacritty.toml +++ b/config/alacritty/alacritty.toml @@ -5,7 +5,8 @@ normal={family="RobotoMonoNerdFont", style="Regular"} [colors.primary] foreground="#c6c6c6" -background="#262626" +# background="#262626" +background="#000000" [colors.normal] black="#000000" @@ -36,3 +37,6 @@ padding={x=2} [env] TERM="xterm-256color" + +[mouse] +hide_when_typing = true diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index 85b7499..91a5d44 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -327,6 +327,9 @@ windowrulev2 = workspace emptyn, initialTitle:^(FreeCAD.*)$ # Steam windowrulev2 = workspace emptyn, initialTitle:^(.*Steam.*)$ +# RSI +windowrulev2 = workspace emptyn, initialTitle:^(.*RSI.*)$ + # Ignore maximize requests from apps. You'll probably like this. windowrulev2 = suppressevent maximize, class:.* diff --git a/config/nvim/init.lua b/config/nvim/init.lua index dc67b07..09f1822 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,7 +1,10 @@ -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 +vim.g.mapleader = " " +vim.g.maplocalleader = " " +-- vim.g.loaded_netrw = 1 +-- vim.g.loaded_netrwPlugin = 1 + +-- Set to true if you have a Nerd Font installed and selected in the terminal +vim.g.have_nerd_font = true -- Set highlight on search vim.o.hlsearch = false @@ -10,7 +13,7 @@ vim.o.hlsearch = false vim.wo.number = true -- Enable mouse mode -vim.o.mouse = 'a' +vim.o.mouse = "a" -- Enable break indent vim.o.breakindent = true @@ -23,10 +26,10 @@ vim.o.ignorecase = true vim.o.smartcase = true -- Keep signcolumn on by default -vim.wo.signcolumn = 'yes' +vim.wo.signcolumn = "yes" -- Set completeopt to have a better completion experience -vim.o.completeopt = 'menuone,noselect,noinsert' +-- vim.o.completeopt = "menuone,noselect,noinsert" -- Use terminal colors vim.o.termguicolors = true @@ -38,13 +41,25 @@ vim.o.tabstop = 4 vim.o.expandtab = true vim.o.softtabstop = 4 +-- Preview substitutions live, as you type! +vim.o.inccommand = "split" + -- Show cursor line vim.o.cursorline = true +vim.o.showmatch = true + +-- Decrease update time +vim.o.updatetime = 250 + +-- Decrease mapped sequence wait time +vim.o.timeoutlen = 300 + vim.o.pumheight = 10 vim.o.relativenumber = true vim.o.scrolloff = 8 +-- Don't show the mode, since it's already in the status line vim.o.showmode = false vim.o.showtabline = 0 @@ -55,50 +70,70 @@ vim.o.foldmethod = "expr" vim.o.foldexpr = "nvim_treesitter#foldexpr()" vim.o.foldlevelstart = 99 +vim.schedule(function() + vim.o.clipboard = "unnamedplus" +end) + +vim.o.autoread = true + +------------------------------------------------------------------- +-- Autocommands +------------------------------------------------------------------- + +-- Autoset current working directory based on closest git repo +vim.api.nvim_create_autocmd("BufEnter", { + callback = function() + local git_dir = vim.fn.finddir(".git", ".;") + if git_dir ~= "" then + local git_root = vim.fn.fnamemodify(git_dir, ":h") + vim.cmd("lcd " .. git_root) + end + end, +}) + -- show cursor line only in active window local cursorLineGrp = vim.api.nvim_create_augroup("CursorLine", { clear = true }) vim.api.nvim_create_autocmd( - { "InsertLeave", "WinEnter" }, - { pattern = "*", command = "set cursorline", group = cursorLineGrp } + { "InsertLeave", "WinEnter" }, + { pattern = "*", command = "set cursorline", group = cursorLineGrp } ) vim.api.nvim_create_autocmd( - { "InsertEnter", "WinLeave" }, - { pattern = "*", command = "set nocursorline", group = cursorLineGrp } + { "InsertEnter", "WinLeave" }, + { pattern = "*", command = "set nocursorline", group = cursorLineGrp } ) vim.api.nvim_create_autocmd( - { "InsertLeave", "FocusGained" }, - { pattern = "*", command = "set cursorline", group = cursorLineGrp } + { "InsertLeave", "FocusGained" }, + { pattern = "*", command = "set cursorline", group = cursorLineGrp } ) vim.api.nvim_create_autocmd( - { "InsertEnter", "FocusLost" }, - { pattern = "*", command = "set nocursorline", group = cursorLineGrp } + { "InsertEnter", "FocusLost" }, + { pattern = "*", command = "set nocursorline", group = cursorLineGrp } ) --- Auto format on save -vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] - -- Auto update on file changes -vim.o.autoread = true vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "CursorHoldI", "FocusGained" }, { - command = "if mode() != 'c' | checktime | endif", - pattern = { "*" }, + command = "if mode() != 'c' | checktime | endif", + pattern = { "*" }, }) -vim.api.nvim_create_autocmd({ "FileChangedShellPost" }, - { command = 'echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None', pattern = { "*" }, }) +vim.api.nvim_create_autocmd( + { "FileChangedShellPost" }, + { command = 'echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None', pattern = { "*" } } +) + ------------------------------------------------------------------- -- Plugin management ------------------------------------------------------------------- -local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system { - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', -- latest stable release - lazypath, - } + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end vim.opt.rtp:prepend(lazypath) @@ -106,662 +141,660 @@ vim.opt.rtp:prepend(lazypath) ------------------------------------------------------------------- -- Plugin installation ------------------------------------------------------------------- -require('lazy').setup({ +require("lazy").setup({ - -- Color scheme ------------------------------------------ - { - dir = "~/linuxbox/nightly_cm.nvim", - lazy = false, - priority = 1000, - config = function() - vim.cmd.colorscheme 'nightly_cm' - end, - }, + -- Color scheme ------------------------------------------ + { + dir = "~/linuxbox/nightly_cm.nvim", + lazy = false, + priority = 1000, + config = function() + vim.cmd.colorscheme("nightly_cm") + end, + }, - -- LSP ---------------------------------------------------- - { - "neovim/nvim-lspconfig" - }, + -- LSP ---------------------------------------------------- - { - "L3MON4D3/LuaSnip", - -- follow latest release. - version = "v2.*", -- Replace by the latest released major (first number of latest release) - -- install jsregexp (optional!). - build = "make install_jsregexp" - }, + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + 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" } }, + }, + }, + }, - { - 'hrsh7th/nvim-cmp', - dependencies = { - 'saadparwaiz1/cmp_luasnip', - 'hrsh7th/cmp-nvim-lsp', - 'rafamadriz/friendly-snippets', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - }, - }, + { + -- Main LSP Configuration + "neovim/nvim-lspconfig", + dependencies = { + { "j-hui/fidget.nvim", opts = {} }, + }, + config = function() + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), + callback = function(event) + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc, mode) + mode = mode or "n" + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end - { - "ahmedkhalf/project.nvim", - config = function() - require("project_nvim").setup { - sync_root_with_cwd = true, - respect_buf_cwd = true, - update_focused_file = { - enable = true, - update_root = true - }, - } - end - }, + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map("grn", vim.lsp.buf.rename, "[R]e[n]ame") - { - -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - }, - build = ':TSUpdate', - }, + -- 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("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" }) - { - "simrat39/rust-tools.nvim", - }, + -- Find references for the word under your cursor. + map("grr", require("fzf-lua").lsp_references, "[G]oto [R]eferences") - { - "ray-x/lsp_signature.nvim", - config = function() - require "lsp_signature".setup { - bind = true, -- This is mandatory, otherwise border config won't get registered. - handler_opts = { - border = "solid" - } - } - end - }, + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map("gri", require("fzf-lua").lsp_implementations, "[G]oto [I]mplementation") - -- File explorer ------------------------------------------- - { - "ibhagwan/fzf-lua", - -- optional for icon support - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - -- calling `setup` is optional for customization - require("fzf-lua").setup({}) - end - }, + -- 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 . + map("grd", require("fzf-lua").lsp_definitions, "[G]oto [D]efinition") - { - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", - "MunifTanjim/nui.nvim", - }, - config = function() - require("neo-tree").setup { - close_if_last_window = true, - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = true, - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes - sort_case_insensitive = false, -- used when sorting files and directories in the tree - sort_function = nil, -- use a custom function for sorting files and directories in the tree - default_component_configs = { - container = { - enable_character_fade = true - }, - indent = { - indent_size = 2, - padding = 1, -- extra padding on left hand side - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - highlight = "NeoTreeIndentMarker", - -- expander config, needed for nesting files - with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "󰜌", - provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available - if node.type == "file" or node.type == "terminal" then - local success, web_devicons = pcall(require, "nvim-web-devicons") - local name = node.type == "terminal" and "terminal" or node.name - if success then - local devicon, hl = web_devicons.get_icon(name) - icon.text = devicon or icon.text - icon.highlight = hl or icon.highlight - end - end - end, - -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there - -- then these will never be used. - default = "*", - highlight = "NeoTreeFileIcon" - }, - modified = { - symbol = "[+]", - highlight = "NeoTreeModified", - }, - name = { - trailing_slash = false, - use_git_status_colors = true, - highlight = "NeoTreeFileName", - }, - git_status = { - symbols = { - -- Change type - added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖", -- this can only be used in the git_status source - renamed = "󰁕", -- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "󰄱", - staged = "", - conflict = "", - } - }, - -- If you don't want to use these columns, you can set `enabled = false` for each of them individually - file_size = { - enabled = true, - required_width = 64, -- min width of window required to show this column - }, - type = { - enabled = true, - required_width = 122, -- min width of window required to show this column - }, - last_modified = { - enabled = true, - required_width = 88, -- min width of window required to show this column - }, - created = { - enabled = true, - required_width = 110, -- min width of window required to show this column - }, - symlink_target = { - enabled = false, - }, - }, - commands = { - parent_or_close = function(state) - local node = state.tree:get_node() - if (node.type == "directory" or node:has_children()) and node:is_expanded() then - state.commands.toggle_node(state) - else - require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id()) - end - end, - child_or_open = function(state) - local node = state.tree:get_node() - if node.type == "directory" or node:has_children() then - if not node:is_expanded() then -- if unexpanded, expand - state.commands.toggle_node(state) - else -- if expanded and has children, seleect the next child - require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1]) - end - else -- if not a directory just open it - state.commands.open(state) - end - end, - copy_selector = function(state) - local node = state.tree:get_node() - local filepath = node:get_id() - local filename = node.name - local modify = vim.fn.fnamemodify + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") - local results = { - e = { val = modify(filename, ":e"), msg = "Extension only" }, - f = { val = filename, msg = "Filename" }, - F = { val = modify(filename, ":r"), msg = "Filename w/o extension" }, - h = { val = modify(filepath, ":~"), msg = "Path relative to Home" }, - p = { val = modify(filepath, ":."), msg = "Path relative to CWD" }, - P = { val = filepath, msg = "Absolute path" }, - } + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map("gO", require("fzf-lua").lsp_document_symbols, "Open Document Symbols") - local messages = { - { "\nChoose to copy to clipboard:\n", "Normal" }, - } - for i, result in pairs(results) do - if result.val and result.val ~= "" then - vim.list_extend(messages, { - { ("%s."):format(i), "Identifier" }, - { (" %s: "):format(result.msg) }, - { result.val, "String" }, - { "\n" }, - }) - end - end - vim.api.nvim_echo(messages, false, {}) - local result = results[vim.fn.getcharstr()] - if result and result.val and result.val ~= "" then - vim.notify("Copied: " .. result.val) - vim.fn.setreg("+", result.val) - end - end, - }, - window = { - position = "float", - width = 40, - mappings = { - [""] = false, -- disable space until we figure out which-key disabling - h = "parent_or_close", - l = "child_or_open", - Y = "copy_selector", - }, - }, - } - end, - }, + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map("gW", require("fzf-lua").lsp_live_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("fzf-lua").lsp_typedefs, "[G]oto [T]ype Definition") - -- GUI ------------------------------------------------------ + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) + ---@param client vim.lsp.Client + ---@param method vim.lsp.protocol.Method + ---@param bufnr? integer some lsp support methods only in specific files + ---@return boolean + local function client_supports_method(client, method, bufnr) + if vim.fn.has("nvim-0.11") == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end - { - 'mrjones2014/smart-splits.nvim', - opts = { - at_edge = 'stop', - } - }, + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + -- if + -- client + -- and client_supports_method( + -- client, + -- vim.lsp.protocol.Methods.textDocument_documentHighlight, + -- event.buf + -- ) + -- then + -- local highlight_augroup = + -- vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) + -- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + -- buffer = event.buf, + -- group = highlight_augroup, + -- callback = vim.lsp.buf.document_highlight, + -- }) + -- + -- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + -- buffer = event.buf, + -- group = highlight_augroup, + -- callback = vim.lsp.buf.clear_references, + -- }) + -- + -- vim.api.nvim_create_autocmd("LspDetach", { + -- group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), + -- callback = function(event2) + -- vim.lsp.buf.clear_references() + -- vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) + -- end, + -- }) + -- end - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - opts = { - options = { - icons_enabled = true, - theme = 'nightly_cm', - component_separators = '', - section_separators = '', - globalstatus = true, - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff' }, - lualine_c = { 'diagnostics', 'filename' }, - lualine_x = { - { - -- Lsp server name . - function() - local msg = '' - local clients = vim.lsp.get_clients({ bufnr = 0 }) - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - msg = msg .. client.name .. ", " - end - if msg == '' then - return msg - end - return msg:sub(1, -3) - end, - color = { fg = '#c6c6c6' }, - }, - }, - lualine_y = { 'filetype' }, - lualine_z = { 'progress' } - }, - }, - }, + -- 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("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, + }) - { - -- Adds git releated signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "▎" }, - topdelete = { text = "▎" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, - preview_config = { - -- Options passed to nvim_open_win - border = 'solid', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - on_attach = function(bufnr) - vim.keymap.set('n', 'gp', require('gitsigns').prev_hunk, - { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) - vim.keymap.set('n', 'gn', require('gitsigns').next_hunk, - { buffer = bufnr, desc = '[G]o to [N]ext Hunk' }) - vim.keymap.set('n', 'ph', require('gitsigns').preview_hunk, - { buffer = bufnr, desc = '[P]review [H]unk' }) - end, - }, - }, + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config({ + severity_sort = true, + float = { border = "rounded", source = "if_many" }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = "󰅚 ", + [vim.diagnostic.severity.WARN] = "󰀪 ", + [vim.diagnostic.severity.INFO] = "󰋽 ", + [vim.diagnostic.severity.HINT] = "󰌶 ", + }, + } 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, + }, + }) - { - -- Add indentation guides even on blank lines - 'lukas-reineke/indent-blankline.nvim', - main = "ibl", - opts = { - scope = { - show_end = false, - } - } - }, + local capabilities = require("blink.cmp").get_lsp_capabilities() - { - "norcalli/nvim-colorizer.lua", - config = function() - require("colorizer").setup() - end, - }, + local servers = { + clangd = {}, + html = {}, + yamlls = {}, + bashls = {}, + pyright = {}, + marksman = {}, + rust_analyzer = {}, + lua_ls = { + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } - { - "folke/lazydev.nvim", - ft = "lua", -- only load on lua files - opts = { - 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" } }, - }, - }, - }, + for server_name, server in pairs(servers) do + server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) + require("lspconfig")[server_name].setup(server) + end + end, + }, + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + -- Conform will run multiple formatters sequentially + python = { "black" }, + -- You can customize some of the format options for the filetype (:help conform.format) + rust = { "rustfmt", lsp_format = "fallback" }, + -- Conform will run the first available formatter + javascript = { "prettier", stop_after_first = true }, + }, + format_on_save = { + -- These options will be passed to conform.format() + timeout_ms = 500, + lsp_format = "fallback", + }, + }, + }, - { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 - end, - opts = { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } - }, + { -- Autocompletion + "saghen/blink.cmp", + event = "VimEnter", + version = "1.*", + dependencies = { + -- Snippet Engine + { + "L3MON4D3/LuaSnip", + version = "2.*", + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then + return + end + return "make install_jsregexp" + end)(), + dependencies = {}, + opts = {}, + }, + "folke/lazydev.nvim", + }, + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + keymap = { + preset = "default", + }, - { - 'MeanderingProgrammer/render-markdown.nvim', - dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons - ---@module 'render-markdown' - ---@type render.md.UserConfig - opts = { - code = { - enabled = true, - sign = true, - style = 'full', - position = 'left', - language_pad = 0, - language_name = true, - disable_background = { 'diff' }, - width = 'full', - left_margin = 0, - left_pad = 0, - right_pad = 0, - min_width = 0, - border = 'thick', - above = '▄', - below = '▀', - highlight = 'RenderMarkdownCode', - highlight_inline = 'RenderMarkdownCodeInline', - highlight_language = nil, - }, - }, - }, + appearance = { + nerd_font_variant = "mono", + }, - -- Utils --------------------------------------------------- - { - "max397574/better-escape.nvim", - opts = { timeout = 300 } - }, + completion = { + -- By default, you may press `` 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 }, + }, - { 'numToStr/Comment.nvim', opts = {} }, + sources = { + default = { "lsp", "buffer", "path", "snippets", "lazydev" }, + providers = { + lazydev = { module = "lazydev.integrations.blink", score_offset = 100 }, + }, + }, - { - "folke/todo-comments.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { - } - }, + snippets = { preset = "luasnip" }, - { - 'phaazon/hop.nvim', - branch = 'v2', -- optional but strongly recommended - config = function() - require 'hop'.setup { keys = 'etovxqpdygfblzhckisuran' } - end - }, + fuzzy = { implementation = "prefer_rust_with_warning" }, - { - "folke/trouble.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - opts = { - }, - }, + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, + }, + }, + { -- Highlight, edit, and navigate code + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + main = "nvim-treesitter.configs", -- Sets main module to use for opts + opts = { + ensure_installed = { + "bash", + "c", + "diff", + "html", + "lua", + "luadoc", + "markdown", + "markdown_inline", + "query", + "vim", + "vimdoc", + "rust", + "python", + }, + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { "ruby" }, + }, + indent = { enable = true, disable = { "ruby" } }, + }, + }, + + -- File explorer ------------------------------------------- + { + "ibhagwan/fzf-lua", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = {}, + }, + + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + opts = { + close_if_last_window = true, + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes + sort_case_insensitive = false, -- used when sorting files and directories in the tree + sort_function = nil, -- use a custom function for sorting files and directories in the tree + default_component_configs = { + container = { + enable_character_fade = true, + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty_open = "", + folder_empty = "󰜌", + provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available + if node.type == "file" or node.type == "terminal" then + local success, web_devicons = pcall(require, "nvim-web-devicons") + local name = node.type == "terminal" and "terminal" or node.name + if success then + local devicon, hl = web_devicons.get_icon(name) + icon.text = devicon or icon.text + icon.highlight = hl or icon.highlight + end + end + end, + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon", + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = false, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "✖", -- this can only be used in the git_status source + renamed = "󰁕", -- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + }, + }, + -- -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + -- file_size = { + -- enabled = true, + -- required_width = 64, -- min width of window required to show this column + -- }, + -- type = { + -- enabled = true, + -- required_width = 122, -- min width of window required to show this column + -- }, + -- last_modified = { + -- enabled = true, + -- required_width = 88, -- min width of window required to show this column + -- }, + -- created = { + -- enabled = true, + -- required_width = 110, -- min width of window required to show this column + -- }, + -- symlink_target = { + -- enabled = false, + -- }, + }, + commands = { + parent_or_close = function(state) + local node = state.tree:get_node() + if (node.type == "directory" or node:has_children()) and node:is_expanded() then + state.commands.toggle_node(state) + else + require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id()) + end + end, + child_or_open = function(state) + local node = state.tree:get_node() + if node.type == "directory" or node:has_children() then + if not node:is_expanded() then -- if unexpanded, expand + state.commands.toggle_node(state) + else -- if expanded and has children, seleect the next child + require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1]) + end + else -- if not a directory just open it + state.commands.open(state) + end + end, + copy_selector = function(state) + local node = state.tree:get_node() + local filepath = node:get_id() + local filename = node.name + local modify = vim.fn.fnamemodify + + local results = { + e = { val = modify(filename, ":e"), msg = "Extension only" }, + f = { val = filename, msg = "Filename" }, + F = { val = modify(filename, ":r"), msg = "Filename w/o extension" }, + h = { val = modify(filepath, ":~"), msg = "Path relative to Home" }, + p = { val = modify(filepath, ":."), msg = "Path relative to CWD" }, + P = { val = filepath, msg = "Absolute path" }, + } + + local messages = { + { "\nChoose to copy to clipboard:\n", "Normal" }, + } + for i, result in pairs(results) do + if result.val and result.val ~= "" then + vim.list_extend(messages, { + { ("%s."):format(i), "Identifier" }, + { (" %s: "):format(result.msg) }, + { result.val, "String" }, + { "\n" }, + }) + end + end + vim.api.nvim_echo(messages, false, {}) + local result = results[vim.fn.getcharstr()] + if result and result.val and result.val ~= "" then + vim.notify("Copied: " .. result.val) + vim.fn.setreg("+", result.val) + end + end, + }, + window = { + position = "float", + width = 40, + mappings = { + [""] = false, -- disable space until we figure out which-key disabling + h = "parent_or_close", + l = "child_or_open", + Y = "copy_selector", + }, + }, + }, + }, + + -- GUI ------------------------------------------------------ + + { + "mrjones2014/smart-splits.nvim", + opts = { + at_edge = "stop", + }, + }, + + { + -- Set lualine as statusline + "nvim-lualine/lualine.nvim", + opts = { + options = { + icons_enabled = true, + theme = "nightly_cm", + component_separators = "", + section_separators = "", + globalstatus = true, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff" }, + lualine_c = { "diagnostics", "filename" }, + lualine_x = { + { + -- Lsp server name . + function() + local msg = "" + local clients = vim.lsp.get_clients({ bufnr = 0 }) + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + msg = msg .. client.name .. ", " + end + if msg == "" then + return msg + end + return msg:sub(1, -3) + end, + color = { fg = "#c6c6c6" }, + }, + }, + lualine_y = { "filetype" }, + lualine_z = { "progress" }, + }, + }, + }, + + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "▎" }, + topdelete = { text = "▎" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + preview_config = { + -- Options passed to nvim_open_win + border = "solid", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + }, + }, + + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = { + scope = { + show_end = false, + }, + }, + }, + + { + "norcalli/nvim-colorizer.lua", + opts = {}, + }, + + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = {}, + }, + + { + "stevearc/dressing.nvim", + opts = {}, + }, + + -- Utils --------------------------------------------------- + { + "max397574/better-escape.nvim", + opts = { timeout = 300 }, + }, + + { "numToStr/Comment.nvim", opts = {} }, + + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = {}, + }, + + { + "phaazon/hop.nvim", + branch = "v2", -- optional but strongly recommended + opts = { + keys = "etovxqpdygfblzhckisuran", + }, + }, + + { + "folke/trouble.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + opts = {}, + }, }, {}) -------------------------------------------------------------------- --- LSP Configurations -------------------------------------------------------------------- -local lspconfig = require('lspconfig') - --- Lua -lspconfig.lua_ls.setup {} --- Rust -lspconfig.rust_analyzer.setup { - -- Server-specific settings. See `:help lspconfig-setup` - settings = { - ['rust-analyzer'] = {}, - }, -} - --- [[ Configure nvim-cmp ]] -local cmp = require 'cmp' -local luasnip = require 'luasnip' -require('luasnip.loaders.from_vscode').lazy_load() -luasnip.config.setup {} -local cmp_opts = { - border = "solid", - winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,Search:NONE,CursorLine:PmenuSel', -} -local has_words_before = function() - if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil -end -cmp.setup { - preselect = cmp.PreselectMode.None, - view = { - entries = "custom" -- can be "custom", "wildmenu" or "native" - }, - completion = { - completion = { completeopt = 'menu,menuone,noinsert,noselect' }, - }, - window = { - completion = cmp.config.window.bordered(cmp_opts), - documentation = cmp.config.window.bordered(cmp_opts), - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - duplicates = { - nvim_lsp = 1, - luasnip = 1, - cmp_tabnine = 1, - buffer = 1, - path = 1, - }, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.complete {}, - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() and has_words_before() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }, - sources = { - -- { name = 'copilot', priority = 2 }, - { name = 'nvim_lsp', priority = 2 }, - { name = 'buffer', priority = 2 }, - { name = 'path', priority = 2 }, - { name = 'luasnip', priority = 2 }, - }, -} - -cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - view = { - entries = { name = 'wildmenu', separator = '|' } - }, - window = { - completion = cmp.config.window.bordered(cmp_opts), - documentation = cmp.config.window.bordered(cmp_opts), - }, - sources = { - { name = 'buffer' } - } -}) - -cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - view = { - entries = { name = 'wildmenu', separator = '|' } - }, - window = { - completion = cmp.config.window.bordered(cmp_opts), - documentation = cmp.config.window.bordered(cmp_opts), - }, - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) -}) - --- [[ Configure Treesitter ]] -require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter - auto_install = true, - - highlight = { enable = true }, - indent = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', - }, - }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, -} - -- resizing splits -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').resize_left, { desc = 'Resize left' }) -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').resize_down, { desc = 'Resize down' }) -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').resize_up, { desc = 'Resize up' }) -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').resize_right, { desc = 'Resize right' }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").resize_left, { desc = "Resize left" }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").resize_down, { desc = "Resize down" }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").resize_up, { desc = "Resize up" }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").resize_right, { desc = "Resize right" }) -- moving between splits -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').move_cursor_left, { desc = 'Move cursor left' }) -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').move_cursor_down, { desc = 'Move cursor down' }) -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').move_cursor_up, { desc = 'Move cursor up' }) -vim.keymap.set({ 'n', 't' }, '', require('smart-splits').move_cursor_right, { desc = 'Move cursor right' }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").move_cursor_left, { desc = "Move cursor left" }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").move_cursor_down, { desc = "Move cursor down" }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").move_cursor_up, { desc = "Move cursor up" }) +vim.keymap.set({ "n", "t" }, "", require("smart-splits").move_cursor_right, { desc = "Move cursor right" }) -- swapping buffers between windows -vim.keymap.set('n', 'h', require('smart-splits').swap_buf_left, { desc = 'Swap buffer left' }) -vim.keymap.set('n', 'j', require('smart-splits').swap_buf_down, { desc = 'Swap buffer down' }) -vim.keymap.set('n', 'k', require('smart-splits').swap_buf_up, { desc = 'Swap buffer up' }) -vim.keymap.set('n', 'l', require('smart-splits').swap_buf_right, { desc = 'Swap buffer right' }) +vim.keymap.set("n", "h", require("smart-splits").swap_buf_left, { desc = "Swap buffer left" }) +vim.keymap.set("n", "j", require("smart-splits").swap_buf_down, { desc = "Swap buffer down" }) +vim.keymap.set("n", "k", require("smart-splits").swap_buf_up, { desc = "Swap buffer up" }) +vim.keymap.set("n", "l", require("smart-splits").swap_buf_right, { desc = "Swap buffer right" }) -- Yank, delete, and paste always use system clipboard -vim.keymap.set({ 'n', 'v' }, 'y', '"+y', { noremap = true, silent = true }) -vim.keymap.set({ 'n', 'v' }, 'Y', '"+Y', { noremap = true, silent = true }) -vim.keymap.set({ 'n', 'v' }, 'd', '"+d', { noremap = true, silent = true }) +vim.keymap.set({ "n", "v" }, "y", '"+y', { noremap = true, silent = true }) +vim.keymap.set({ "n", "v" }, "Y", '"+Y', { noremap = true, silent = true }) +vim.keymap.set({ "n", "v" }, "d", '"+d', { noremap = true, silent = true }) -- vim.keymap.set({ 'n', 'v' }, 'x', '"+x', { noremap = true, silent = true }) -vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { noremap = true, silent = true }) -vim.keymap.set({ 'n', 'v' }, 'P', '"+P', { noremap = true, silent = true }) +vim.keymap.set({ "n", "v" }, "p", '"+p', { noremap = true, silent = true }) +vim.keymap.set({ "n", "v" }, "P", '"+P', { noremap = true, silent = true }) +-- Clear highlights on search when pressing in normal mode +-- See `:help hlsearch` +vim.keymap.set("n", "", "nohlsearch") --Other -vim.keymap.set('n', 's', ":HopWord", { desc = 'hop', silent = true }) -vim.keymap.set('n', '', ":tabNext", { desc = 'Next tab', silent = true }) -vim.keymap.set('n', '', ":Format", { desc = 'Format code', silent = true }) -vim.keymap.set('n', '', ":make", { desc = 'Format code', silent = true }) -vim.keymap.set('n', '', ":make clean", { desc = 'Format code', silent = true }) -vim.keymap.set('n', '', ":write", { desc = 'Save', silent = true }) -vim.keymap.set('n', '', ":quit", { desc = 'Quit', silent = true }) -vim.keymap.set('n', 'e', ":Neotree filesystem reveal float toggle", { desc = 'File explorer', silent = true }) -vim.keymap.set('n', 'd', ":Trouble diagnostics toggle", { desc = 'Diagnostic view', silent = true }) -vim.keymap.set('n', 'f', ":FzfLua files", { desc = 'Find file', silent = true }) +vim.keymap.set("n", "s", ":HopWord", { desc = "hop", silent = true }) +vim.keymap.set("n", "", ":tabNext", { desc = "Next tab", silent = true }) +vim.keymap.set("n", "", ":write", { desc = "Save", silent = true }) +vim.keymap.set("n", "", ":quit", { desc = "Quit", silent = true }) +vim.keymap.set( + "n", + "e", + ":Neotree filesystem reveal float toggle", + { desc = "File explorer", silent = true } +) +vim.keymap.set("n", "d", ":Trouble diagnostics toggle", { desc = "Diagnostic view", silent = true }) +vim.keymap.set("n", "f", ":FzfLua files cwd=~/", { desc = "Find file", silent = true }) diff --git a/tmux.conf b/tmux.conf index fb3c8e1..b8b049b 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,6 +1,7 @@ # Plugind set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'mrjones2014/smart-splits.nvim' # Install `tpm` if needed. if "test ! -d ~/.tmux/plugins/tpm" \ @@ -17,36 +18,40 @@ set -g pane-base-index 1 set-window-option -g pane-base-index 1 set-option -g renumber-windows on -# VIM and FZF navigation bindings -is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" -is_fzf="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'" -bind -n C-h run "($is_vim && tmux send-keys C-h) || tmux select-pane -L" -bind -n C-j run "($is_vim && tmux send-keys C-j) || ($is_fzf && tmux send-keys C-j) || tmux select-pane -D" -bind -n C-k run "($is_vim && tmux send-keys C-k) || ($is_fzf && tmux send-keys C-k) || tmux select-pane -U" -bind -n C-l run "($is_vim && tmux send-keys C-l) || tmux select-pane -R" -# bind -n 'C-\' if-shell "$is_vim" "send-keys C-\\" "select-pane -l" -bind -n M-h run "($is_vim && tmux send-keys M-h) || tmux resize-pane -L 1" -bind -n M-j run "($is_vim && tmux send-keys M-j) || tmux resize-pane -D 1" -bind -n M-k run "($is_vim && tmux send-keys M-k) || tmux resize-pane -U 1" -bind -n M-l run "($is_vim && tmux send-keys M-l) || tmux resize-pane -R 1" +# Optional configurations with their default values if omitted: +set -g @smart-splits_no_wrap '' # to disable wrapping. (any value disables wrapping) + +set -g @smart-splits_move_left_key 'M-h' # key-mapping for navigation. +set -g @smart-splits_move_down_key 'M-j' # --"-- +set -g @smart-splits_move_up_key 'M-k' # --"-- +set -g @smart-splits_move_right_key 'M-l' # --"-- + +set -g @smart-splits_resize_left_key 'C-M-h' # key-mapping for resizing. +set -g @smart-splits_resize_down_key 'C-M-j' # --"-- +set -g @smart-splits_resize_up_key 'C-M-k' # --"-- +set -g @smart-splits_resize_right_key 'C-M-l' # --"-- + +set -g @smart-splits_resize_step_size '3' # change the step-size for resizing. + +bind -n M-Left split-window -h -b -c "#{pane_current_path}" +bind -n M-Right split-window -h -c "#{pane_current_path}" +bind -n M-Down split-window -v -c "#{pane_current_path}" +bind -n M-Up split-window -v -b -c "#{pane_current_path}" bind -n M-1 select-window -t 1 bind -n M-2 select-window -t 2 bind -n M-3 select-window -t 3 bind -n M-4 select-window -t 4 bind -n M-5 select-window -t 5 -bind -n C-M-n select-window -n +bind -n M-n select-window -n -bind -n C-M-c new-window -bind -n C-M-x confirm kill-pane +bind -n M-c new-window +bind -n M-x confirm kill-pane -bind -n C-M-v split-window -h -c "#{pane_current_path}" -bind -n C-M-s split-window -v -c "#{pane_current_path}" - -bind -n C-g display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "lazygit" -bind -n C-t display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "btop" -bind -n C-f display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "EDITOR=nvim ranger" +bind -n M-g display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "lazygit" +bind -n M-t display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "btop" +bind -n M-f display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "EDITOR=nvim ranger" set-option -g status-position top set-option -g default-terminal "tmux-256color" @@ -56,8 +61,6 @@ set-option -g focus-events on set-option -g status-right-length 100 set-option -g set-clipboard on -# set -g allow-passthrough on -# set -g extended-keys on set -g status-interval 2 set -g status-bg "#303030" set -g status-fg "#c6c6c6" diff --git a/update_arch.sh b/update_arch.sh index 7ddbee3..ae333fd 100755 --- a/update_arch.sh +++ b/update_arch.sh @@ -274,16 +274,11 @@ if [ "${ROLES[TERMINAL]}" == "yes" ]; then make -C ble.sh install if [ -d ~/ble.sh ]; then rm -rf ~/ble.sh; fi ln -sf ~/linuxbox/blerc ~/.blerc -# fi -# -# # Install code utility -# if [ "${ROLES[CODE]}" == "yes" ]; then - # printf -- '\033[33m Installing code utilities\n\033[37m' - # sudo pacman --noconfirm --needed -S code platformio-core printf -- '\033[33m Installing LSP servers\n\033[37m' - sudo pacman --noconfirm --needed -S rust-analyzer lua-language-server bash-language-server ccls vscode-html-languageserver vscode-json-languageserver marksman pyright yaml-language-server vscode-css-languageserver clang + sudo pacman --noconfirm --needed -S prettier stylua python-black shfmt lua-language-server bash-language-server ccls vscode-html-languageserver vscode-json-languageserver marksman pyright yaml-language-server vscode-css-languageserver clang yay --noconfirm -S --needed --aur dockerfile-language-server + rustup component add rust-analyzer clippy rustfmt printf -- '\033[33m Installing Rust embedded rp2040\n\033[37m' cd ~ @@ -293,15 +288,6 @@ if [ "${ROLES[TERMINAL]}" == "yes" ]; then mkdir -p ~/.local/bin ln -sf ~/linuxbox/pico-load.sh ~/.local/bin/pico-load - # printf -- '\033[33m Installing teensy udev rules\n\033[37m' - # if [ ! -f /.dockerenv ]; then - # sudo rm -f /tmp/00-teensy.rules /etc/udev/rules.d/00-teensy.rules /lib/udev/rules.d/00-teensy.rules - # sudo wget -O /tmp/00-teensy.rules https://www.pjrc.com/teensy/00-teensy.rules - # sudo install -o root -g root -m 0664 /tmp/00-teensy.rules /lib/udev/rules.d/00-teensy.rules - # sudo udevadm control --reload-rules - # sudo udevadm trigger - # fi - printf -- '\033[33m Installing VirtualHere client\n\033[37m' cd ~ wget https://www.virtualhere.com/sites/default/files/usbclient/scripts/virtualhereclient.service