nvim/vim: re-haul statusline
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# my dots
|
||||
|
||||
dots for my laptop 「itomori」, managed with `gnu stow`.
|
||||
|
||||
Files can be `stow`'ed and un'`stow`'ed with `stow.sh`.
|
||||
It will link all dotfiles to their correct place.
|
||||
Un-`stow` with `./stow.sh -D`.
|
||||
@@ -9,9 +8,10 @@ Un-`stow` with `./stow.sh -D`.
|
||||
## deps
|
||||
+ `fzf` (`zsh`, `nvim`)
|
||||
+ `ripgrep` (`nvim`)
|
||||
+ `ripgrep-all` (`zsh`)
|
||||
+ `fd` (rust find; `nvim`)
|
||||
|
||||
Also run `checkhealth` in `nvim` after a first install
|
||||
|
||||
## 日本語入力
|
||||
With `ibus-anthy` under GNOME use:
|
||||
+ `GTK_IM_MODULE=ibus`
|
||||
|
||||
@@ -5,6 +5,7 @@ local default_opts = { noremap = true, silent = true }
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
map("n", "<C-_>", "<cmd> noh<CR>", default_opts)
|
||||
map("n", "<C-n>", "<cmd> messages<CR>", default_opts)
|
||||
|
||||
-- Telescope
|
||||
local telescope = require 'telescope'
|
||||
@@ -23,11 +24,9 @@ telescope.setup({
|
||||
}
|
||||
}
|
||||
})
|
||||
map("n", "<C-t>", "<cmd> Telescope telescope-tabs list_tabs<CR>", default_opts) -- Show all tabs
|
||||
map("n", "<C-f>", "<cmd> Telescope find_files hidden=true<CR>", default_opts) -- Show files
|
||||
map("n", "<C-s>", "<cmd> Telescope live_grep<CR>", default_opts) -- Grep through current directory
|
||||
map("n", "<C-k>", "<cmd> Telescope keymaps<CR>", default_opts) -- Show all keys
|
||||
map("n", "<C-n>", "<cmd> Noice<CR>", default_opts) -- Show all notifications
|
||||
|
||||
-- Telescope + LSP
|
||||
map("n", "<leader>la", "<cmd> lua vim.lsp.buf.code_action()<CR>", default_opts) -- Apply LSP code action
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
-- Define all plugins in this file,
|
||||
-- but maintain config in <PLUGIN-NAME>-conf.lua
|
||||
|
||||
-- NOTE:
|
||||
-- Run `checkhealth` after first install
|
||||
|
||||
-- Mention all dependencies in 'requires', but create their own entry,
|
||||
-- if they need configuration.
|
||||
|
||||
@@ -55,15 +58,6 @@ return require('packer').startup(function(use)
|
||||
config = function() require('plugins.telescope-conf') end,
|
||||
})
|
||||
|
||||
-- browse tabs in telescope
|
||||
use {
|
||||
'LukasPietzschmann/telescope-tabs',
|
||||
requires = { 'nvim-telescope/telescope.nvim' },
|
||||
config = function()
|
||||
require'telescope-tabs'.setup{}
|
||||
end
|
||||
}
|
||||
|
||||
-- Auto Indentation
|
||||
use({
|
||||
'nmac427/guess-indent.nvim',
|
||||
@@ -148,14 +142,10 @@ return require('packer').startup(function(use)
|
||||
config = function() require('plugins.nvim-colorizer-conf') end
|
||||
})
|
||||
|
||||
-- cooler cmd line and notifications
|
||||
-- fancy lsp loading animation
|
||||
use({
|
||||
"folke/noice.nvim",
|
||||
requires = {
|
||||
"MunifTanjim/nui.nvim", -- frontend for cmdline
|
||||
},
|
||||
event = "VimEnter",
|
||||
config = function() require("plugins.noice-conf") end,
|
||||
'j-hui/fidget.nvim',
|
||||
config = function() require"fidget".setup{} end,
|
||||
})
|
||||
|
||||
-- latex synctex
|
||||
|
||||
@@ -46,34 +46,34 @@ require('lualine').setup({
|
||||
-- lualine comes with 'everforest' theme
|
||||
theme = 'everforest',
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {
|
||||
-- tabline = {
|
||||
-- lualine_a = {
|
||||
-- -- function()
|
||||
-- -- return mode_map[vim.api.nvim_get_mode().mode] or "__"
|
||||
-- -- end
|
||||
-- function()
|
||||
-- return mode_map[vim.api.nvim_get_mode().mode] or "__"
|
||||
-- end
|
||||
function()
|
||||
return '裡'
|
||||
end,
|
||||
},
|
||||
lualine_b = {
|
||||
{
|
||||
'tabs',
|
||||
mode = 2,
|
||||
max_length = vim.o.columns / 2
|
||||
}
|
||||
},
|
||||
lualine_c = {
|
||||
|
||||
},
|
||||
lualine_x = {
|
||||
-- 'lsp_progress' -- noice already shows this.. better
|
||||
},
|
||||
lualine_y = {
|
||||
require('nvim-navic').get_location
|
||||
},
|
||||
lualine_z = {
|
||||
}
|
||||
},
|
||||
-- return '裡'
|
||||
-- end,
|
||||
-- },
|
||||
-- lualine_b = {
|
||||
-- {
|
||||
-- 'tabs',
|
||||
-- mode = 2,
|
||||
-- max_length = vim.o.columns / 2
|
||||
-- }
|
||||
-- },
|
||||
-- lualine_c = {
|
||||
--
|
||||
-- },
|
||||
-- lualine_x = {
|
||||
-- -- 'lsp_progress' -- noice already shows this.. better
|
||||
-- },
|
||||
-- lualine_y = {
|
||||
-- require('nvim-navic').get_location
|
||||
-- },
|
||||
-- lualine_z = {
|
||||
-- }
|
||||
-- },
|
||||
-- all sections from left to right
|
||||
sections = {
|
||||
lualine_a = {
|
||||
@@ -101,13 +101,15 @@ require('lualine').setup({
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
'filetype',
|
||||
'encoding',
|
||||
'fileformat',
|
||||
'filetype',
|
||||
},
|
||||
lualine_z = {
|
||||
-- show wordcount in md and tex file
|
||||
-- show precise count when selecting
|
||||
function()
|
||||
if vim.bo.filetype == "md" or vim.bo.filetype == "tex" then
|
||||
if vim.bo.filetype == "markdown" or vim.bo.filetype == "tex" then
|
||||
if vim.fn.wordcount().visual_words == 1 then
|
||||
return tostring(vim.fn.wordcount().visual_words) .. " word"
|
||||
elseif not (vim.fn.wordcount().visual_words == nil) then
|
||||
@@ -118,16 +120,13 @@ require('lualine').setup({
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
},
|
||||
lualine_z = {
|
||||
'progress',
|
||||
end,
|
||||
'location',
|
||||
-- Show trailing whitespace
|
||||
function()
|
||||
local space = vim.fn.search([[\s\+$]], 'nwc')
|
||||
return space ~= 0 and "TW:" .. space or ""
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1 +1,19 @@
|
||||
require("noice").setup({})
|
||||
require("noice").setup({
|
||||
lsp = {
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
progress = {
|
||||
view = "mini",
|
||||
}
|
||||
},
|
||||
messages = {
|
||||
enabled = true, -- enables the Noice messages UI
|
||||
view = "mini", -- default view for messages
|
||||
view_error = "mini", -- view for errors
|
||||
view_warn = "mini", -- view for warnings
|
||||
},
|
||||
})
|
||||
|
||||
@@ -10,6 +10,9 @@ require('nvim-treesitter.configs').setup({
|
||||
"python",
|
||||
"rust",
|
||||
"yaml",
|
||||
"vim",
|
||||
"markdown",
|
||||
"markdown_inline"
|
||||
},
|
||||
auto_intall = true,
|
||||
highlight = {
|
||||
|
||||
@@ -7,7 +7,7 @@ require('telescope').setup({
|
||||
layout_strategy = "vertical",
|
||||
layout_config = {
|
||||
vertical = {
|
||||
width = 120,
|
||||
width = 160,
|
||||
prompt_position = "top",
|
||||
mirror = true,
|
||||
}
|
||||
|
||||
@@ -92,5 +92,5 @@ setw -g window-status-style "none,fg=#939f91,bg=#FDF6E3"
|
||||
set -g status-left ""
|
||||
# show battery only on laptop
|
||||
if-shell "[ `hostname` = 'itomori' ]" 'set -g status-right "#[fg=#939f91,bg=#FDF6E3] #H @ #S | #(cat /sys/class/power_supply/BAT1/capacity)% | %H:%M"' 'set -g status-right "#[fg=#939f91,bg=#FFF9E8] #H @ #S | %H:%M"'
|
||||
setw -g window-status-format "#[bg=#FDF6E3][#I #W]"
|
||||
setw -g window-status-current-format "#[fg=#93b259,bold][#I #W]"
|
||||
setw -g window-status-format "#I:#W"
|
||||
setw -g window-status-current-format "#[fg=#93b259,bold]#I:#W*"
|
||||
|
||||
@@ -28,7 +28,6 @@ syntax on
|
||||
set background=light
|
||||
let g:everforest_background = 'medium'
|
||||
let g:everforest_better_performance = 1
|
||||
" let g:everforest_enable_italic = 1
|
||||
colorscheme everforest
|
||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
@@ -59,21 +58,7 @@ set scrolloff=5 " minimum lines above or below the cursor
|
||||
let g:ctrlp_show_hidden = 1 " show hidden files in ctrlp menus
|
||||
|
||||
" ============================== Statusline
|
||||
set laststatus=1 " 1: only if there are at least two windows
|
||||
set showtabline=1 " 1: only if there are at least two tab pages
|
||||
let g:airline_powerline_fonts = 1
|
||||
|
||||
" tabline
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#formatter = 'default'
|
||||
let g:airline#extensions#tabline#show_tabs = 1
|
||||
let g:airline#extensions#tabline#show_tab_nr = 1
|
||||
let g:airline#extensions#tabline#tab_nr_type = 1
|
||||
let g:airline#extensions#tabline#show_buffers = 0
|
||||
let g:airline#extensions#tabline#tabs_label = '裡'
|
||||
let g:airline#extensions#tabline#show_close_button = 0
|
||||
let g:airline#extensions#tabline#show_tab_count = 0
|
||||
|
||||
let g:airline_mode_map = {
|
||||
\ 'i' : '',
|
||||
\ 'ic' : '',
|
||||
@@ -85,11 +70,15 @@ let g:airline_mode_map = {
|
||||
\ 'R' : 'ﰇ',
|
||||
\ 'Rv' : 'ﰇ',
|
||||
\ 'v' : '',
|
||||
\ 'V' : ' ',
|
||||
\ '␖' : ' 麗',
|
||||
\ 'V' : ' ',
|
||||
\ '' : ' ',
|
||||
\ 'c' : ''
|
||||
\ }
|
||||
|
||||
let g:airline_section_x = airline#section#create([])
|
||||
let g:airline_section_y = airline#section#create_right(['%{&fileencoding}', '%{&fileformat}', '%{&filetype}'])
|
||||
let g:airline_section_z = airline#section#create(['%{line(".")}:%{col(".")}'])
|
||||
|
||||
" ============================== Indents and Whitespaces
|
||||
set list
|
||||
set listchars=tab:──\ ,extends:›,precedes:‹,nbsp:·,trail:· " show chars for whitespaces
|
||||
@@ -117,7 +106,6 @@ let g:netrw_liststyle = 3 " Tree-like structure
|
||||
let g:netrw_banner = 0 " Remove useless banner at the top of netrw
|
||||
|
||||
" ============================== Macros and Mappings
|
||||
" open fuzzy file browser
|
||||
map <C-f> :CtrlP .<CR>
|
||||
" C-/ to hide search results
|
||||
map <C-_> :noh<CR>
|
||||
|
||||
Reference in New Issue
Block a user