akiyosi / goneovim

A GUI frontend for neovim.
MIT License
2.38k stars 61 forks source link

version 0.4.6: indent guides does not work properly. #124

Closed antsn closed 2 years ago

antsn commented 4 years ago

First of all, thank you for your hard work! I'm a new user, I stumble upon gonevim while searching for vim/neovim indent guides. At the first glance, I like this program. When I test the indent guides feature, there are few problems:

I use Linux x86_64, pre-built goneovim downloaded from github.

akiyosi commented 4 years ago

Hi :) Thanks for using Goneovim.

I want to parse this issue, so please let me know what your vimrc / init.vim contains. Also, does the problem reappear when launched from the terminal with the following commands?

/path/to/goneovim -u NONE
antsn commented 4 years ago

I run also with -u NONE as you asked.

I attached example and screenshot zip file. example.zip

p00f commented 4 years ago

It doesn't display indent guides in init.vim too. Like

if(exists(foo))
  bar
endif

doesn't have indent guides (tabstop is 2 in init.vim, and I've used 2 spaces here)

It works in java

akiyosi commented 4 years ago

Hi This issue has been fixed in e0da1578.

You can try the latest package to see how the problem is improved. I would appreciate your feedback if you have the time.

https://github.com/akiyosi/goneovim/actions/runs/126931606

antsn commented 4 years ago

Hi, thank you! Here is what I've tested:

The new build fixed:

There are still problems:

I made a screencast for the last two problem: 2020-06-07.zip

akiyosi commented 4 years ago

Hi, I appreciate the detailed report. I have tried to improve on your points.

https://github.com/akiyosi/goneovim/actions/runs/130002541

Let me explain a bit about the internal implementation. The indentation guide in goneovim doesn't look at the actual character of the file. In the neovim UI, all whitespace characters (tabs and spaces) are treated as simple spaces. For this reason, goneovim displays the indent guides according to the size of the tabstop.

If the width of the guide is not the right size for your file type, you can adjust the tabstop, e.g. :set ts=4. If you don't want to do it manually yourself, you can use autocmd or a plugin.

I'd be happy to get feedback from you again.

antsn commented 4 years ago

Thank you very much! It works very neat now. Only one problem is, although it's not a big deal:

I still have problem with "refreshing" (page up/down) to get the indent guides fully displayed. I don't know if it's just me?

I'll report any problem if it would happen!

akiyosi commented 4 years ago

I'm beginning to think we need a personal setting for indent-guide feature. In the current implementation, for example, the indent guides are displayed for all buffers. e.g. terminal buffer.

So I'd like to get feedback on what options are needed. I would appreciate any comments in this issue.

p00f commented 4 years ago

goneovim_indent vim-startify has indent guides now

p00f commented 4 years ago

also init.vim doesn't have indent guides (tabstop=2) Screenshot from 2020-06-15 03-00-04 init.vim


call plug#begin('~/.config/nvim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'dense-analysis/ale'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'zgpio/tree.nvim'
Plug 'mhinz/vim-startify'
Plug 'justinmk/vim-gtfo'
Plug 'jiangmiao/auto-pairs'
Plug 'psliwka/vim-smoothie'
Plug 'vim-airline/vim-airline'
Plug 'ryanoasis/vim-devicons'
Plug 'kassio/neoterm'
Plug 'mhinz/vim-signify'
Plug 'PitcherTear22/nvim-treesitter'
Plug 'akiyosi/gonvim-fuzzy'
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
Plug 'norcalli/nvim-colorizer.lua'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
Plug 'easymotion/vim-easymotion'
Plug 'tomasiser/vim-code-dark'
Plug 'liuchengxu/vim-which-key'
Plug 'reedes/vim-pencil'
call plug#end()

colorscheme dracula
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
nnoremap <silent> K :call <SID>show_documentation()<CR>
set number relativenumber
set guifont=Iosevka\ SS05:h13
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
highlight Comment cterm=italic gui=italic
set tabstop=2
set clipboard+=unnamedplus

"vim-airline config
let g:airline_theme='codedark'
let g:airline_powerline_fonts = 1
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#coc#enabled = 1
let g:airline#extensions#statusline#enabled = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#wordcount#filetypes = '\vasciidoc|help|mail|markdown|markdown.pandoc|org|rst|tex|text'
let g:airline_right_sep = "\uE0B6"

