Update
This commit is contained in:
parent
de31ee2c56
commit
c27e4373d1
@ -21,6 +21,25 @@ local db = require('dashboard')
|
||||
|
||||
local dotfiles = home .. '/dotfiles'
|
||||
|
||||
db.custom_header = {
|
||||
'',
|
||||
' ⣿⣿⣷⡁⢆⠈⠕⢕⢂⢕⢂⢕⢂⢔⢂⢕⢄⠂⣂⠂⠆⢂⢕⢂⢕⢂⢕⢂⢕⢂ ',
|
||||
' ⣿⣿⣿⡷⠊⡢⡹⣦⡑⢂⢕⢂⢕⢂⢕⢂⠕⠔⠌⠝⠛⠶⠶⢶⣦⣄⢂⢕⢂⢕ ',
|
||||
' ⣿⣿⠏⣠⣾⣦⡐⢌⢿⣷⣦⣅⡑⠕⠡⠐⢿⠿⣛⠟⠛⠛⠛⠛⠡⢷⡈⢂⢕⢂ ',
|
||||
' ⠟⣡⣾⣿⣿⣿⣿⣦⣑⠝⢿⣿⣿⣿⣿⣿⡵⢁⣤⣶⣶⣿⢿⢿⢿⡟⢻⣤⢑⢂ ',
|
||||
' ⣾⣿⣿⡿⢟⣛⣻⣿⣿⣿⣦⣬⣙⣻⣿⣿⣷⣿⣿⢟⢝⢕⢕⢕⢕⢽⣿⣿⣷⣔ ',
|
||||
' ⣿⣿⠵⠚⠉⢀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⢕⢕⢕⢕⢕⢕⣽⣿⣿⣿⣿ ',
|
||||
' ⢷⣂⣠⣴⣾⡿⡿⡻⡻⣿⣿⣴⣿⣿⣿⣿⣿⣿⣷⣵⣵⣵⣷⣿⣿⣿⣿⣿⣿⡿ ',
|
||||
' ⢌⠻⣿⡿⡫⡪⡪⡪⡪⣺⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃ ',
|
||||
' ⠣⡁⠹⡪⡪⡪⡪⣪⣾⣿⣿⣿⣿⠋⠐⢉⢍⢄⢌⠻⣿⣿⣿⣿⣿⣿⣿⣿⠏⠈ ',
|
||||
' ⡣⡘⢄⠙⣾⣾⣾⣿⣿⣿⣿⣿⣿⡀⢐⢕⢕⢕⢕⢕⡘⣿⣿⣿⣿⣿⣿⠏⠠⠈ ',
|
||||
' ⠌⢊⢂⢣⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢐⢕⢕⢕⢕⢕⢅⣿⣿⣿⣿⡿⢋⢜⠠⠈ ',
|
||||
' ⠄⠁⠕⢝⡢⠈⠻⣿⣿⣿⣿⣿⣿⣿⣷⣕⣑⣑⣑⣵⣿⣿⣿⡿⢋⢔⢕⣿⠠⠈ ',
|
||||
' ⠨⡂⡀⢑⢕⡅⠂⠄⠉⠛⠻⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢋⢔⢕⢕⣿⣿⠠⠈ ',
|
||||
' ⠄⠪⣂⠁⢕⠆⠄⠂⠄⠁⡀⠂⡀⠄⢈⠉⢍⢛⢛⢛⢋⢔⢕⢕⢕⣽⣿⣿⠠⠈ ',
|
||||
'',
|
||||
}
|
||||
|
||||
db.custom_center = {
|
||||
{
|
||||
icon = nil,
|
||||
@ -35,15 +54,14 @@ db.custom_center = {
|
||||
},
|
||||
{
|
||||
desc = 'Fichiers récemment ouverts ',
|
||||
action = 'DashboardFindHistory',
|
||||
action = "lua require('telescope.builtin').oldfiles()",
|
||||
shortcut = 'SPC f h'
|
||||
},
|
||||
{
|
||||
desc = 'Parcourir les dotfiles ',
|
||||
action = "lua require('telescope.builtin').find_files({" .. dotfiles .. "})",
|
||||
-- action = 'Telescope dotfiles path=' .. home .. '/dotfiles',
|
||||
action = "lua require('telescope.builtin').find_files({ cwd = \'" .. dotfiles .. "\' })",
|
||||
shortcut = 'SPC f d'
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
-- Highlight Group
|
||||
|
@ -72,13 +72,13 @@ endfunction
|
||||
|
||||
|
||||
" Close current buffer
|
||||
" If the last buffer is closed go back to Startify
|
||||
function! BufClose()
|
||||
" If the last buffer is closed go back to startup screen
|
||||
function! CloseBuffer()
|
||||
if (CountBuffers() == 1 || IsExplorerBuffer() || IsEmptyBuffer())
|
||||
bwipeout
|
||||
bwipeout!
|
||||
Dashboard
|
||||
else
|
||||
bwipeout
|
||||
bwipeout!
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
@ -688,6 +688,15 @@ let g:suda_smart_edit = 1
|
||||
" }}}
|
||||
|
||||
|
||||
" Telescope {{{
|
||||
" -----
|
||||
|
||||
source $HOME/.config/nvim/telescope.lua
|
||||
|
||||
" -----
|
||||
" }}}
|
||||
|
||||
|
||||
" Tmuxline {{{
|
||||
" -----
|
||||
|
||||
|
@ -54,15 +54,17 @@ map <C-s> :saveas<space>
|
||||
" Buffers {{{
|
||||
" -----
|
||||
|
||||
command! -bang -nargs=? -complete=dir Files
|
||||
\ call fzf#vim#files(
|
||||
\ <q-args>,
|
||||
\ fzf#vim#with_preview(
|
||||
\ {'options': ['--layout=reverse', '--info=inline']}
|
||||
\ ),
|
||||
\ <bang>0
|
||||
\ )
|
||||
map <C-w> :echom 'Close buffer' <bar> :call BufClose()<cr>
|
||||
" command! -bang -nargs=? -complete=dir Files
|
||||
" \ call fzf#vim#files(
|
||||
" \ <q-args>,
|
||||
" \ fzf#vim#with_preview(
|
||||
" \ {'options': ['--layout=reverse', '--info=inline']}
|
||||
" \ ),
|
||||
" \ <bang>0
|
||||
" \ )
|
||||
command -bang CloseBuffer :call CloseBuffer()
|
||||
|
||||
map <C-w> :echom 'Close buffer' <bar> :CloseBuffer!<cr>
|
||||
map <C-o> :e<space>
|
||||
map <C-n> :DashboardNewFile<cr>
|
||||
map <A-PageDown> :bn<cr>
|
||||
|
53
conf.d/nvim/telescope.lua
Normal file
53
conf.d/nvim/telescope.lua
Normal file
@ -0,0 +1,53 @@
|
||||
local previewers = require("telescope.previewers")
|
||||
local Job = require("plenary.job")
|
||||
local new_maker = function(filepath, bufnr, opts)
|
||||
filepath = vim.fn.expand(filepath)
|
||||
Job:new({
|
||||
command = "file",
|
||||
args = { "--mime-type", "-b", filepath },
|
||||
on_exit = function(j)
|
||||
local mime_type = vim.split(j:result()[1], "/")[1]
|
||||
if mime_type == "text" then
|
||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||
else
|
||||
-- maybe we want to write something to the buffer here
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" })
|
||||
end)
|
||||
end
|
||||
end
|
||||
}):sync()
|
||||
end
|
||||
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
preview = {
|
||||
mime_hook = function(filepath, bufnr, opts)
|
||||
local is_image = function(filepath)
|
||||
local image_extensions = {'png','jpg'} -- Supported image formats
|
||||
local split_path = vim.split(filepath:lower(), '.', {plain=true})
|
||||
local extension = split_path[#split_path]
|
||||
return vim.tbl_contains(image_extensions, extension)
|
||||
end
|
||||
if is_image(filepath) then
|
||||
local term = vim.api.nvim_open_term(bufnr, {})
|
||||
local function send_output(_, data, _ )
|
||||
for _, d in ipairs(data) do
|
||||
vim.api.nvim_chan_send(term, d..'\r\n')
|
||||
end
|
||||
end
|
||||
vim.fn.jobstart(
|
||||
{
|
||||
'catimg', filepath -- Terminal image viewer command
|
||||
},
|
||||
{on_stdout=send_output, stdout_buffered=true})
|
||||
else
|
||||
require("telescope.previewers.utils").set_preview_message(bufnr, opts.winid, "Binary cannot be previewed")
|
||||
end
|
||||
end
|
||||
},
|
||||
buffer_previewer_maker = new_maker,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user