windwp / windline.nvim

Animation statusline, floating window statusline. Use lua + luv make some wind
MIT License
462 stars 17 forks source link

show a preconfigured theme on inactive buffers #1

Closed delfick closed 3 years ago

delfick commented 3 years ago

Hello,

I'm using require('wlsample.bubble') and I'm wondering if there is a way for it to show as if it was active when I'm focused elsewhere like on nvim-tree?

windwp commented 3 years ago

sorry i still don't understand what do you want .I think that buble theme is already have that feature on nvimtree.

delfick commented 3 years ago

So when I'm on the file it looks like this

Screen Shot 2021-07-20 at 11 39 23 am

But when I'm in the nvim-tree it looks like this

Screen Shot 2021-07-20 at 11 39 32 am
windwp commented 3 years ago

hi i fix that you can update plugin an check

delfick commented 3 years ago

yeap, that fixed it. Thanks!!

b3nj5m1n commented 3 years ago

@delfick I'm still having this issue, both with require('wlsample.bubble') and require('wlsample.evil_line'). Is there anything else that I have to do that I might be missing?

delfick commented 3 years ago

seems I have this in my vimrc

table.remove(windline.statusline_ft, 1)
windline.add_status({
    filetypes = { 'NvimTree' },
    active = {
        { require('windline.helpers').separators.slant_right, { 'black', 'black_light' } },
    },
    show_in_active = true,
    show_last_status = true
})

This is the whole thing (still super messy but a lot better than it used to be lol)