nmap <C-n> :NERDTreeToggle<CR>
if(exists('g:gonvim_running'))
  nmap <C-p> :GonvimFuzzyFiles<CR>
" THIS STUFF IS FOR TESTING INDENT GUIDES
  colorscheme dracula
  set mouse=a
  map <ScrollWheelUp> <C-Y>
  map <ScrollWheelDown> <C-E>
  nnoremap <silent> K :call <SID>show_documentation()<CR>
  set number relativenumber
  set guifont=Iosevka\ SS05:h13
  highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
  highlight Comment cterm=italic gui=italic
else
  nmap <C-p> :LeaderfFile<CR>
endif

"vim-smoothie
noremap <silent> <ScrollWheelDown> :call smoothie#downwards()<CR>
noremap <silent> <ScrollWheelUp>   :call smoothie#upwards()<CR>

"ale
let g:ale_sign_error = '×'
let g:ale_sign_warning = '⚠'
let g:ale_java_eclipselsp_config_path='/home/chinmay/.jdtls'
let g:ale_lint_on_text_changed = 'always'
let g:ale_c_clangformat_options = '-style=Google'

let g:ale_fixers = {
\   '*': ['remove_trailing_lines', 'trim_whitespace'],
\   'bash': ['language_server'],
\   'java': ['google_java_format'],
\}
let g:ale_linters = {
\   'python': ['flake8'],
\}

set termguicolors
set noshowmode
let g:one_allow_italics = 1
"goneovim
if (exists('g:gonvim_running'))
  hi MsgSeparator guifg=#282A36
  let g:coc_config_home = '~/.goneovim'
endif

"coc snippets config
inoremap <silent><expr> <TAB>
  \ pumvisible() ? coc#_select_confirm() :
  \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
  \ <SID>check_back_space() ? "\<TAB>" :
  \ coc#refresh()

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

let g:coc_snippet_next = '<tab>'

"fix syntax highlighting for comments in coc-json
autocmd FileType json syntax match Comment +\/\/.\+$+

let g:neoterm_default_mod='botright'

let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewInPopup = 1

lua require'colorizer'.setup()
let g:airline_section_z = airline#section#create(["\uE0A1" . '%{line(".")}' . "\uE0A3" . '%{col(".")}'])

nmap <M-f> :ALEFix<CR>

"TREE-SITTER SETUP
lua << EOF
require'nvim-treesitter.configs'.setup {
    highlight = {
        enable = true,                 -- false will disable the whole extension
        disable = { 'rust' },     -- list of language that will be disabled
    },
    incremental_selection = {             -- this enables incremental selection
        enable = true,
        disable = { 'cpp', 'lua' },
        keymaps = {                       -- mappings for incremental selection (visual mappings)
          node_incremental = "<leader>e", -- "grn" by default,
          scope_incremental = "<leader>f" -- "grc" by default
        }
    },
    node_movement = {                     -- this enables cursor movement in node hierarchy
        enable = true,
        disable = { 'cpp', 'rust' },
        keymaps = {                       -- mappings for node movement (normal mappings)
          move_up = "<a-k>",              -- default is to move with alt key hold
          move_down = "<a-j>",
          move_left = "<a-h>",
          move_right = "<a-l>",
        }
    },
    ensure_installed = 'java' -- one of 'all', 'language', or a list of languages
}
EOF

nnoremap <silent> <leader>      :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey  ','<CR>
nnoremap <silent> <space>y  :<C-u>CocList -A --normal yank<cr>
p00f commented 4 years ago

But the tree-sitter setup part has guides: Screenshot from 2020-06-15 03-03-26

akiyosi commented 4 years ago

@PitcherTear22 Hi, thanks for the report.

The first point you pointed out, about the indentation guide display for the vim-startify buffer. Yes, I am aware of these issues. For example, terminal buffers will show the guide as well. And this issue is a bit difficult. Because these can only be handled if you understand the content. For this reason, I think there needs to be some settings for displaying indentation guides. For example, specifying an out-of-target buffer.

Second point : This is because the indentation level is 1. Currently, the indent guide is displayed from a level 2 (i.e., two tabs) block.

The third point : This is shown as expected for blocks with an indentation level of 2 or higher.

antsn commented 4 years ago

Sorry for offtopic question! @PitcherTear22: What is your theme/skin, fonts, and how to config Goneovim match the system style here? I use KDE, btw.

Screenshot from 2020-06-15 03-03-26

antsn commented 4 years ago

Thanks!