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

feat(mappings): add config option to disable default mappings #514

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

konosubakonoakua
Copy link
Contributor

Describe what this PR does / why we need it

add option to disable default mappings also align colors and mappings code for better vision

Does this pull request fix one issue?

Fixes #507

Describe how you did it

check mappings_disable_default flag before merging user config, if true, set default mappings to {}

Describe how to verify it

  {
    -- TODO: keymapping for 'octo.nvim'
    "konosubakonoakua/octo.nvim",
    -- 'pwntester/octo.nvim',
    dependencies = {
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim",
      -- OR 'ibhagwan/fzf-lua',
      "nvim-tree/nvim-web-devicons",
    },
    config = function()
      require("octo").setup({
        mappings_disable_default = false,
        suppress_missing_scope = {
          projects_v2 = true,
        },
      })
    end,
  },

Special notes for reviews

@pwntester
Copy link
Owner

@konosubakonoakua Thanks! please document the new config option both in the README and doc/octo.txt

also align colors and mappings code for better vision
should close pwntester#507
@konosubakonoakua
Copy link
Contributor Author

@konosubakonoakua Thanks! please document the new config option both in the README and doc/octo.txt

Done~, please review again. 😄

@pwntester
Copy link
Owner

Thank you!

@pwntester pwntester merged commit 5bf366d into pwntester:master Mar 18, 2024
1 of 2 checks passed
@ckangnz
Copy link

ckangnz commented Mar 20, 2024

hey thanks @pwntester and @konosubakonoakua

I just tested this and I'm getting errors when the value is set to true

image

@konosubakonoakua
Copy link
Contributor Author

hey thanks @pwntester and @konosubakonoakua

I just tested this and I'm getting errors when the value is set to true

image

Could you put your config for octo here? I can not reproduce with the config I pasted here

@ckangnz
Copy link

ckangnz commented Mar 20, 2024

  require "octo".setup({
    use_local_fs = false,
    enable_builtin = true,
    default_remote = { "upstream", "origin" },
    default_merge_method = "squash",
    picker = "telescope",
    default_to_projects_v2 = true,
    ui = { use_signcolumn = true },
    issues = {
      order_by = {
        field = "CREATED_AT", -- either COMMENTS, CREATED_AT or UPDATED_AT
        direction = "DESC"    -- either DESC or ASC
      }
    },
    pull_requests = {
      order_by = {
        field = "CREATED_AT",                -- either COMMENTS, CREATED_AT or UPDATED_AT
        direction = "DESC"                   -- either DESC or ASC
      },
      always_select_remote_on_create = false -- always give prompt to select base remote repo when creating PRs
    },
    file_panel = {
      size = 10,
      use_icons = true
    },
    colors = {
      white = Colors.white,
      grey = Colors.light_grey,
      black = Colors.light_black,
      red = Colors.red,
      dark_red = Colors.dark_red,
      green = Colors.green,
      dark_green = Colors.dark_green,
      yellow = Colors.yellow,
      dark_yellow = Colors.brow,
      blue = Colors.blue,
      dark_blue = Colors.dark_blue,
      purple = Colors.dark_magenta,
    },
    mappings_disable_default = false,
    mappings = {},
    comment_icon = "▎", -- comment marker
    outdated_icon = "󰅒 ", -- outdated indicator
    resolved_icon = " ", -- resolved indicator
    reaction_viewer_hint_icon = " ", -- marker for user reactions
    user_icon = " ", -- user icon
    timeline_marker = " ", -- timeline marker
    timeline_indent = "2", -- timeline indentation
    right_bubble_delimiter = "", -- bubble delimiter
    left_bubble_delimiter = "", -- bubble delimiter
  })

  vim.keymap.set("n", "<leader>O", "<cmd>Octo<cr>", { noremap = true, silent = true })
  vim.keymap.set("v", "<leader>O", "<cmd>Octo<cr>", { noremap = true, silent = true })

  vim.api.nvim_create_autocmd("FileType", {
    pattern = "octo",
    callback = function()
      vim.keymap.set("i", "@", "@<C-x><C-o>", { silent = true, buffer = true })
      vim.keymap.set("i", "#", "#<C-x><C-o>", { silent = true, buffer = true })
    end
  })

This is what i have 🙂 I've set mappings_disable_default = false, because i get an error when its set to true

@konosubakonoakua
Copy link
Contributor Author

@ckangnz could not reproduce with your config, btw I removed the color setting, are you using the latest version of octo.nvim?

@ckangnz
Copy link

ckangnz commented Mar 21, 2024

@konosubakonoakua Yes i am using the latest version. I can see mappings_disable_default in :help Octo so it must be using the version that consists this change?

@konosubakonoakua
Copy link
Contributor Author

@konosubakonoakua Yes i am using the latest version. I can see mappings_disable_default in :help Octo so it must be using the version that consists this change?

Strange. could you try konosubakonoakua/octo.nvim ?

@pwntester
Copy link
Owner

@ckangnz I was able to reproduce your issue and fixed it on 72bd42c Let me know if it works for you

@ckangnz
Copy link

ckangnz commented Mar 21, 2024

@pwntester hey yes it definitely fixed the issue 🙂 Awesome work! Thank you 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabling all keymaps option
3 participants