Last active
December 31, 2023 02:37
-
-
Save pwang2/9b957739caba2ec7e8fa34f4fd9659b4 to your computer and use it in GitHub Desktop.
nvim config files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim: foldmethod=marker:foldmarker={{{,}}}:foldlevelstart=0:foldclose=all: | |
set title | |
set wrap | |
set splitright | |
set expandtab | |
set splitbelow | |
set number | |
set relativenumber | |
set termguicolors | |
set nofoldenable | |
set shell =zsh | |
set mouse =a | |
set ts =2 | |
set sw =2 | |
set laststatus =3 | |
set timeoutlen =300 | |
set synmaxcol =200 | |
set ttimeoutlen =0 | |
set background =light | |
set updatetime =500 | |
set wildignore +=node_modules/**,.git/**,dist/** | |
"{{{ nvim only | |
" if has("clipboard") | |
" set clipboard +=unnamedplus | |
" endif | |
if has('nvim') | |
function! CFoldText() | |
let line = getline(v:foldstart) | |
let sub = substitute(line, '.*\<\(\w\+\)(.*).*', '\1(...)', 'g') | |
return '' . sub . ' ' . (v:foldend - v:foldstart + 1) | |
endfunction | |
set signcolumn =auto:2 | |
set foldcolumn =0 | |
set foldmethod =expr | |
set foldexpr =nvim_treesitter#foldexpr() | |
set foldtext =CFoldText() | |
set foldnestmax =3 | |
set foldminlines=1 | |
set fillchars +=eob:\ "remove tilde | |
set fillchars +=fold:\ "remove | |
set fillchars +=foldclose:\ | |
set fillchars +=foldopen:\ | |
endif | |
"}}} | |
"{{{ variables | |
if exists("$TMUX") | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[5 q\<Esc>\\" | |
let &t_SR = "\<Esc>Ptmux;\<Esc>\e[4 q\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[1 q\<Esc>\\" | |
else | |
let &t_SI = "\e[5 q" | |
let &t_SR = "\e[4 q" | |
let &t_EI = "\e[1 q" | |
endif | |
let g:loaded_ruby_provider = 0 | |
let g:loaded_perl_provider = 0 | |
let g:loaded_node_provider = 0 | |
let mapleader = ' ' | |
let maplocalleader = ';' | |
let g:mapleader = ' ' | |
let g:maplocalleader = ';' | |
let g:ale_sign_error = '>>' | |
let g:ale_sign_warning = '--' | |
let g:ale_linters = { | |
\ 'json': ['prettier', 'jq'], | |
\ 'javascript': ['eslint'], | |
\ 'typescript': ['eslint'], | |
\ 'vue': ['eslint'], | |
\ 'tex': ['texlab'], | |
\} | |
let g:ale_linters = { | |
\ 'vue': ['eslint', 'prettier'] | |
\} | |
let g:ale_linters_explicit = 1 | |
let g:ale_echo_msg_format = '[%linter%]: %s' | |
let g:ale_cursor_detail = 0 | |
let g:ale_floating_preview = 0 | |
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰'] | |
let g:ale_javascript_eslint_executable = "eslint_d" | |
let g:ale_javascript_eslint_use_global = 1 | |
let g:ale_r_lintr_options =<< trim END | |
with_defaults( | |
object_usage_linter=NULL, | |
commented_code_linter=NULL, | |
camel_case_linter=NULL, | |
object_name_linter=NULL, | |
line_length_linter(200)) | |
END | |
let g:ale_completion_enabled = 0 | |
if $THIS_MACHINE_SUCKS == 1 | |
let g:ale_floating_preview = 0 | |
" enable this will cause performance issue on slow machine | |
let g:ale_lint_on_insert_leave = 0 | |
let g:ale_lint_on_enter = 0 | |
endif | |
let g:neoformat_enabled_vue = ['eslint_d'] | |
let g:neoformat_html_prettier = {'exe': 'prettier', 'args': ['--parser', 'html', '--print-width', '160'], 'stdin': 1} | |
let g:neoformat_vue_eslint_d = {'exe': 'eslint_d', 'args': ['--stdin', '--fix-to-stdout', '--stdin-filename', '%:p'], 'stdin': 1} | |
let g:goyo_width = 180 | |
let g:goyo_height = 120 | |
let g:limelight_conceal_guifg = '#777777' | |
let g:UltiSnipsJumpForwardTrigger = '<Plug>(ultisnips_jump_forward)' | |
let g:UltiSnipsJumpBackwardTrigger = '<Plug>(ultisnips_jump_backward)' | |
let g:UltiSnipsListSnippets = '<c-x><c-s>' | |
" let g:UltiSnipsExpandTrigger = '<Plug>(ultisnips_expand)' | |
let g:UltiSnipsExpandTrigger = '<tab>' | |
let g:UltiSnipsRemoveSelectModeMappings = 0 | |
let R_assign_map = '<M-->' | |
let g:vimspector_enable_mappings = 'VISUAL_STUDIO' | |
let g:tex_flavor = 'latex' | |
let g:vimtex_view_method ='zathura' | |
let g:vimtex_view_method = 'general' | |
let g:vimtex_quickfix_mode = 0 | |
let g:tex_conceal = 'abdmg' | |
let g:magma_image_provider = "kitty" | |
let g:mkdp_browserfunc = 'OpenMarkdownPreview' | |
" }}} | |
"{{{ functions | |
function! UpdateRemotePlugins(...) | |
let &rtp=&rtp | |
UpdateRemotePlugins | |
endfunction | |
function! s:wilder_init() abort | |
let l:accent = wilder#make_hl('WilderAccent', 'Pmenu', [{}, {'foreground': 198, 'background': 'NONE', 'bold': 0}, {'foreground': '#ff4303'}]) | |
call wilder#setup({'modes': [':', '/', '?']}) | |
call wilder#set_option('renderer', wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ | |
\ 'pumblend': 0, | |
\ 'border': 'rounded', | |
\ 'highlighter': wilder#basic_highlighter(), | |
\ 'left': [' ', wilder#popupmenu_devicons()], | |
\ 'highlights': { 'accent': l:accent } | |
\ }))) | |
endfunction | |
function! s:goyo_enter() | |
silent Gitsigns detach | |
lua require('lualine').hide() | |
if executable('tmux') && strlen($TMUX) | |
silent !tmux set status off | |
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z | |
endif | |
endfunction | |
function! s:goyo_leave() | |
silent Gitsigns attach | |
if executable('tmux') && strlen($TMUX) | |
silent !tmux set status on | |
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z | |
endif | |
endfunction | |
function! Sync_gist() | |
let l:lastline = getline('$') | |
if l:lastline =~ "GistID" | |
let l:gid = matchlist(l:lastline, '.\+GistID:\s*\(\S\+\)')[1] | |
" check if last line contains a File path | |
if l:lastline =~ "File:" | |
let l:fpath = matchlist(l:lastline, '.\+File:\s*\(\S\+\)')[1] | |
else | |
let l:fpath = expand('%:t') | |
endif | |
let l:cmd = '%!gist -r '. l:gid . ' -f '. l:fpath | |
silent execute(l:cmd) | |
if trim(getline('$')) == trim(l:lastline) | |
echom("new version downloaded from gist") | |
silent write | |
else | |
echom(expand('%:t')) | |
echom(getline('$')) | |
echom(trim(l:lastline)) | |
echoe("Remote version not expected, reload disk version") | |
execute(':e!') | |
endif | |
endif | |
endfunction | |
function! Post_gist() | |
let l:lastline = getline('$') | |
if getbufinfo('%')[0].changed && l:lastline =~ "GistID" | |
let l:gid = matchlist(l:lastline, '.\+GistID:\s*\(\S\+\)')[1] | |
" check if last line contains a File path | |
if l:lastline =~ "File:" | |
let l:fpath = matchlist(l:lastline, '.\+File:\s*\(\S\+\)')[1] | |
else | |
let l:fpath = expand('%:t') | |
endif | |
let l:result = execute(":w !gist -u ". l:gid . ' -f '. l:fpath) | |
if trim(l:result) == trim("https://gist.github.com/pwang2/". l:gid) | |
echom("🙂 update successfully.") | |
else | |
echoe("🤔 update failed.") | |
endif | |
endif | |
endfunction | |
function! s:hi_patch() | |
hi link FoldColumn Comment | |
hi Folded guibg=NONE guifg=#569cd6 | |
hi Pmenu guibg=NONE | |
hi Normal guibg=NONE | |
hi CmpItemAbbrDeprecated guibg=NONE guifg=#808080 gui=strikethrough | |
hi CmpItemAbbrMatch guibg=NONE guifg=#569CD6 | |
hi CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6 | |
hi CmpItemKindVariable guibg=NONE guifg=#9CDCFE | |
hi CmpItemKindInterface guibg=NONE guifg=#9CDCFE | |
hi CmpItemKindText guibg=NONE guifg=#9CDCFE | |
hi CmpItemKindFunction guibg=NONE guifg=#C586C0 | |
hi CmpItemKindMethod guibg=NONE guifg=#C586C0 | |
hi CmpItemKindKeyword guibg=NONE guifg=#D4D4D4 | |
hi CmpItemKindProperty guibg=NONE guifg=#D4D4D4 | |
hi CmpItemKindUnit guibg=NONE guifg=#D4D4D4 | |
hi FloatBorder guifg=#569cd6 | |
endfunction | |
function! SynStack() | |
if !exists("*synstack") | |
return | |
endif | |
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') | |
echo map(synstack(line('.'), col('.')), 'synIDattr(synIDtrans(v:val), "name")') | |
endfunc | |
function! OpenMarkdownPreview(url) | |
execute "silent !google-chrome " . a:url | |
endfunc | |
function! s:no_highlight() | |
if getfsize(@%) > 100000 | |
syntax off | |
setlocal ft= | |
setlocal syn= | |
endif | |
endfunc | |
"}}} | |
"{{{ plugins | |
call plug#begin() | |
Plug 'christoomey/vim-tmux-navigator' | |
Plug 'edkolev/tmuxline.vim' | |
Plug 'godlygeek/tabular' | |
Plug 'junegunn/goyo.vim' | |
Plug 'junegunn/limelight.vim' | |
Plug 'mattn/emmet-vim' | |
Plug 'sbdchd/neoformat' | |
Plug 'simeji/winresizer' | |
Plug 'terryma/vim-multiple-cursors' | |
Plug 'tkhren/vim-fake' | |
Plug 'tpope/vim-fugitive' | |
Plug 'tpope/vim-obsession' | |
Plug 'tpope/vim-repeat' | |
" Plug 'tpope/vim-sensible' | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-rsi' | |
Plug 'voldikss/vim-floaterm' | |
Plug 'gelguy/wilder.nvim', { 'do': function('UpdateRemotePlugins') } | |
Plug 'SirVer/ultisnips' | |
Plug 'honza/vim-snippets' | |
Plug 'w0rp/ale' | |
Plug 'numToStr/Comment.nvim' | |
Plug 'joshdick/onedark.vim' | |
Plug 'sonph/onehalf', { 'rtp': 'vim' } | |
Plug 'dracula/vim', { 'as': 'dracula' } | |
Plug 'puremourning/vimspector', { 'for': [ 'cs', 'javascript'] } | |
Plug 'powerman/vim-plugin-AnsiEsc', { 'for': 'cs' } | |
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npm install' } | |
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } | |
Plug 'ntpeters/vim-better-whitespace' | |
Plug 'neoclide/jsonc.vim' | |
if has('nvim') | |
Plug 'ibhagwan/smartyank.nvim' | |
Plug 'github/copilot.vim' | |
Plug 'jalvesaq/Nvim-R' | |
Plug 'nvim-lua/popup.nvim' | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'neovim/nvim-lspconfig' | |
Plug 'mfussenegger/nvim-dap' | |
Plug 'williamboman/mason.nvim' | |
Plug 'williamboman/mason-lspconfig.nvim' | |
Plug 'kyazdani42/nvim-web-devicons' | |
Plug 'folke/lsp-colors.nvim' | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
Plug 'nvim-telescope/telescope.nvim' | |
Plug 'lewis6991/gitsigns.nvim' | |
Plug 'kyazdani42/nvim-tree.lua' | |
Plug 'folke/trouble.nvim' | |
Plug 'ggandor/lightspeed.nvim' | |
Plug 'stevearc/dressing.nvim' | |
Plug 'hrsh7th/cmp-nvim-lsp' | |
Plug 'hrsh7th/cmp-buffer' | |
Plug 'hrsh7th/cmp-path' | |
Plug 'hrsh7th/cmp-cmdline' | |
Plug 'hrsh7th/cmp-emoji' | |
Plug 'hrsh7th/nvim-cmp' | |
Plug 'hrsh7th/cmp-nvim-lsp-signature-help' | |
Plug 'quangnguyen30192/cmp-nvim-ultisnips' | |
Plug 'onsails/lspkind-nvim' | |
Plug 'nvim-lualine/lualine.nvim' | |
Plug 'akinsho/bufferline.nvim', {'branch': 'main'} | |
" experimental | |
Plug 'dstein64/vim-startuptime' | |
Plug 'goolord/alpha-nvim' | |
Plug 'echasnovski/mini.nvim' | |
Plug 'norcalli/nvim-colorizer.lua' | |
Plug 'windwp/nvim-ts-autotag' | |
" Plug 'nvim-treesitter/nvim-treesitter-refactor' | |
Plug 'vim-scripts/AnsiEsc.vim' | |
Plug 'rhysd/vim-grammarous' | |
Plug 'MunifTanjim/nui.nvim' | |
" fix csharp_ls go to def metadata | |
Plug 'Decodetalkers/csharpls-extended-lsp.nvim' | |
Plug 'hoffs/omnisharp-extended-lsp.nvim' | |
" Plug 'lervag/vimtex', { 'for': 'tex' } | |
" Plug 'carlsmedstad/vim-bicep' | |
" Plug 'dccsillag/magma-nvim', { 'do': ':UpdateRemotePlugins' } | |
" Plug 'Bryley/neoai.nvim' | |
" Plug 'OmniSharp/omnisharp-vim' | |
" Plug 'tzachar/cmp-tabnine', { 'do': './install.sh' } | |
endif | |
call plug#end() | |
"}}} | |
"{{{ key mappings | |
noremap <F1> <Nop> | |
noremap Q <Nop> | |
noremap <CR><CR> :noh<CR> | |
noremap j gj | |
noremap k gk | |
nnoremap <Tab> gt | |
nnoremap <S-Tab> gT | |
noremap <leader>[ :bp<CR> | |
noremap <leader>] :bn<CR> | |
noremap <leader>k :ALEPrevious<CR> | |
noremap <leader>j :ALENext<CR> | |
noremap <leader>t :NvimTreeToggle<CR> | |
noremap <leader>q :q<CR> | |
noremap <leader>w :w<CR> | |
noremap <leader>rr :LspRestart<CR> | |
nnoremap <silent> <leader><space> :Goyo<CR><C-c> | |
nnoremap <silent> <leader>ft :FloatermToggle<CR> | |
nnoremap <C-p> <cmd>Telescope find_files<CR> | |
nnoremap <leader>f <cmd>Telescope resume<CR> | |
nnoremap <leader>ff <cmd>Telescope find_files<CR> | |
nnoremap <leader>fg <cmd>Telescope live_grep<CR> | |
nnoremap <leader>fb <cmd>Telescope buffers<CR> | |
nnoremap <leader>fh <cmd>Telescope help_tags<CR> | |
nnoremap <leader>xx <cmd>TroubleToggle<CR> | |
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<CR> | |
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<CR> | |
nnoremap <leader>xq <cmd>TroubleToggle quickfix<CR> | |
nnoremap <leader>xl <cmd>TroubleToggle loclist<CR> | |
nnoremap gr <cmd>TroubleToggle lsp_references<CR> | |
nnoremap <space>dl :call vimspector#Launch()<CR> | |
nnoremap <space>dr :call vimspector#Reset()<CR> | |
nnoremap <space>dc :call vimspector#Continue()<CR> | |
nnoremap <space>db :call vimspector#ToggleBreakpoint()<CR> | |
nnoremap <space>dC :call vimspector#ClearBreakpoints()<CR> | |
nnoremap <space>ds <Plug>VimspectorStop | |
nnoremap <space>dk <Plug>VimspectorRestart | |
nnoremap <space>do <Plug>VimspectorStepOut | |
nnoremap <space>di <Plug>VimspectorStepInto | |
nnoremap <space>dd <Plug>VimspectorStepOver | |
nmap <space>de <Plug>VimspectorBalloonEval | |
xmap <space>de <Plug>VimspectorBalloonEval | |
let c = 1 | |
while c < 20 | |
silent execute "nnoremap <leader>" . c . " :" . c . "b\<CR>" | |
let c += 1 | |
endwhile | |
"}}} | |
"{{{ autocmds | |
augroup general | |
au! | |
au ColorScheme * call <SID>hi_patch() | |
au User GoyoEnter nested call <SID>goyo_enter() | |
au User GoyoLeave nested call <SID>goyo_leave() | |
au BufReadPost * call Sync_gist() | |
au BufWritePre * call Post_gist() | |
au BufWritePost $MYVIMRC :so $MYVIMRC | |
au BufWinEnter VimspectorPrompt AnsiEsc | |
au FileType * nnoremap <buffer><silent> <localleader>dd :lua vim.diagnostic.reset()<CR> | |
au FileType * nnoremap <buffer><silent> <localleader>f :lua vim.lsp.buf.format { async = true } <CR><CR> | |
au FileType javascript,vue,typescript nnoremap <buffer><silent> <localleader>f :Neoformat prettier<CR><CR> | |
au FileType json,markdown,css,scss nnoremap <buffer> <localleader>f :Neoformat prettier <CR> | |
au FileType python nnoremap <buffer> <localleader>f :Neoformat black<CR> | |
au FileType html nnoremap <buffer> <localleader>f :%!prettier --parser html --print-width 1000 <CR> | |
au FileType r,javascript,html autocmd BufWritePre <buffer> %s/\s\+$//e | |
au FileType r nnoremap <buffer><silent> <CR> :call SendLineToR("down")<CR> | |
au FileType alpha lua vim.b.miniindentscope_disable=true | |
au CmdlineEnter * ++once if has('nvim') | call <SID>wilder_init() | call wilder#main#start() | endif | |
augroup END | |
augroup cursorline_only_in_activewindow | |
au! | |
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline | |
au WinLeave * setlocal nocursorline | |
augroup END | |
augroup no_syntax_hl_for_large_file | |
au! | |
au BufWinEnter * if getfsize(@%) > 100000 | syntax off | endif | |
augroup END | |
augroup vimrc_sync_fromstart | |
autocmd! | |
autocmd BufEnter * :syntax sync maxlines=200 | |
augroup END | |
augroup vimrc_remember_cursor_position | |
autocmd! | |
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif | |
augroup END | |
"}}} | |
colorscheme onedark | |
"GistID: 9b957739caba2ec7e8fa34f4fd9659b4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- vm: ft=lua ts=2 sw=2 expandtab | |
vim.loader.enable() | |
local config_path = vim.fn.stdpath('config') | |
local gist_files = { | |
'init-prev.vim', | |
'lua/nvim-tree-config.lua', | |
'lua/startup-screen.lua', | |
'lua/nvim-cmp-config.lua', | |
'lua/nvim-lsp-config.lua' | |
} | |
local function gist(force) | |
for i, file in ipairs(gist_files) do | |
local dest = config_path .. '/' .. file | |
if (force == false) and vim.fn.filereadable(dest) == 1 then | |
return | |
end | |
local filename = file.gsub(file, "/", "---") | |
local url = "https://gist.github.com/pwang2/9b957739caba2ec7e8fa34f4fd9659b4/raw/" .. filename | |
local cmd = "curl -sSL --create-dirs --output " .. dest .. " -H 'Cache-Control: no-cache' " .. url | |
os.execute(cmd) | |
end | |
end | |
--when open $MYVIMRC, gist sync all files in the gist lists | |
vim.api.nvim_create_autocmd({ 'BufEnter' }, { | |
pattern = vim.fn.expand('$MYVIMRC'), | |
callback = function() gist(true) end, | |
group = vim.api.nvim_create_augroup('gist', { clear = true }) | |
}) | |
gist(false) | |
vim.cmd('source ' .. config_path .. '/init-prev.vim') | |
require 'Comment'.setup() | |
require 'mason'.setup {} | |
require 'startup-screen' | |
require "nvim-tree-config" | |
require "nvim-cmp-config" | |
require "nvim-lsp-config" | |
local trouble = require('trouble.providers.telescope') | |
local troublemaker = trouble.open_with_trouble | |
require 'nvim-web-devicons'.setup {} | |
require 'nvim-ts-autotag'.setup {} | |
require 'colorizer'.setup { '*' } | |
require 'bufferline'.setup {} | |
require 'lualine'.setup { options = { theme = 'onedark', globalstatus = true } } | |
require 'mini.indentscope'.setup { symbol = '│' } | |
require 'mini.cursorword'.setup { delay = 1000 } | |
require 'mini.bufremove'.setup {} | |
require 'mini.pairs'.setup {} | |
require 'gitsigns'.setup { | |
on_attach = function(bufnr) | |
local gs = package.loaded.gitsigns | |
local function map(mode, l, r, o) | |
o = o or {} | |
o.buffer = bufnr | |
vim.keymap.set(mode, l, r, o) | |
end | |
-- Navigation | |
map('n', ']c', function() | |
if vim.wo.diff then return ']c' end | |
vim.schedule(function() gs.next_hunk() end) | |
return '<Ignore>' | |
end, { expr = true }) | |
map('n', '[c', function() | |
if vim.wo.diff then return '[c' end | |
vim.schedule(function() gs.prev_hunk() end) | |
return '<Ignore>' | |
end, { expr = true }) | |
-- Actions | |
map({ 'n', 'v' }, '<space>hs', ':Gitsigns stage_hunk<CR>') | |
map({ 'n', 'v' }, '<space>hr', ':Gitsigns reset_hunk<CR>') | |
map('n', '<space>hS', gs.stage_buffer) | |
map('n', '<space>hu', gs.undo_stage_hunk) | |
map('n', '<space>hR', gs.reset_buffer) | |
map('n', '<space>hp', gs.preview_hunk) | |
map('n', '<space>hb', function() gs.blame_line { full = true } end) | |
map('n', '<space>tb', gs.toggle_current_line_blame) | |
map('n', '<space>hd', gs.diffthis) | |
map('n', '<space>hD', function() gs.diffthis('~') end) | |
map('n', '<space>td', gs.toggle_deleted) | |
-- Text object | |
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>') | |
end, | |
} | |
require 'trouble'.setup { | |
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" | |
} | |
require 'telescope'.setup { | |
defaults = { | |
mappings = { | |
i = { ['<leader>t'] = troublemaker }, | |
n = { ['<leader>t'] = troublemaker }, | |
}, | |
}, | |
pickers = { | |
find_files = { | |
hidden = true, | |
file_ignore_patterns = { '.git', 'node_modules' }, | |
}, | |
}, | |
} | |
require 'nvim-treesitter.configs'.setup { | |
ensure_installed = { "vue", "lua", "bash", "todotxt", "javascript", "css", "jsonc", "typescript", "html", "yaml" }, | |
indent = { | |
enable = true, disable = { "python", "c" }, | |
}, | |
highlight = { | |
enable = true, | |
disable = { "c" }, | |
}, | |
incremental_selection = { | |
enable = true, | |
keymaps = { | |
init_selection = '<space>nn', | |
node_incremental = '<space>ni', | |
scope_incremental = '<space>si', | |
node_decremental = '<space>nd', | |
}, | |
}, | |
refactor = { | |
highlight_definitions = { enable = true, clear_on_cursor_move = true }, | |
-- smart_rename = { enable = true, keymaps = { smart_rename = 'grr' } }, | |
-- highlight_current_scope = { enable = true }, | |
}, | |
} | |
require('smartyank').setup { | |
highlight = { | |
enabled = true, -- highlight yanked text | |
higroup = "IncSearch", -- highlight group of yanked text | |
timeout = 200, -- timeout for clearing the highlight | |
}, | |
clipboard = { | |
enabled = true | |
}, | |
tmux = { | |
enabled = true, | |
-- remove `-w` to disable copy to host client's clipboard | |
cmd = { 'tmux', 'set-buffer', '-w' } | |
}, | |
osc52 = { | |
enabled = true, | |
ssh_only = true, -- false to OSC52 yank also in local sessions | |
silent = false, -- true to disable the "n chars copied" echo | |
echo_hl = "Directory", -- highlight group of the OSC52 echo message | |
} | |
} | |
vim.api.nvim_set_keymap('n', '<leader>qt', ':%!quicktype -l ts --just-types --top-level Root<cr>', | |
{ noremap = true, silent = true }) | |
-- firenvim_config | |
vim.g.firenvim_config = { | |
localSettings = { | |
["*"] = { | |
cmdline = "neovim", | |
content = "text", | |
priority = 0, | |
selector = "textarea", | |
takeover = "never" | |
} | |
} | |
} | |
if vim.g.started_by_firenvim == true then | |
vim.o.laststatus = 0 | |
vim.o.showtabline = 0 | |
require('cmp').setup { enabled = false } | |
end | |
--GistID: 9b957739caba2ec7e8fa34f4fd9659b4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local cmp = require('cmp') | |
local lspkind = require('lspkind') | |
local t = function(str) | |
return vim.api.nvim_replace_termcodes(str, true, true, true) | |
end | |
local fk = vim.api.nvim_feedkeys | |
vim.g.copilot_no_tab_map = true | |
vim.g.copilot_assume_mapped = true | |
vim.g.copilot_tab_fallback = "" | |
cmp.setup { | |
snippet = { expand = function(args) vim.fn['UltiSnips#Anon'](args.body) end }, | |
formatting = { | |
-- format = lspkind.cmp_format({ mode = 'symbol_text' }) | |
format = function(entry, vim_item) | |
vim_item.kind = lspkind.symbolic(vim_item.kind, { mode = "symbol_text" }) | |
vim_item.menu = entry.source.name | |
if entry.source.name == "cmp_tabnine" then | |
local detail = (entry.completion_item.data or {}).detail | |
vim_item.kind = "" | |
if detail and detail:find('.*%%.*') then | |
vim_item.kind = vim_item.kind .. ' ' .. detail | |
end | |
if (entry.completion_item.data or {}).multiline then | |
vim_item.kind = vim_item.kind .. ' ' .. '[ML]' | |
end | |
elseif entry.source.name == "nvim_lsp" then | |
vim_item.kind = lspkind.symbolic(vim_item.kind, { mode = "symbol_text" }) | |
end | |
local maxwidth = 80 | |
vim_item.abbr = string.sub(vim_item.abbr, 1, maxwidth) | |
return vim_item | |
end, | |
}, | |
-- preselect = cmp.PreselectMode.Item, | |
mapping = { | |
['<Tab>'] = cmp.mapping({ | |
i = function(fallback) | |
if cmp.visible() then | |
cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) | |
elseif vim.fn['UltiSnips#CanJumpForwards']() == 1 then | |
fk(t('<Plug>(ultisnips_jump_forward)'), 'm', true) | |
else | |
fallback() | |
end | |
end, | |
s = function(fallback) | |
if vim.fn['UltiSnips#CanJumpForwards']() == 1 then | |
fk(t('<Plug>(ultisnips_jump_forward)'), 'm', true) | |
else | |
fallback() | |
end | |
end, | |
}), | |
['<S-Tab>'] = cmp.mapping({ | |
i = function(fallback) | |
if cmp.visible() then | |
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) | |
elseif vim.fn['UltiSnips#CanJumpBackwards']() == 1 then | |
fk(t('<Plug>(ultisnips_jump_backward)'), 'm', true) | |
else | |
fallback() | |
end | |
end, | |
s = function(fallback) | |
if vim.fn['UltiSnips#CanJumpBackwards']() == 1 then | |
fk(t('<Plug>(ultisnips_jump_backward)'), 'm', true) | |
else | |
fallback() | |
end | |
end, | |
}), | |
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), | |
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), | |
['<C-space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), | |
['<C-y>'] = cmp.config.disable, | |
['<C-e>'] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }), | |
['<C-k>'] = cmp.mapping.confirm({ select = true }), | |
["<C-j>"] = cmp.mapping(function(fallback) | |
cmp.mapping.abort() | |
local copilot_keys = vim.fn["copilot#Accept"]() | |
if copilot_keys ~= "" then | |
vim.api.nvim_feedkeys(copilot_keys, "i", true) | |
else | |
fallback() | |
end | |
end), | |
}, | |
sources = cmp.config.sources({ | |
-- { name = 'cmp_tabnine', group_index = 2 }, | |
{ name = 'ultisnips' }, | |
{ name = 'emoji' }, | |
{ name = 'nvim_lsp_signature_help' }, | |
{ name = 'nvim_lsp', max_item_count = 10, priority = 100 }, | |
{ name = 'buffer', max_item_count = 5, priority = 10 } | |
}), | |
confirm_opts = { | |
behavior = cmp.ConfirmBehavior.Replace, | |
select = false, | |
}, | |
window = { | |
documentation = { | |
border = "rounded", | |
winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None", | |
}, | |
completion = { | |
border = "rounded", | |
winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None", | |
}, | |
}, | |
experimental = { | |
ghost_text = true, | |
}, | |
} | |
vim.api.nvim_set_keymap('i', '<C-s>', | |
[[<Cmd>lua require'cmp'.complete({ config = { sources = { { name = 'ultisnips' } } } })<CR>]], | |
{ noremap = true, silent = true }) | |
--GistID: 9b957739caba2ec7e8fa34f4fd9659b4 File: lua/nvim-cmp-config.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('mason-lspconfig').setup { | |
ensure_installed = { | |
'lua_ls', | |
'vimls', | |
-- 'yamlls', | |
'azure_pipelines_ls', | |
'volar', | |
'pyright', | |
'bashls', | |
'tsserver', | |
'bicep', | |
}, | |
} | |
local lspconfig = require('lspconfig') | |
local lspConfigUtil = require 'lspconfig.util' | |
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview | |
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) | |
opts = opts or {} | |
opts.border = opts.border or 'single' | |
opts.max_width = opts.max_width or 80 | |
return orig_util_open_floating_preview(contents, syntax, opts, ...) | |
end | |
local on_attach = function(_, bufnr) | |
local bkm = vim.api.nvim_buf_set_keymap | |
local km = vim.api.nvim_set_keymap | |
local kb_opts = { noremap = true, silent = true } | |
local mkmp = function(key, cmd) | |
vim.lsp.util.make_floating_popup_options(80, 20) | |
bkm(bufnr, 'n', key, '<cmd>lua vim.lsp.buf.' .. cmd .. '()<CR>', kb_opts) | |
end | |
mkmp('gD', 'declaration') | |
mkmp('gd', 'definition') | |
mkmp('K', 'hover') | |
mkmp('gi', 'implementation') | |
mkmp('<space>k', 'signature_help') | |
mkmp('<space>D', 'type_definition') | |
mkmp('<space>rn', 'rename') | |
mkmp('<space>ca', 'code_action') | |
-- mkmp('<space>f', 'formatting') -- use Neoformat | |
-- mkmp('gr', 'references') -- use trouble gr | |
km('n', '<space>e', '<cmd>lua vim.diagnostic.open_float({width = 80})<CR>', kb_opts) | |
km('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', kb_opts) | |
km('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', kb_opts) | |
km('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', kb_opts) | |
km('n', 'gv', '<cmd>:vsplit | lua vim.lsp.buf.definition()<CR>', kb_opts) | |
end | |
local capabilities = require 'cmp_nvim_lsp'.default_capabilities(vim.lsp.protocol.make_client_capabilities()) | |
lspConfigUtil.default_config = vim.tbl_extend('force', lspConfigUtil.default_config, { | |
on_attach = on_attach, | |
capabilities = capabilities, | |
}) | |
lspconfig.bicep.setup {} | |
-- lspconfig.r_language_server.setup { | |
-- cmd = { 'R', '--slave', '-e', 'languageserver::run()' }, | |
-- } | |
lspconfig.lua_ls.setup { | |
settings = { Lua = { diagnostics = { globals = { 'vim', 'hs', 'spoon' } } } }, | |
} | |
-- lspconfig.tsserver.setup { | |
-- on_attach = on_attach, | |
-- capabilities = capabilities, | |
-- init_options = { | |
-- preferences = { | |
-- disableSuggestions = true, | |
-- }, | |
-- } | |
-- } | |
lspconfig.volar.setup { | |
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' }, | |
on_attach = on_attach, | |
capabilities = capabilities, | |
init_options = { | |
preferences = { | |
disableSuggestions = true, | |
}, | |
} | |
} | |
lspconfig.omnisharp.setup { | |
handlers = { | |
["textDocument/definition"] = require('omnisharp_extended').handler, | |
} | |
} | |
--Enable (broadcasting) snippet capability for completion | |
local c = vim.lsp.protocol.make_client_capabilities() | |
c.textDocument.completion.completionItem.snippetSupport = true | |
--Enable (broadcasting) snippet capability for completion | |
-- | |
-- lspconfig.cssls.setup { | |
-- filetypes = { "css", "scss", "less", "vue" }, | |
-- single_file_support = false, | |
-- capabilities = c | |
-- } | |
lspconfig.vimls.setup {} | |
lspconfig.tailwindcss.setup { | |
filetypes = { 'vue', 'html', 'css' }, | |
} | |
lspconfig.gopls.setup {} | |
lspconfig.pyright.setup {} | |
lspconfig.bashls.setup {} | |
-- lspconfig.sourcery.setup {} | |
-- lspconfig.yamlls.setup {} | |
lspconfig.azure_pipelines_ls.setup { | |
settings = { | |
yaml = { | |
schemas = { | |
["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = { | |
"/azure-pipeline*.y*l", | |
"/*.azure*", | |
"Azure-Pipelines/**/*.y*l", | |
"Pipelines/*.y*l", | |
}, | |
}, | |
}, | |
}, | |
} | |
--GistID: 9b957739caba2ec7e8fa34f4fd9659b4 File: lua/nvim-lsp-config.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function on_attach(bufnr) | |
local api = require('nvim-tree.api') | |
local function opts(desc) | |
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } | |
end | |
-- Default mappings. Feel free to modify or remove as you wish. | |
-- | |
-- BEGIN_DEFAULT_ON_ATTACH | |
vim.keymap.set('n', '<C-]>', api.tree.change_root_to_node, opts('CD')) | |
vim.keymap.set('n', '<C-e>', api.node.open.replace_tree_buffer, opts('Open: In Place')) | |
vim.keymap.set('n', '<C-k>', api.node.show_info_popup, opts('Info')) | |
vim.keymap.set('n', '<C-r>', api.fs.rename_sub, opts('Rename: Omit Filename')) | |
vim.keymap.set('n', '<C-t>', api.node.open.tab, opts('Open: New Tab')) | |
vim.keymap.set('n', '<C-v>', api.node.open.vertical, opts('Open: Vertical Split')) | |
vim.keymap.set('n', '<C-x>', api.node.open.horizontal, opts('Open: Horizontal Split')) | |
vim.keymap.set('n', '<BS>', api.node.navigate.parent_close, opts('Close Directory')) | |
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open')) | |
vim.keymap.set('n', '<Tab>', api.node.open.preview, opts('Open Preview')) | |
vim.keymap.set('n', '>', api.node.navigate.sibling.next, opts('Next Sibling')) | |
vim.keymap.set('n', '<', api.node.navigate.sibling.prev, opts('Previous Sibling')) | |
vim.keymap.set('n', '.', api.node.run.cmd, opts('Run Command')) | |
vim.keymap.set('n', '-', api.tree.change_root_to_parent, opts('Up')) | |
vim.keymap.set('n', 'a', api.fs.create, opts('Create')) | |
vim.keymap.set('n', 'bd', api.marks.bulk.delete, opts('Delete Bookmarked')) | |
vim.keymap.set('n', 'bmv', api.marks.bulk.move, opts('Move Bookmarked')) | |
vim.keymap.set('n', 'B', api.tree.toggle_no_buffer_filter, opts('Toggle No Buffer')) | |
vim.keymap.set('n', 'c', api.fs.copy.node, opts('Copy')) | |
vim.keymap.set('n', 'C', api.tree.toggle_git_clean_filter, opts('Toggle Git Clean')) | |
vim.keymap.set('n', '[c', api.node.navigate.git.prev, opts('Prev Git')) | |
vim.keymap.set('n', ']c', api.node.navigate.git.next, opts('Next Git')) | |
vim.keymap.set('n', 'd', api.fs.remove, opts('Delete')) | |
vim.keymap.set('n', 'D', api.fs.trash, opts('Trash')) | |
vim.keymap.set('n', 'E', api.tree.expand_all, opts('Expand All')) | |
vim.keymap.set('n', 'e', api.fs.rename_basename, opts('Rename: Basename')) | |
vim.keymap.set('n', ']e', api.node.navigate.diagnostics.next, opts('Next Diagnostic')) | |
vim.keymap.set('n', '[e', api.node.navigate.diagnostics.prev, opts('Prev Diagnostic')) | |
vim.keymap.set('n', 'F', api.live_filter.clear, opts('Clean Filter')) | |
vim.keymap.set('n', 'f', api.live_filter.start, opts('Filter')) | |
vim.keymap.set('n', 'g?', api.tree.toggle_help, opts('Help')) | |
vim.keymap.set('n', 'gy', api.fs.copy.absolute_path, opts('Copy Absolute Path')) | |
vim.keymap.set('n', 'H', api.tree.toggle_hidden_filter, opts('Toggle Dotfiles')) | |
vim.keymap.set('n', 'I', api.tree.toggle_gitignore_filter, opts('Toggle Git Ignore')) | |
vim.keymap.set('n', 'J', api.node.navigate.sibling.last, opts('Last Sibling')) | |
vim.keymap.set('n', 'K', api.node.navigate.sibling.first, opts('First Sibling')) | |
vim.keymap.set('n', 'm', api.marks.toggle, opts('Toggle Bookmark')) | |
vim.keymap.set('n', 'o', api.node.open.edit, opts('Open')) | |
vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts('Open: No Window Picker')) | |
vim.keymap.set('n', 'p', api.fs.paste, opts('Paste')) | |
vim.keymap.set('n', 'P', api.node.navigate.parent, opts('Parent Directory')) | |
vim.keymap.set('n', 'q', api.tree.close, opts('Close')) | |
vim.keymap.set('n', 'r', api.fs.rename, opts('Rename')) | |
vim.keymap.set('n', 'R', api.tree.reload, opts('Refresh')) | |
vim.keymap.set('n', 's', api.node.run.system, opts('Run System')) | |
vim.keymap.set('n', 'S', api.tree.search_node, opts('Search')) | |
vim.keymap.set('n', 'U', api.tree.toggle_custom_filter, opts('Toggle Hidden')) | |
vim.keymap.set('n', 'W', api.tree.collapse_all, opts('Collapse')) | |
vim.keymap.set('n', 'x', api.fs.cut, opts('Cut')) | |
vim.keymap.set('n', 'y', api.fs.copy.filename, opts('Copy Name')) | |
vim.keymap.set('n', 'Y', api.fs.copy.relative_path, opts('Copy Relative Path')) | |
vim.keymap.set('n', '<2-LeftMouse>', api.node.open.edit, opts('Open')) | |
vim.keymap.set('n', '<2-RightMouse>', api.tree.change_root_to_node, opts('CD')) | |
-- END_DEFAULT_ON_ATTACH | |
-- Mappings removed via: | |
-- remove_keymaps | |
-- OR | |
-- view.mappings.list..action = "" | |
-- | |
-- The dummy set before del is done for safety, in case a default mapping does not exist. | |
-- | |
-- You might tidy things by removing these along with their default mapping. | |
vim.keymap.set('n', '<C-e>', '', { buffer = bufnr }) | |
vim.keymap.del('n', '<C-e>', { buffer = bufnr }) | |
-- Mappings migrated from view.mappings.list | |
-- | |
-- You will need to insert "your code goes here" for any mappings with a custom action_cb | |
vim.keymap.set('n', 's', api.node.open.vertical, opts('Open: Vertical Split')) | |
vim.keymap.set('n', 'i', api.node.open.horizontal, opts('Open: Horizontal Split')) | |
vim.keymap.set('n', 'u', api.tree.change_root_to_parent, opts('Up')) | |
end | |
require 'nvim-tree'.setup { | |
renderer = { special_files = {} }, | |
actions = { open_file = { window_picker = { enable = true } } }, | |
git = { enable = false }, | |
on_attach = on_attach | |
} | |
--GistID: 9b957739caba2ec7e8fa34f4fd9659b4 File: lua/nvim-tree-config.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local config_path = vim.fn.stdpath('config') | |
local status_ok, alpha = pcall(require, 'alpha') | |
if not status_ok then return end | |
local path_ok, path = pcall(require, 'plenary.path') | |
if not path_ok then return end | |
local nwd = require('nvim-web-devicons') | |
local dashboard = require('alpha.themes.dashboard') | |
local cdir = vim.fn.getcwd() | |
local function get_extension(fn) | |
local match = fn:match('^.+(%..+)$') | |
local ext = '' | |
if match ~= nil then ext = match:sub(2) end | |
return ext | |
end | |
local function icon(fn) | |
local ext = get_extension(fn) | |
return nwd.get_icon_color(fn, ext, { default = true }) | |
end | |
local function file_button(fn, sc, short_fn) | |
short_fn = short_fn or fn | |
local ico_txt | |
local fb_hl = {} | |
local ico, hl = icon(fn) | |
local hl_option_type = type(nwd.highlight) | |
if hl_option_type == 'boolean' then | |
if hl and nwd.highlight then table.insert(fb_hl, { hl, 0, 1 }) end | |
end | |
if hl_option_type == 'string' then | |
table.insert(fb_hl, { nwd.highlight, 0, 1 }) | |
end | |
ico_txt = ico .. ' ' | |
local file_button_el = dashboard.button(sc, ico_txt .. short_fn, '<cmd>e ' .. fn .. ' <CR>', {}) | |
local fn_start = short_fn:match('.*/') | |
if fn_start ~= nil then | |
table.insert(fb_hl, { 'Comment', #ico_txt - 2, #fn_start + #ico_txt - 2 }) | |
end | |
file_button_el.opts.hl = fb_hl | |
return file_button_el | |
end | |
local default_mru_ignore = { 'gitcommit' } | |
local mru_opts = { | |
ignore = function(_path, ext) | |
return (string.find(_path, 'COMMIT_EDITMSG')) or | |
(vim.tbl_contains(default_mru_ignore, ext)) | |
end, | |
} | |
--- @param start number | |
--- @param cwd string optional | |
--- @param items_number number optional number of items to generate, default = 10 | |
local function mru(start, cwd, items_number, opts) | |
opts = opts or mru_opts | |
items_number = items_number or 9 | |
local oldfiles = {} | |
for _, v in pairs(vim.v.oldfiles) do | |
if #oldfiles == items_number then break end | |
local cwd_cond | |
if not cwd then | |
cwd_cond = true | |
else | |
cwd_cond = vim.startswith(v, cwd) | |
end | |
local ignore = (opts.ignore and opts.ignore(v, get_extension(v))) or false | |
if (vim.fn.filereadable(v) == 1) and cwd_cond and not ignore then | |
oldfiles[#oldfiles + 1] = v | |
end | |
end | |
local special_shortcuts = { 'a', 's', 'd' } | |
local target_width = 42 | |
local tbl = {} | |
for i, fn in ipairs(oldfiles) do | |
local short_fn | |
if cwd then | |
short_fn = vim.fn.fnamemodify(fn, ':.') | |
else | |
short_fn = vim.fn.fnamemodify(fn, ':~') | |
end | |
if (#short_fn > target_width) then | |
short_fn = path.new(short_fn):shorten(1, { -2, -1 }) | |
if (#short_fn > target_width) then | |
short_fn = path.new(short_fn):shorten(1, { -1 }) | |
end | |
end | |
local shortcut = '' | |
if i <= #special_shortcuts then | |
shortcut = special_shortcuts[i] | |
else | |
shortcut = tostring(i + start - 1 - #special_shortcuts) | |
end | |
local file_button_el = file_button(fn, ' ' .. shortcut, short_fn) | |
tbl[i * 2] = { type = 'padding', val = 1 } | |
tbl[i * 2 + 1] = file_button_el | |
end | |
return { type = 'group', val = tbl, opts = {} } | |
end | |
local cool = { | |
[[ / \ ]], | |
[[ \ \ ,, / / ]], | |
[[ '-.`\()/`.-' ]], | |
[[ .--_'( )'_--. ]], | |
[[ / /` /`""`\ `\ \ ]], | |
[[ | | 王 | | ]], | |
[[ \ \ / / ]], | |
[[ '.__.' ]], | |
} | |
local headers = { cool } | |
local function header_chars() return headers[math.random(#headers)] end | |
local function header_color() | |
local lines = {} | |
for i, line_chars in pairs(header_chars()) do | |
local hi = 'StartLogo' .. i | |
local line = { | |
type = 'text', | |
val = line_chars, | |
opts = { hl = hi, shrink_margin = false, position = 'center' }, | |
} | |
table.insert(lines, line) | |
end | |
local output = { type = 'group', val = lines, opts = { position = 'center' } } | |
return output | |
end | |
local section_mru = { | |
type = 'group', | |
val = { | |
{ | |
type = 'text', | |
val = 'Recent files', | |
opts = { hl = 'SpecialComment', shrink_margin = false, | |
position = 'center' }, | |
}, { type = 'padding', val = 1 }, { | |
type = 'group', | |
val = function() return { mru(1, cdir, 9) } end, | |
opts = { shrink_margin = false }, | |
}, | |
}, | |
} | |
local buttons = { | |
type = 'group', | |
val = { | |
{ | |
type = 'text', | |
val = 'Quick links', | |
opts = { hl = 'SpecialComment', position = 'center' }, | |
}, | |
{ type = 'padding', val = 1 }, dashboard.button('f', ' Find file', ':Telescope find_files <CR>', {}), | |
{ type = 'padding', val = 1 }, dashboard.button('F', ' Find text', ':Telescope live_grep <CR>', {}), | |
{ type = 'padding', val = 1 }, dashboard.button('n', ' New file', ':ene <BAR> startinsert <CR>', {}), | |
{ type = 'padding', val = 1 }, dashboard.button('c', ' Config', ':args '.. config_path .. '/{init.lua,init-prev.vim,lua/*}<CR>', {}), | |
{ type = 'padding', val = 1 }, dashboard.button('u', ' Update', ':PlugUpdate<CR>', {}), | |
{ type = 'padding', val = 1 }, dashboard.button('h', ' Check Health', ':checkhealth<CR>', {}), | |
{ type = 'padding', val = 1 }, dashboard.button('q', ' Quit', ':qa<CR>', {}), | |
}, | |
position = 'center', | |
} | |
local opts = { | |
layout = { | |
{ type = 'padding', val = 2 }, header_color(), | |
{ type = 'padding', val = 2 }, section_mru, { type = 'padding', val = 2 }, | |
buttons, | |
}, | |
opts = { margin = 5 }, | |
} | |
alpha.setup(opts) | |
--GistID: 9b957739caba2ec7e8fa34f4fd9659b4 File: lua/startup-screen.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment