1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Compare commits

...

5 Commits

Author SHA1 Message Date
jdhao
369687b047 refactor: disable showing trailing space and mix indent for non-modifiable buffers 2022-08-07 00:25:08 +08:00
jdhao
54908dfe9f fix: dashboard map is not local 2022-08-07 00:24:37 +08:00
jdhao
2e5f5c5991 update demo image in README 2022-08-07 00:12:55 +08:00
jdhao
8291b15599 remove alpha-nvim, use dashboard-nvim 2022-08-07 00:01:23 +08:00
jdhao
3de31f7d0a disable language command in macOS for now
Due to packaging issue, nvim version 0.7.2 for macOS does not have
`:language` command built in, see also neovim/neovim#19127.
2022-08-06 22:36:49 +08:00
6 changed files with 81 additions and 38 deletions

View File

@ -88,16 +88,16 @@ and how to set up on different platforms (Linux, macOS, and Windows).
For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15). For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
## Start screen with alpha-nvim ## Start screen with dashboard-nvim
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/16662357/139459989-0537ded4-c119-4749-99bf-b551ca1ba118.jpg" width="800"> <img src="https://user-images.githubusercontent.com/16662357/183256752-fb23b215-a6b8-4646-beed-9999f52d53f1.png" width="800">
</p> </p>
## fuzzy finding using LeaderF ## File fuzzy finding using LeaderF
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/16662357/139462025-7bce98c5-d2d5-413f-9659-20545865cdca.gif" width="800"> <img src="https://user-images.githubusercontent.com/16662357/183257017-2d9d7605-3c4b-4e1d-8955-30998f9b6f28.gif" width="800">
</p> </p>
## Code autocompletion with nvim-cmp ## Code autocompletion with nvim-cmp

View File

@ -37,7 +37,9 @@ let g:mapleader = ','
let g:vimsyn_embed = 'l' let g:vimsyn_embed = 'l'
" Use English as main language " Use English as main language
language en_US.utf-8 if !g:is_mac
language en_US.utf-8
endif
" use filetype.lua instead of filetype.vim " use filetype.lua instead of filetype.vim
let g:do_filetype_lua = 1 let g:do_filetype_lua = 1

View File

@ -1,32 +0,0 @@
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
-- Set header
dashboard.section.header.val = {
" ",
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
" ",
}
-- Set menu
dashboard.section.buttons.val = {
dashboard.button( "Leader f f", " > Find file", ":Leaderf file --popup<CR>"),
dashboard.button( "Leader f r", " > Recent files" , ":Leaderf mru --popup<CR>"),
dashboard.button( "Leader f g", " > Project grep" , ":Leaderf rg --popup<CR>"),
dashboard.button( "u", " > Update plugins" , ":PackerSync<CR>"),
dashboard.button( "e", " > New file" , ":enew <CR>"),
dashboard.button( "q", " > Quit NVIM", ":qa<CR>"),
}
local fortune = require("alpha.fortune")
dashboard.section.footer.val = fortune()
alpha.setup(dashboard.opts)
-- Send config to alpha
alpha.setup(dashboard.opts)

View File

@ -0,0 +1,65 @@
local dashboard = require("dashboard")
dashboard.custom_header = {
" ",
" ",
" ",
" ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗",
" ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║",
" ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║",
" ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║",
" ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║",
" ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝",
" ",
" ",
" ",
" ",
}
dashboard.custom_center = {
{
icon = "",
desc = "Find File ",
action = "Leaderf file --popup",
shortcut = "<Leader> f f",
},
{
icon = "",
desc = "Recently opened files ",
action = "Leaderf mru --popup",
shortcut = "<Leader> f r",
},
{
icon = "",
desc = "Project grep ",
action = "Leaderf rg --popup",
shortcut = "<Leader> f g",
},
{
icon = "",
desc = "Open Nvim config ",
action = "tabnew $MYVIMRC | tcd %:p:h",
shortcut = "<Leader> e v",
},
{
icon = "",
desc = "New file ",
action = "enew",
shortcut = "e ",
},
{
icon = "",
desc = "Quit Nvim ",
-- desc = "Quit Nvim ",
action = "qa",
shortcut = "q "
}
}
vim.cmd([[
augroup dashboard_enter
au!
autocmd FileType dashboard nnoremap <buffer> q :qa<CR>
autocmd FileType dashboard nnoremap <buffer> e :enew<CR>
augroup END
]])

View File

@ -21,6 +21,10 @@ local function ime_state()
end end
local function trailing_space() local function trailing_space()
if not vim.o.modifiable then
return ""
end
local line_num = nil local line_num = nil
for i=1, fn.line('$') do for i=1, fn.line('$') do
@ -43,6 +47,10 @@ local function trailing_space()
end end
local function mixed_indent() local function mixed_indent()
if not vim.o.modifiable then
return ""
end
local space_pat = [[\v^ +]] local space_pat = [[\v^ +]]
local tab_pat = [[\v^\t+]] local tab_pat = [[\v^\t+]]
local space_indent = fn.search(space_pat, 'nwc') local space_indent = fn.search(space_pat, 'nwc')

View File

@ -139,7 +139,7 @@ packer.startup({
use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] }) use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] })
-- fancy start screen -- fancy start screen
-- use { 'goolord/alpha-nvim', event = 'VimEnter', config = [[require('config.alpha-nvim')]] } use { 'glepnir/dashboard-nvim', config = [[require('config.dashboard-nvim')]] }
use({ use({
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",