~/.config/nvim/init.vim ``` call plug#begin('~/.config/vim/plugged') Plug 'nvim-lua/completion-nvim' Plug 'tpope/vim-rsi' Plug 'fatih/vim-go' Plug 'tpope/vim-fugitive' Plug 'sbdchd/neoformat' Plug 'neomake/neomake' Plug 'ygm2/rooter.nvim' Plug 'norcalli/nvim-colorizer.lua' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'neovim/nvim-lspconfig' Plug 'hrsh7th/nvim-compe' Plug 'edkolev/tmuxline.vim' Plug 'kabouzeid/nvim-lspinstall' Plug 'RishabhRD/popfix' Plug 'folke/lsp-colors.nvim' Plug 'folke/trouble.nvim' Plug 'gfanto/fzf-lsp.nvim' Plug 'delfick/flattened' Plug 'kyazdani42/nvim-web-devicons' Plug 'windwp/windline.nvim' Plug 'kyazdani42/nvim-tree.lua' Plug 'lewis6991/gitsigns.nvim' Plug 'b3nj5m1n/kommentary' Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'nvim-lua/popup.nvim' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-telescope/telescope.nvim' Plug 'dstein64/nvim-scrollview', { 'branch': 'main' } call plug#end() let mapleader="," set termguicolors colorscheme flattened_dark set guifont="Droid Sans Mono Nerd Font Complete Mono.otf:h16" :lua << EOF local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local opts = { noremap=true, silent=true } buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) end local function setup_servers() require'lspinstall'.setup() local servers = require'lspinstall'.installed_servers() for _, server in pairs(servers) do require'lspconfig'[server].setup{on_attach=on_attach} end end require'lspconfig'.pylsp.setup{ on_attach = on_attach, settings = { pylsp = { plugins = { noy_pyls = {enabled = true}, pydocstyle = {enabled = false}, pycodestyle = {enabled = false}, pyflakes = {enabled = false}, mccabe = {enabled = false}, pylint = {enabled = false}, yapf = {enabled = false}, pyls_isort = {enabled = true}, pylsp_mypy = {enabled = true} } } }, flags = { debounce_text_changes = 200, } } --require'lspconfig'.java_language_server.setup{ -- cmd = { "/Users/stephenm/Projects/Opensource/java-language-server/dist/lang_server_mac.sh" }, -- on_attach=on_attach --} setup_servers() -- Automatically reload after `:LspInstall ` so we don't have to restart neovim require'lspinstall'.post_install_hook = function () setup_servers() -- reload installed servers vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server end require("trouble").setup { } require('fzf_lsp').setup() require('wlsample.bubble') require('gitsigns').setup() require'colorizer'.setup() -- Make nvim-tree not show a statusline local windline = require("windline") table.remove(windline.statusline_ft, 1) windline.add_status({ filetypes = { 'NvimTree' }, active = { { require('windline.helpers').separators.slant_right, { 'black', 'black_light' } }, }, show_in_active = true, show_last_status = true }) vim.o.updatetime = 100 vim.api.nvim_set_keymap("n", "cc", "kommentary_line_default", {}) vim.api.nvim_set_keymap("n", "c", "kommentary_motion_default", {}) vim.api.nvim_set_keymap("x", "c", "kommentary_visual_default", {}) local protocol = require'vim.lsp.protocol' EOF lua << EOF -- Compe setup require'compe'.setup { enabled = true; autocomplete = true; debug = false; min_length = 1; preselect = 'enable'; throttle_time = 80; source_timeout = 200; incomplete_delay = 400; max_abbr_width = 100; max_kind_width = 100; max_menu_width = 100; documentation = true; source = { path = true; buffer = true; calc = true; nvim_lsp = true; nvim_lua = true; }; } local actions = require('telescope.actions') require('telescope').setup{ defaults = { file_ignore_patterns = { "__pycache__", "node_modules" }, mappings = { i = { [""] = actions.close, [""] = actions.move_selection_next, [""] = actions.move_selection_previous }, }, }, pickers = { buffers = { sort_lastused = true } } } local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end local check_back_space = function() local col = vim.fn.col('.') - 1 if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then return true else return false end end -- Use (s-)tab to: --- move to prev/next item in completion menuone --- jump to prev/next snippet's placeholder _G.tab_complete = function() if vim.fn.pumvisible() == 1 then return t "" elseif check_back_space() then return t "" else return vim.fn['compe#complete']() end end _G.s_tab_complete = function() if vim.fn.pumvisible() == 1 then return t "" else return t "" end end vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", {expr = true}) vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", {expr = true}) vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", {expr = true}) vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", {expr = true}) EOF set fillchars+=vert:│ set spell set hidden set history=1000 set virtualedit=block set nostartofline set nowrap set backspace=indent,eol,start " Backspace for dummies set linespace=0 " No extra spaces between rows set nu " Line numbers on set showmatch " Show matching brackets/parenthesis set incsearch " Find as you type search set hlsearch " Highlight search terms set winminheight=0 " Windows can be 0 line high set ignorecase " Case insensitive search set smartcase " Case sensitive when uc present set wildmenu " Show list instead of just completing set wildmode=list:longest,full " Command completion, list matches, then longest common part, then all. set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too set scrolljump=5 " Lines to scroll when cursor leaves screen set scrolloff=3 " Minimum lines to keep above and below cursor set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace set autoindent " Indent at the same level of the previous line set nosmartindent " Smart indent breaks Python indenting set shiftround " rounds indent to a multiple of shiftwidth set shiftwidth=4 " Use indents of 4 spaces set expandtab " Tabs are spaces, not tabs set tabstop=4 " An indentation every four columns set softtabstop=4 " Let backspace delete indent set matchpairs+=<:> " show matching <> (html mainly) as well set pastetoggle= " pastetoggle (sane indentation on pastes) syntax on filetype on filetype plugin indent on if has('clipboard') if has('X11') set clipboard=unnamedplus else set clipboard=unnamed endif endif " Ignore these files when completing set wildignore+=*.so,*.swp,*.o,*.obj,.git,*.pyc,.svn,.hg set wildignore+=eggs/** set wildignore+=*.egg-info/** autocmd BufRead,BufNewFile * setlocal signcolumn=yes autocmd FileType tagbar,NvimTree setlocal signcolumn=no set backup " Backups are nice ... set swapfile set dir=~/.config/vimswap if has('persistent_undo') set undofile " So is persistent undo ... set undolevels=1000 " Maximum number of changes that can be undone set undoreload=10000 " Maximum number lines to save for undo on a buffer reload endif " Instead of reverting the cursor to the last position in the buffer, we " set it to the first line when editing a git commit message au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0]) autocmd BufEnter * lua require'completion'.on_attach() " Use and to navigate through popup menu inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" " Set completeopt to have a better completion experience set completeopt=menuone,noinsert,noselect " Avoid showing message extra message when using completion set shortmess+=c let g:nvim_tree_auto_close = 1 let g:nvim_tree_auto_open = 1 let g:nvim_tree_git_hl = 1 let g:nvim_tree_follow = 1 let g:nvim_tree_highlight_opened_files = 1 let g:nvim_tree_gitignore = 0 let g:nvim_tree_disable_netrw = 0 let g:nvim_tree_ignore = [ ".pytest_cache", "__pycache__", ".runner", "runner.egg-info" ] let g:scrollview_excluded_filetypes = ['NvimTree'] let g:go_gopls_enabled = 0 let g:scrollview_character = '▎' highlight link ScrollView Normal nnoremap :NvimTreeToggle nnoremap r :NvimTreeRefresh nnoremap n :NvimTreeFindFile function! ChangePaste(type, ...) silent exe "normal! `[v`]\"_c" silent exe "normal! p" endfunction imap jj imap jk :w map i nmap cp :set opfunc=ChangePasteg@ map p :set paste! map h :nohlsearch inoremap # # nnoremap af lua require('telescope.builtin').find_files() nnoremap fa lua require('telescope.builtin').find_files() nnoremap aa lua require('telescope.builtin').find_files() nnoremap fb lua require('telescope.builtin').buffers() nnoremap afb lua require('telescope.builtin').buffers() nnoremap fs lua require('telescope.builtin').spell_suggest() nnoremap afs lua require('telescope.builtin').spell_suggest() nnoremap fh lua require('telescope.builtin').current_buffer_fuzzy_find() nnoremap afh lua require('telescope.builtin').current_buffer_fuzzy_find() nnoremap fg lua require('telescope.builtin').live_grep() nnoremap aft lua require('telescope.builtin').treesitter() nnoremap afa lua require('telescope.builtin').lsp_workspace_symbols() nnoremap gd lua require('telescope.builtin').lsp_definitions() nnoremap afd lua require('telescope.builtin').lsp_document_diagnostics() nnoremap afr lua require('telescope.builtin').lsp_references() nnoremap lua require('telescope.builtin').buffers() nnoremap d :lua vim.lsp.diagnostic.show_line_diagnostics() " Yank from the cursor to the end of the line, to be consistent with C and D. nnoremap Y y$ vnoremap < >gv map j_ map k_ map l_ map h_ imap augroup fmt autocmd! autocmd BufWritePre *.js Neoformat autocmd BufWritePre *.c Neoformat autocmd BufWritePre *.sh Neoformat autocmd BufWritePre *.py Neoformat autocmd BufWritePre *.ts Neoformat autocmd BufWritePre *.html Neoformat autocmd BufWritePre *.css Neoformat autocmd BufWritePre *.scss Neoformat autocmd BufWritePre *.proto Neoformat autocmd BufWritePre */photons/scripts/* Neoformat autocmd BufWritePre *.json Neoformat autocmd BufWritePre * Neomake augroup END augroup fmt autocmd! autocmd BufWritePre *.js Neoformat autocmd BufWritePre *.c Neoformat autocmd BufWritePre *.sh Neoformat autocmd BufWritePre *.py Neoformat autocmd BufWritePre *.ts Neoformat autocmd BufWritePre *.html Neoformat autocmd BufWritePre *.css Neoformat autocmd BufWritePre *.scss Neoformat autocmd BufWritePre *.proto Neoformat autocmd BufWritePre */photons/scripts/* Neoformat autocmd BufWritePre *.json Neoformat autocmd BufWritePre * Neomake augroup END autocmd BufEnter NvimTree set cursorline if executable('prettier') let g:neoformat_enabled_javascript = ['prettier'] let g:neoformat_enabled_html = ['prettier'] let g:neoformat_enabled_css = ['prettier'] endif let g:neoformat_enabled_ruby = ['rubocop'] let g:neoformat_enabled_go = [] let g:neoformat_enabled_sh = ['shfmt'] let g:neoformat_enabled_python = ['black'] function SetBlackOptions() let g:neoformat_enabled_python = ['black'] endfunction function SetNoyBlackOptions() let g:neoformat_enabled_python = ['noy_black'] endfunction function SetNoBlackOptions() let g:neoformat_enabled_python = [] endfunction autocmd BufEnter * call SetBlackOptions() autocmd BufEnter *test*.py call SetNoyBlackOptions() autocmd BufEnter */site-packages/*.py call SetNoBlackOptions() autocmd BufEnter */APIgen/*.py call SetNoBlackOptions() autocmd BufEnter */Python.framework/* call SetNoBlackOptions() autocmd BufEnter */Projects/opensource/*.py call SetNoBlackOptions() autocmd BufEnter */photons/scripts/* call SetBlackOptions() let g:neoformat_enabled_yaml = [] let g:neomake_java_enabled_makers = [] if executable('noy_pylama') let g:neomake_python_enabled_makers = ['noy_pylama'] else let g:neomake_python_enabled_makers = ['pylama'] endif let g:neomake_go_enabled_makers = [] let g:neomake_tempfile_dir = '/tmp/neomake' let g:neoformat_python_noy_black = { \ 'exe': 'noy_black', \ 'stdin': 1, \ 'args': ['-q', '-'], \ } let g:neomake_noy_pylama_maker = { \ 'exec': 'noy_pylama', \ 'args': ['--format', 'parsable'], \ 'errorformat': '%f:%l:%c: [%t] %m', \ 'postprocess': function('neomake#makers#ft#python#PylamaEntryProcess'), \ 'output_stream': 'stdout', \ } let ini_file = neomake#utils#FindGlobFile('{pylama.ini,setup.cfg,tox.ini,pytest.ini}') if !empty(ini_file) let g:neomake_noy_pylama_maker.cwd = fnamemodify(ini_file, ':h') endif hi! NeomakeVirtualtextError guifg=#ff6060 autocmd BufReadPost * \ if line("'\"") >= 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif let parent = $HOME let prefix = '.config/vim' let dir_list = { \ 'backup': 'backupdir', \ 'views': 'viewdir', \ 'swap': 'directory' } if has('persistent_undo') let dir_list['undo'] = 'undodir' endif let common_dir = $HOME . '/' . prefix for [dirname, settingname] in items(dir_list) let directory = common_dir . dirname . '/' if exists("*mkdir") if !isdirectory(directory) call mkdir(directory) endif endif if !isdirectory(directory) echo "Warning: Unable to create backup directory: " . directory echo "Try: mkdir -p " . directory else let directory = substitute(directory, " ", "\\\\ ", "g") exec "set " . settingname . "=" . directory endif endfor ```
windwp commented 3 years ago

@b3nj5m1n I just test and it still works. That feature needs you to focus on nvimtree and it still displays the statusline on the last window.

@delfick :( yeah, It is simpler than copy the whole file to modify 1 thing.
I use fern.vim and display the folder name on bottom is useful.