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