tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
20.08k stars 1.01k forks source link

Commit action does not work correctly #1940

Closed goolzerg closed 2 years ago

goolzerg commented 2 years ago

Problem description

When I try to make a commit with 'cc' key in vim fugitive I always get an error: "Cannot make changes, 'modifable' is off"

Screenshot from 2022-01-28 23-17-46

Steps to reproduce:

  1. Stage some files inside a directory.
  2. Try to commit it by pressing 'c' key twice.

I already tried to enable modifiable inside config but no result.

Here is my config file:

- general
lvim.log.level = "warn"
lvim.format_on_save = true
lvim.colorscheme = "onedarker"
vim.api.nvim_set_option('modifiable', true)

-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = "space"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
lvim.keys.normal_mode["<S-x>"] = ":BufferClose<CR>"
lvim.keys.normal_mode["<S-z>"] = ":BufferCloseAllButCurrent<CR>"
lvim.keys.normal_mode["<C-x>"] = ":ToggleTerm size=10 direction=horizontal<cr>"

-- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.dashboard.active = true
lvim.builtin.notify.active = true
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.show_icons.git = 1
lvim.lsp.automatic_servers_installation = false
vim.opt.relativenumber = true

-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
  "bash",
  "c",
  "javascript",
  "json",
  "lua",
  "python",
  "typescript",
  "css",
  "rust",
  "java",
  "yaml",
}

lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enabled = true

lvim.plugins = {
  {
    "tpope/vim-fugitive",
  }
}

LunarVim version

2fa176f

Neovim version (>= 0.6.1)

NVIM v0.6.1 Build type: Release LuaJIT 2.1.0-beta3

Operating system/version

Linux 5.13.0-27-generic #29~20.04.1-Ubuntu 2022 x86_64

Relevant log output

checkhealth output:

`
null-ls: require("null-ls.health").check()
========================================================================
  - INFO: no sources registered

nvim: health#nvim#check
========================================================================
## Configuration
  - WARNING: Missing user config file: /root/.config/nvim/init.vim
    - ADVICE:
      - :help |init.vim|

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $VTE_VERSION='6003'
  - INFO: $COLORTERM='truecolor'

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Ruby**: not available
  - WARNING: **RubyGem**: not available
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - OK: **sh**: `Ok`
  - OK: **bash**: `GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)`
  - OK: **tar**: `tar (GNU tar) 1.30`
  - OK: **gzip**: `gzip 1.10`
  - OK: **wget**: `GNU Wget 1.20.3 built on linux-gnu.`
  - OK: **python3**: `Python 3.8.10`
  - OK: **node**: `v16.13.1`
  - WARNING: **Go**: unsupported version `go version go1.13.8 linux/amd64`. Go version must be >= 1.17.
  - OK: **curl**: `curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3`
  - OK: **java**: `Ok`
  - OK: **javac**: `Ok`
  - OK: **npm**: `8.1.2`
  - OK: **pip3**: `pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)`

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found 0.20.4 (714bfd47a744ab44b904375c177a24c0614ef49c) (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v16.13.1 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
  - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - python         ✓ ✓ ✓ ✓ ✓ 
  - lua            ✓ ✓ ✓ ✓ ✓ 
  - json           ✓ ✓ ✓ ✓ . 
  - typescript     ✓ ✓ ✓ ✓ ✓ 
  - css            ✓ . ✓ ✓ ✓ 
  - c              ✓ ✓ ✓ ✓ ✓ 
  - java           ✓ ✓ . ✓ ✓ 
  - javascript     ✓ ✓ ✓ ✓ ✓ 
  - bash           ✓ ✓ ✓ . ✓ 
  - yaml           ✓ ✓ ✓ ✓ ✓ 
  - rust           ✓ ✓ ✓ ✓ ✓ 

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          python not found in search path or not executable.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
  - INFO: Executable: /usr/bin/python3
  - INFO: Other python executable: /bin/python3
  - INFO: Python version: 3.8.10
  - INFO: pynvim version: 0.4.1 (outdated; from /usr/lib/python3/dist-packages/neovim)
  - WARNING: Latest pynvim is NOT installed: 0.4.3

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - WARNING: `ruby` and `gem` must be in $PATH.
    - ADVICE:
      - Install Ruby and verify that `ruby` and `gem` commands work.

## Node.js provider (optional)
  - INFO: Node.js: v16.13.1
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 11.0.2
  - WARNING: fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

## ===== Installed extensions =====

## Telescope Extension: `fzf`
  - INFO: No healthcheck provided

## Telescope Extension: `projects`
  - INFO: No healthcheck provided

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /root/.cache/nvim/lsp.log
  - INFO: Log size: 1065 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 13
  - OK: Loaded parser for bash: ABI version 13
  - OK: Loaded parser for c: ABI version 13
  - OK: Loaded parser for css: ABI version 13
  - OK: Loaded parser for java: ABI version 13
  - OK: Loaded parser for javascript: ABI version 13
  - OK: Loaded parser for json: ABI version 13
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for python: ABI version 13
  - OK: Loaded parser for rust: ABI version 13
  - OK: Loaded parser for typescript: ABI version 13
  - OK: Loaded parser for yaml: ABI version 13

which_key: health#which_key#check
========================================================================
## WhichKey: checking conflicting keymaps

`

log file is empty
tpope commented 2 years ago

If the cc map isn't working, then the first thing to check is whether nmap cc shows that the map is defined.

skolj commented 1 year ago

I have the same problem and the keymapp cc is set as

image
tpope commented 1 year ago

Check :verbose set timeout? timeoutlen? ttimeout? ttimeoutlen?

skolj commented 1 year ago

wow thanks! that worked perfectly.

Zw1d commented 2 months ago

I had the same issue and failed to understand what the timeouts were for. With the timeouts I had I just needed to press cc quite fast for it to work. Otherwise I was getting

E21: Cannot make changes, 'modifiable' is off

My settings were n cc &@:<C-U>Git commit<CR>

Check :verbose set timeout? timeoutlen? ttimeout? ttimeoutlen?

  timeout
  timeoutlen=100
        Last set from Lua (run Nvim with -V1 for more details)
  ttimeout
  ttimeoutlen=50
tpope commented 2 months ago

timeoutlen=100 is still very low. The default is timeoutlen=1000.