From c312bee907e33727da14890293db76b4a6b87f94 Mon Sep 17 00:00:00 2001 From: Uttarayan Date: Wed, 14 Feb 2024 01:48:29 +0530 Subject: [PATCH] [feat] Add carapace completer --- config/anyrun/config.ron | 39 +++++---------------- config/fish/config.fish | 1 + config/nushell/config.nu | 59 ++++++++++++++++---------------- config/nushell/env.nu | 4 +++ config/nushell/plugin.nu | 37 -------------------- config/nvim/lazy-lock.json | 10 +++--- config/nvim/lua/plugins.lua | 50 ++++++++++++++++++++++++++- config/nvim/lua/setup/rtools.lua | 8 +++-- 8 files changed, 102 insertions(+), 106 deletions(-) delete mode 100644 config/nushell/plugin.nu diff --git a/config/anyrun/config.ron b/config/anyrun/config.ron index 58a479e9..7d77b2ff 100644 --- a/config/anyrun/config.ron +++ b/config/anyrun/config.ron @@ -1,40 +1,17 @@ Config( - // `width` and `vertical_offset` use an enum for the value it can be either: - // Absolute(n): The absolute value in pixels - // Fraction(n): A fraction of the width or height of the full screen (depends on exclusive zones and the settings related to them) window respectively - - // How wide the input box and results are. - width: Absolute(1000), - - // Where Anyrun is located on the screen: Top, Center - position: Center, + width: Absolute(1000), + height: Absolute(0), - // How much the runner is shifted vertically - vertical_offset: Absolute(-200), + x: Fraction(0.5), + y: Fraction(0.3), - // Hide match and plugin info icons - hide_icons: false, - - // ignore exclusive zones, f.e. Waybar - ignore_exclusive_zones: false, - - // Layer shell layer: Background, Bottom, Top, Overlay - layer: Overlay, - - // Hide the plugin info panel - hide_plugin_info: false, - - // Close window when a click outside the main box is received + hide_icons: false, + ignore_exclusive_zones: false, + layer: Overlay, + hide_plugin_info: false, close_on_click: false, - - // Show search results immediately when Anyrun starts show_results_immediately: false, - - // Limit amount of entries shown in total max_entries: None, - - // List of plugins to be loaded by default, can be specified with a relative path to be loaded from the - // `/plugins` directory or with an absolute path to just load the file the path points to. plugins: [ "libhyprwin.so", "librink.so", diff --git a/config/fish/config.fish b/config/fish/config.fish index b2627af3..88d7d027 100644 --- a/config/fish/config.fish +++ b/config/fish/config.fish @@ -10,3 +10,4 @@ export CARGO_TARGET_DIR="$HOME/.local/share/cargo-target" # The next line updates PATH for the Google Cloud SDK. if [ -f '/Users/fs0c131y/Projects/gcloud/google-cloud-sdk/path.fish.inc' ]; . '/Users/fs0c131y/Projects/gcloud/google-cloud-sdk/path.fish.inc'; end + alias rebuds="bluetoothctl remove XX:XX:XX:XX:XX:XX; bluetoothctl scan on;bluetoothctl pair XX:XX:XX:XX:XX:XX; bluetoothctl connect XX:XX:XX:XX:XX:XX" diff --git a/config/nushell/config.nu b/config/nushell/config.nu index da8b55cb..bb946a86 100644 --- a/config/nushell/config.nu +++ b/config/nushell/config.nu @@ -1,37 +1,37 @@ # Nushell Config File -let fish_completer = {|spans| - fish --command $'complete "--do-complete=($spans | str join " ")"' - | $"value(char tab)description(char newline)" + $in - | from tsv --flexible --no-infer -} +# let fish_completer = {|spans| +# fish --command $'complete "--do-complete=($spans | str join " ")"' +# | $"value(char tab)description(char newline)" + $in +# | from tsv --flexible --no-infer +# } -let carapace_completer = {|spans: list| - carapace $spans.0 nushell ...$spans - | from json - | if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null } -} +# let carapace_completer = {|spans: list| +# carapace $spans.0 nushell ...$spans +# | from json +# | if ($in | default [] | where value =~ '^-.*ERR$' | is-empty) { $in } else { null } +# } -# This completer will use carapace by default -let external_completer = {|spans| - let expanded_alias = scope aliases - | where name == $spans.0 - | get -i 0.expansion +# # This completer will use carapace by default +# let external_completer = {|spans| +# let expanded_alias = scope aliases +# | where name == $spans.0 +# | get -i 0.expansion - let spans = if $expanded_alias != null { - $spans - | skip 1 - | prepend ($expanded_alias | split row ' ') - } else { - $spans - } +# let spans = if $expanded_alias != null { +# $spans +# | skip 1 +# | prepend ($expanded_alias | split row ' ') +# } else { +# $spans +# } - match $spans.0 { - nu => $fish_completer - git => $fish_completer - _ => $carapace_completer - } | do $in $spans -} +# match $spans.0 { +# nu => $fish_completer +# git => $fish_completer +# _ => $carapace_completer +# } | do $in $spans +# } # For more information on themes, see # https://www.nushell.sh/book/coloring_and_theming.html @@ -293,7 +293,7 @@ $env.config = { external: { enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up my be very slow max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options - completer: $external_completer + # completer: $external_completer } } filesize: { @@ -557,6 +557,7 @@ $env.config = { } +source ~/.cache/carapace/init.nu source starship.nu source zoxide.nu source alias.nu diff --git a/config/nushell/env.nu b/config/nushell/env.nu index b4fa8816..5fcf4dae 100644 --- a/config/nushell/env.nu +++ b/config/nushell/env.nu @@ -84,3 +84,7 @@ if ($os | str contains Windows) { $env.PATH = ($env.PATH | prepend $"($env.HOME)/.local/vcpkg") } +$env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional +mkdir ~/.cache/carapace +carapace _carapace nushell | save --force ~/.cache/carapace/init.nu + diff --git a/config/nushell/plugin.nu b/config/nushell/plugin.nu deleted file mode 100644 index 427fbea2..00000000 --- a/config/nushell/plugin.nu +++ /dev/null @@ -1,37 +0,0 @@ -register /Users/fs0c131y/.local/bin/nu_plugin_from_agp { - "sig": { - "name": "from agp", - "usage": "Parse text as agprefs and create a table.", - "extra_usage": "", - "search_terms": [], - "required_positional": [], - "optional_positional": [], - "rest_positional": null, - "named": [ - { - "long": "help", - "short": "h", - "arg": null, - "required": false, - "desc": "Display the help message for this command", - "var_id": null, - "default_value": null - } - ], - "input_output_types": [ - [ - "String", - { - "Table": [] - } - ] - ], - "allow_variants_without_examples": false, - "is_filter": false, - "creates_scope": false, - "allows_unknown_args": false, - "category": "Formats" - }, - "examples": [] -} - diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index b92f8a61..eaeecea1 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -8,7 +8,7 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "comfortable-motion.vim": { "branch": "master", "commit": "e20aeafb07c6184727b29f7674530150f7ab2036" }, "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, - "copilot.lua": { "branch": "master", "commit": "b03617a6dc4bc88b65ab5deac1631da9a9c2dcaf" }, + "copilot.lua": { "branch": "master", "commit": "71382c2efec76647287d46a4fbe0ec8c9809e2ee" }, "d2-vim": { "branch": "master", "commit": "981c87dccb63df2887cc41b96e84bf550f736c57" }, "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, "fidget.nvim": { "branch": "main", "commit": "1d1042d418ee8cb70d68f1e38db639844331c093" }, @@ -26,13 +26,13 @@ "mini.nvim": { "branch": "main", "commit": "b5645ac6eefce8e7af9d7dd4e5e296a81cba8a10" }, "neorg": { "branch": "main", "commit": "e6d89d333aff65a771a98955fac9fc178345c01c" }, "no-neck-pain.nvim": { "branch": "main", "commit": "fc3cc9012d9720aca3203702447caa59bd93f1a6" }, - "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, + "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" }, "nvim-dap": { "branch": "master", "commit": "9adbfdca13afbe646d09a8d7a86d5d031fb9c5a5" }, "nvim-dap-ui": { "branch": "master", "commit": "d845ebd798ad1cf30aa4abd4c4eff795cdcfdd4f" }, - "nvim-lspconfig": { "branch": "master", "commit": "1759ea68fbbb1303192020d3e59936189359e0ed" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac530dfb97e51d82e3b0a7cddbf7a4a7c4c10ff8" }, "nvim-nu": { "branch": "main", "commit": "f45f36a97fb0ea6e39f08cc2fac7a2fb3dc3999b" }, - "nvim-treesitter": { "branch": "master", "commit": "364b86ec8ea88e4a77ba676b93fb10829d6a9cb3" }, + "nvim-treesitter": { "branch": "master", "commit": "95125827758ee49a398cce05750dc9563ee3a23d" }, "nvim-treesitter-context": { "branch": "master", "commit": "9c06b115abc57c99cf0aa81dc29490f5001f57a1" }, "nvim-web-devicons": { "branch": "master", "commit": "aaec87dbdaa776bfa0a13c8694bec9bcb7454719" }, "octo.nvim": { "branch": "master", "commit": "f8db415529f0a28f62484e49e3518b48e2b76644" }, @@ -47,7 +47,7 @@ "symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "e54fbf4ab2b64640b639b75c006c23b4bc51c86f" }, + "telescope.nvim": { "branch": "master", "commit": "7b5c5f56a21e82fdcfe5b250278b8dfc4b1cbab4" }, "todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, "toggleterm.nvim": { "branch": "main", "commit": "b49df5cdce67a8964d1b027dae94bde212092b51" }, "tree-sitter-just": { "branch": "main", "commit": "4f5d53b52a65771f9695df3f1a294d5c80b916fb" }, diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 6a34ab33..78ae602f 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -97,11 +97,18 @@ return require('lazy').setup({ load = { ["core.defaults"] = {}, -- Loads default behaviour ["core.concealer"] = {}, -- Adds pretty icons to your documents - ["core.dirman"] = { -- Manages Neorg workspaces + ["core.completion"] = { + config = { + engine = "nvim-cmp", + } + }, + ["core.dirman"] = { -- Manages Neorg workspaces config = { workspaces = { notes = "~/Documents/norg", }, + default_workspace = "general", + index = "index.norg" }, }, }, @@ -470,6 +477,47 @@ return require('lazy').setup({ dependencies = { "mfussenegger/nvim-dap" }, config = function() require("dapui").setup() end }, + { + "mfussenegger/nvim-dap", + -- event = "LspAttach", + config = function() + local dap = require('dap') + local registry = require('mason-registry').get_package("codelldb"); + local codelldb = registry:get_install_path() .. "/codelldb" + dap.adapters.codelldb = { + type = 'server', + port = "${port}", + executable = { + -- CHANGE THIS to your path! + command = codelldb, + args = { "--port", "${port}" }, + + -- On windows you may have to uncomment this: + -- detached = false, + } + } + local program = function() + return vim.ui.select({ + }, { + prompt = "Select program to debug: ", + format_item = function(item) + return item + end, + }) + end + dap.configurations.rust = { + { + name = "Launch Rust (CODELLDB)", + type = "codelldb", + request = "launch", + program = program, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, + } + end + + }, -- { -- 'phaazon/hop.nvim', -- branch = 'v2', -- optional but strongly recommended diff --git a/config/nvim/lua/setup/rtools.lua b/config/nvim/lua/setup/rtools.lua index d11a0bdf..303a1055 100644 --- a/config/nvim/lua/setup/rtools.lua +++ b/config/nvim/lua/setup/rtools.lua @@ -2,8 +2,8 @@ -- local extension_path = vim.env.HOME .. '/.vscode/extensions/vadimcn.vscode-lldb-1.7.0' -- local codelldb_path = extension_path .. 'adapter/codelldb' -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.dylib' -local codelldb_path = '/Users/fs0c131y/.vscode-oss/extensions/vadimcn.vscode-lldb-1.8.1-universal/adapter/codelldb' -local liblldb_path = '/Users/fs0c131y/.vscode-oss/extensions/vadimcn.vscode-lldb-1.8.1-universal/lldb/lib/liblldb.dylib' +-- local codelldb_path = '/Users/fs0c131y/.vscode-oss/extensions/vadimcn.vscode-lldb-1.8.1-universal/adapter/codelldb' +-- local liblldb_path = '/Users/fs0c131y/.vscode-oss/extensions/vadimcn.vscode-lldb-1.8.1-universal/lldb/lib/liblldb.dylib' local lspstatus = require('lsp-status') -- local lsp_signature = require('lsp_signature') @@ -62,6 +62,8 @@ vim.g.rustaceanvim = { -- }, -- }, -- -- DAP configuration - -- dap = {}, + }, + dap = { + autoload_configurations = false }, }