Added newsboat
Update init.vim
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 87 KiB |
49
config/newsboat/config
Normal file
49
config/newsboat/config
Normal file
@@ -0,0 +1,49 @@
|
||||
auto-reload yes
|
||||
reload-time 5
|
||||
reload-threads 4
|
||||
|
||||
# Open in mpv
|
||||
macro m set browser "/usr/bin/mpv %u > /dev/null 2>&1 &"; open-in-browser ; set browser "xdg-open %u"
|
||||
|
||||
# Image preview
|
||||
# pipe-to "tee ~/log"
|
||||
|
||||
# notification
|
||||
notify-program /usr/bin/notify-send
|
||||
# notify-always yes
|
||||
|
||||
# pager
|
||||
# pager "nvim -R -c 'set ft=mail nomod noma nolist' -c 'nnoremap q :qa! <enter>' -"
|
||||
pager "~/.local/bin/newspager"
|
||||
# html-renderer /usr/bin/cat
|
||||
# pager "xargs echo"
|
||||
|
||||
macro l pipe-to "~/.local/bin/newspager"
|
||||
|
||||
# vim keybinds
|
||||
unbind-key h
|
||||
unbind-key j
|
||||
unbind-key k
|
||||
unbind-key l
|
||||
|
||||
# bind-key h quit
|
||||
bind-key j down
|
||||
bind-key k up
|
||||
# bind-key l open
|
||||
|
||||
unbind-key g
|
||||
bind-key g home
|
||||
unbind-key G
|
||||
bind-key G end
|
||||
|
||||
color background default default
|
||||
color listnormal default default
|
||||
color listnormal_unread default default
|
||||
color listfocus black cyan
|
||||
color listfocus_unread black cyan
|
||||
color info default black
|
||||
color article default default
|
||||
|
||||
highlight article "^(Title):.*$" blue default
|
||||
highlight article "https?://[^ ]+" red default
|
||||
highlight article "\\[image\\ [0-9]+\\]" green default
|
||||
@@ -5,35 +5,45 @@ call plug#begin()
|
||||
" QOL
|
||||
Plug 'airblade/vim-rooter'
|
||||
Plug 'yuttie/comfortable-motion.vim'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
|
||||
Plug 'folke/which-key.nvim'
|
||||
Plug 'kdav5758/TrueZen.nvim'
|
||||
Plug 'norcalli/nvim-colorizer.lua'
|
||||
|
||||
" Fzf
|
||||
Plug 'junegunn/fzf'
|
||||
Plug 'junegunn/fzf.vim'
|
||||
" Git plugin
|
||||
" Plug 'tpope/vim-fugitive'
|
||||
|
||||
" GUI Stuff
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'uttarayan21/minimalist' " Plug 'dikiaap/minimalist'
|
||||
Plug 'dracula/vim'
|
||||
" Statusline
|
||||
Plug 'glepnir/galaxyline.nvim' , {'branch': 'main'}
|
||||
" Tpope
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'tpope/vim-vinegar'
|
||||
Plug 'tpope/vim-repeat'
|
||||
Plug 'tpope/vim-speeddating'
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
" Rust
|
||||
" Plug 'arzg/vim-rust-syntax-ext'
|
||||
Plug 'rust-lang/rust.vim'
|
||||
Plug 'mhinz/vim-crates'
|
||||
Plug 'cespare/vim-toml'
|
||||
" LSP
|
||||
Plug 'onsails/lspkind-nvim'
|
||||
" Intellisense
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'folke/lsp-trouble.nvim'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'nvim-lua/completion-nvim'
|
||||
" Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
|
||||
" Ctags
|
||||
Plug 'ludovicchabant/vim-gutentags'
|
||||
" Plug 'majutsushi/tagbar'
|
||||
" Syntax Highlighting
|
||||
Plug 'rust-lang/rust.vim'
|
||||
Plug 'cespare/vim-toml'
|
||||
" Devicons
|
||||
" Plug 'ryanoasis/vim-devicons' " No color
|
||||
" GUI
|
||||
" Plug 'uttarayan21/minimalist' " Plug 'dikiaap/minimalist'
|
||||
Plug 'sainnhe/sonokai'
|
||||
Plug 'kyazdani42/nvim-web-devicons'
|
||||
Plug 'Yggdroot/indentLine'
|
||||
" Text Objects
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'wellle/targets.vim'
|
||||
" Dictionary
|
||||
Plug 'reedes/vim-wordy'
|
||||
@@ -48,30 +58,91 @@ call plug#end()
|
||||
"# Configurations
|
||||
"##################################################
|
||||
|
||||
" Remap C-h,j,k,l
|
||||
"nnoremap <C-h> <C-w>h
|
||||
"nnoremap <C-j> <C-w>j
|
||||
"nnoremap <C-k> <C-w>k
|
||||
"nnoremap <C-l> <C-w>l
|
||||
" set font
|
||||
set guifont=FiraCode\ Nerd\ Font\ Mono
|
||||
|
||||
" Undo
|
||||
set undodir=~/.cache/nvim/nvimdid
|
||||
set undofile
|
||||
|
||||
set timeoutlen=300
|
||||
|
||||
" Numbers and tabs
|
||||
set noshowmode
|
||||
set showtabline=2
|
||||
" set number relativenumber
|
||||
set autoindent
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set signcolumn=yes
|
||||
set hidden
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set termguicolors
|
||||
" set foldmethod=indent
|
||||
" set cmdheight=2
|
||||
|
||||
nnoremap <silent> <F2> :set number! relativenumber! <CR>
|
||||
nnoremap <silent> <F3> :IndentLinesToggle <CR>
|
||||
|
||||
" nnoremap <C-j> <ESC>
|
||||
inoremap <C-j> <ESC>
|
||||
|
||||
let mapleader = "\<Space>"
|
||||
|
||||
" BufferNext
|
||||
nnoremap <Leader>q :bw <CR>
|
||||
"nnoremap <Leader><Leader> :bNext <CR>
|
||||
nnoremap <leader><leader> <c-^>
|
||||
nnoremap <leader>n :bnext <CR>
|
||||
nnoremap <leader>p :bprev <CR>
|
||||
" Fzf
|
||||
nnoremap <Leader>f :Files <CR>
|
||||
nnoremap <Leader>; :Buffers <CR>
|
||||
nnoremap <Leader>g :Rg <CR>
|
||||
nnoremap <Leader>t :Tags <CR>
|
||||
nnoremap <silent> <Leader>f :Files <CR>
|
||||
nnoremap <silent> <Leader>; :Buffers <CR>
|
||||
nnoremap <silent> <Leader>g :Rg <CR>
|
||||
nnoremap <Leader>H :Himalaya <CR>
|
||||
nnoremap <Leader>c "+y
|
||||
nnoremap <Leader>v "+p
|
||||
|
||||
nnoremap <Leader>r :registers <CR>
|
||||
" nnoremap <F8> :TagbarToggle <CR>
|
||||
nnoremap <silent> <Leader>r :registers <CR>
|
||||
nnoremap <F8> :Tags <CR>
|
||||
nnoremap <silent> <Leader>z :call ZenToggle() <CR>
|
||||
nnoremap <silent> <Leader>o :LspTroubleToggle <CR>
|
||||
|
||||
" Use <Tab> and <S-Tab> to navigate through popup menu
|
||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
imap <tab> <Plug>(completion_smart_tab)
|
||||
imap <s-tab> <Plug>(completion_smart_s_tab)
|
||||
|
||||
" Set completeopt to have a better completion experience
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
|
||||
" Avoid showing message extra message when using completion
|
||||
set shortmess+=c
|
||||
|
||||
" Keymaps for lspconfig
|
||||
|
||||
" nnoremap gD :lua vim.lsp.buf.declaration()<CR>
|
||||
" nnoremap <Leader>q, <cmd>lua vim.lsp.diagnostic.set_loclist()<CR>
|
||||
|
||||
nnoremap <silent> gd :lua vim.lsp.buf.definition()<CR>
|
||||
nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>, opts)
|
||||
nnoremap <silent> gi :lua vim.lsp.buf.implementation() <CR>
|
||||
nnoremap <silent> <C-k> :lua vim.lsp.buf.signature_help()<CR>
|
||||
|
||||
nnoremap <silent> <Leader>wa :lua vim.lsp.buf.add_workspace_folder()<CR>
|
||||
nnoremap <silent> <Leader>wr :lua vim.lsp.buf.remove_workspace_folder()<CR>
|
||||
nnoremap <silent> <Leader>wl :lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>
|
||||
|
||||
nnoremap <silent> <Leader>D :lua vim.lsp.buf.type_definition()<CR>
|
||||
nnoremap <silent> <Leader>rn :lua vim.lsp.buf.rename()<CR>
|
||||
nnoremap <silent> <Leader>ca :lua vim.lsp.buf.code_action()<CR>
|
||||
nnoremap <silent> gr :lua vim.lsp.buf.references()<CR>, opts)
|
||||
nnoremap <silent> <Leader>e :lua vim.lsp.diagnostic.show_line_diagnostics()<CR>
|
||||
nnoremap <silent> [d :lua vim.lsp.diagnostic.goto_prev()<CR>, opts)
|
||||
nnoremap <silent> ]d :lua vim.lsp.diagnostic.goto_next()<CR>, opts)
|
||||
|
||||
|
||||
|
||||
|
||||
" Vim hardmode
|
||||
@@ -84,9 +155,8 @@ nnoremap <down> <nop>
|
||||
nnoremap <left> <nop>
|
||||
nnoremap <right> <nop>
|
||||
|
||||
" Undo
|
||||
set undodir=~/.cache/nvim/nvimdid
|
||||
set undofile
|
||||
" nnoremap <C-k> <C-]>
|
||||
" nnoremap <C-l> <C-t>
|
||||
|
||||
" Disable help on F1
|
||||
nnoremap <F1> <ESC>
|
||||
@@ -98,72 +168,49 @@ let g:gutentags_generate_on_new = 1
|
||||
let g:gutentags_generate_on_missing = 1
|
||||
let g:gutentags_generate_on_write = 1
|
||||
let g:gutentags_generate_on_empty_buffer = 0
|
||||
nnoremap <C-k> <C-]>
|
||||
nnoremap <C-l> <C-t>
|
||||
|
||||
" Markdown Preview
|
||||
let g:mkdp_auto_start = 1
|
||||
" let g:mkdp_auto_start = 1
|
||||
let g:mkdp_filetypes = ['markdown']
|
||||
|
||||
|
||||
" Numbers and tabs
|
||||
set noshowmode
|
||||
set showtabline=2
|
||||
setlocal number relativenumber
|
||||
set autoindent
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set signcolumn=yes
|
||||
set hidden
|
||||
set ignorecase
|
||||
set smartcase
|
||||
" set foldmethod=indent
|
||||
"set cmdheight=2
|
||||
|
||||
nnoremap <F2> :set number! relativenumber! <CR>
|
||||
|
||||
let g:indentLine_char = '▏'
|
||||
let g:indentLine_concealcursor = 'inc'
|
||||
let g:indentLine_conceallevel = 2
|
||||
|
||||
"A few more remaps
|
||||
nnoremap <C-s> :source ~/.config/nvim/init.vim <CR>
|
||||
nnoremap <Leader>m :call Mpcfzf() <CR>
|
||||
nnoremap <silent> <C-s> :source ~/.config/nvim/init.vim <CR>
|
||||
nnoremap <silent> <Leader>m :call Mpcfzf() <CR>
|
||||
|
||||
" Intellisense
|
||||
|
||||
" COC
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
" other plugin before putting this into your config.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
inoremap <expr><CR> pumvisible() ? "\<C-y>" : "\<CR>"
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
nnoremap <Leader>l :CocCommand <CR>
|
||||
" inoremap <silent><expr> <TAB>
|
||||
" \ pumvisible() ? "\<C-n>" :
|
||||
" \ <SID>check_back_space() ? "\<TAB>" :
|
||||
" \ coc#refresh()
|
||||
" inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
" inoremap <expr><CR> pumvisible() ? "\<C-y>" : "\<CR>"
|
||||
" inoremap <silent><expr> <c-space> coc#refresh()
|
||||
" nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
" nnoremap <Leader>l :CocCommand <CR>
|
||||
|
||||
|
||||
" Clipboard
|
||||
" set clipboard=unnamedplus
|
||||
" let g:clipboard = {
|
||||
" \'name': 'PrimaryClipboard',
|
||||
" \'copy': {
|
||||
" \ '+': 'xclip -selection clipboard',
|
||||
" \ '*': 'xclip -selection clipboard',
|
||||
" \ },
|
||||
" \'paste': {
|
||||
" \ '+': 'xclip -selection clipboard -out',
|
||||
" \ '*': 'xclip -selection clipboard -out',
|
||||
" \ },
|
||||
" \'cache_enabled': 1,
|
||||
" \}
|
||||
augroup AutoSaveGroup
|
||||
autocmd!
|
||||
" view files are about 500 bytes
|
||||
" bufleave but not bufwinleave captures closing 2nd tab
|
||||
" nested is needed by bufwrite* (if triggered via other autocmd)
|
||||
" BufHidden for for compatibility with `set hidden`
|
||||
autocmd BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested silent! mkview!
|
||||
autocmd BufWinEnter ?* silent! loadview
|
||||
augroup end
|
||||
|
||||
" Comment no file types with #
|
||||
autocmd BufNewFile,BufRead * if empty(&filetype) | setlocal commentstring=#\ %s | endif
|
||||
" autocmd BufRead urls set commentstring=#\ %s
|
||||
" set commentstring=#\ %s
|
||||
|
||||
augroup linenumbers
|
||||
autocmd WinLeave * :setlocal nonumber norelativenumber
|
||||
autocmd WinEnter * :setlocal number relativenumber
|
||||
augroup END
|
||||
|
||||
" Do not edit readonly buffers
|
||||
autocmd BufRead *.orig set readonly
|
||||
@@ -176,8 +223,6 @@ let g:netrw_fastbrowse = 0
|
||||
" Toggle crates plugin on opening cargo.toml file
|
||||
autocmd BufRead Cargo.toml call crates#toggle()
|
||||
|
||||
" Lspkind-nvim
|
||||
lua require'lspkind'.init()
|
||||
|
||||
" Set python global file
|
||||
let g:python3_host_prog = "/usr/bin/python"
|
||||
@@ -185,79 +230,65 @@ let g:python3_host_prog = "/usr/bin/python"
|
||||
let g:asmsyntax = 'nasm'
|
||||
" set nodejs global prog
|
||||
" let g:node_host_prog = "/usr/bin/neovim-node-host"
|
||||
" Themeing
|
||||
" set t_Co=256
|
||||
syntax on
|
||||
colorscheme minimalist
|
||||
" let g:dracula_colorterm = 0
|
||||
" colorscheme dracula
|
||||
|
||||
highlight link Crates WarningMsg
|
||||
" colorscheme nord
|
||||
" Themeing
|
||||
syntax on
|
||||
let g:sonokai_style = "default"
|
||||
let g:sonokai_transparent_background = 1
|
||||
colorscheme sonokai
|
||||
|
||||
hi link Crates WarningMsg
|
||||
|
||||
if exists('+termguicolors')
|
||||
let &t_8f="\<Esc>[38;2;%lu;%lu;%lum"
|
||||
let &t_8b="\<Esc>[48;2;%lu;%lu;%lum"
|
||||
endif
|
||||
" set termguicolors
|
||||
|
||||
|
||||
" Airline
|
||||
let g:airline_theme='dracula'
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
" let g:airline_statusline_ontop = 1
|
||||
|
||||
" " Tmuxline
|
||||
" let g:tmuxline_preset = {
|
||||
" \'a' : '#S',
|
||||
" \'b' : '#W',
|
||||
" \'c' : '#H',
|
||||
" \'win' : '#I #W',
|
||||
" \'cwin' : '#I #W',
|
||||
" \'x' : '%a',
|
||||
" \'y' : '#W %R',
|
||||
" \'z' : '#H'}
|
||||
|
||||
" Lightline
|
||||
" let g:lightline = {}
|
||||
" let g:lightline.colorscheme = 'darcula'
|
||||
" " let g:lightline.colorscheme = 'wombat'
|
||||
" let g:lightline.active = {}
|
||||
" let g:lightline.active.left = [['mode', 'paste'] ,['readonly', 'filename', 'modified']]
|
||||
" let g:lightline.active.right = [['lineinfo'], ['percent'], ['fileformat', 'fileencoding', 'filetype', 'charvaluehex']]
|
||||
" let g:lightline.separator = { 'left': "\ue0b8", 'right': "\ue0ba" }
|
||||
" let g:lightline.subseparator = { 'left': "\ue0b9", 'right': "\ue0bb" }
|
||||
|
||||
" let g:lightline.tabline = {}
|
||||
" let g:lightline.tabline.left = [['buffers']]
|
||||
" let g:lightline.tabline.right = [['close'], ['gitbranch']]
|
||||
" let g:lightline.tabline_separator = { 'left': "\ue0bc", 'right': "\ue0be" }
|
||||
" let g:lightline.tabline_subseparator = { 'left': "\ue0bd", 'right': "\ue0bf" }
|
||||
|
||||
" let g:lightline.component_function = { 'song': 'CurrentSong', 'gitbranch': 'FugitiveHead' }
|
||||
" let g:lightline.component_expand = {'buffers': 'lightline#bufferline#buffers'}
|
||||
" let g:lightline.component_type = {'buffers': 'tabsel'}
|
||||
let &t_Cs = "\e[4:3m"
|
||||
let &t_Ce = "\e[4:0m"
|
||||
|
||||
" Rust
|
||||
" let g:rustfmt_autosave = 1
|
||||
let g:rustfmt_autosave = 1
|
||||
|
||||
nnoremap <silent> <leader>da :call <SID>AppendBreakPoint()<CR>
|
||||
nnoremap <silent> <leader>dc :call <SID>ClearBreakpoints()<CR>
|
||||
nnoremap <silent> <leader>dr :call <SID>DebugRun()<CR>
|
||||
|
||||
function! s:AppendBreakPoint()
|
||||
let s:breakpoint = "break ".expand('%').":".line('.')
|
||||
call writefile([s:breakpoint], "./target/breakpoints", "a")
|
||||
echom "Added breakpoint at line ".line('.')
|
||||
endfunction
|
||||
|
||||
function! s:ClearBreakpoints()
|
||||
call delete("./target/breakpoints")
|
||||
echom "Cleared breakpoints"
|
||||
endfunction
|
||||
|
||||
function! s:DebugRun()
|
||||
execute "!cargo build"
|
||||
let s:dirlist = split(getcwd(),'/')
|
||||
let s:projectname = s:dirlist[len(s:dirlist)-1]
|
||||
" let s:projectname = system('sed -n "s/^name Cargo.toml ')
|
||||
let s:executable = getcwd()."/target/debug/".s:projectname
|
||||
silent execute "!alacritty -e rust-gdb -x ./target/breakpoints ".s:executable." &"
|
||||
endfunction
|
||||
|
||||
"##################################################
|
||||
"# Functions
|
||||
"##################################################
|
||||
" COC.nvim
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
" function! s:check_back_space() abort
|
||||
" let col = col('.') - 1
|
||||
" return !col || getline('.')[col - 1] =~# '\s'
|
||||
" endfunction
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
" function! s:show_documentation()
|
||||
" if (index(['vim','help'], &filetype) >= 0)
|
||||
" execute 'h '.expand('<cword>')
|
||||
" else
|
||||
" call CocAction('doHover')
|
||||
" endif
|
||||
" endfunction
|
||||
|
||||
" Mpc
|
||||
function Mpcfzf()
|
||||
@@ -269,3 +300,61 @@ function CurrentSong()
|
||||
return s
|
||||
endfunction
|
||||
|
||||
let t:zen = 1
|
||||
let t:fullscreen = 1
|
||||
let t:tmux = 1
|
||||
function! ZenToggle()
|
||||
if t:zen == 0
|
||||
hi Normal guibg=NONE ctermbg=NONE
|
||||
hi NonText guibg=NONE ctermbg=NONE
|
||||
TZMinimalistT
|
||||
if t:tmux == 1
|
||||
silent! !tmux set -g status on
|
||||
endif
|
||||
if t:fullscreen == 1
|
||||
silent! !bspc node focused -f -t tiled
|
||||
endif
|
||||
let t:zen = 1
|
||||
else
|
||||
hi Normal ctermfg=255 ctermbg=234 cterm=NONE guifg=#EEEEEE guibg=#1C1C1C gui=NONE
|
||||
hi NonText ctermfg=234 ctermbg=234 cterm=NONE guifg=#1C1C1C guibg=#1C1C1C gui=NONE
|
||||
TZMinimalistF
|
||||
if t:tmux == 1
|
||||
silent! !tmux set -g status off
|
||||
endif
|
||||
if t:fullscreen == 1
|
||||
silent! !bspc node focused -f -t fullscreen
|
||||
endif
|
||||
let t:zen = 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" ########################################
|
||||
" # LUA
|
||||
" ########################################
|
||||
|
||||
|
||||
" Which key
|
||||
lua << EOF
|
||||
require("which-key").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
}
|
||||
-- Lspkind-nvim
|
||||
require'lspkind'.init()
|
||||
|
||||
-- Colorizer
|
||||
require'colorizer'.setup()
|
||||
|
||||
-- lsp trouble
|
||||
require("trouble").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
}
|
||||
require("lsp");
|
||||
require("scripts.status-line");
|
||||
-- require("scripts.eviline");
|
||||
require("scripts.truezen");
|
||||
EOF
|
||||
|
||||
@@ -18,7 +18,9 @@ run -b '~/.config/tmux/plugins/tpm/tpm'
|
||||
|
||||
set -g default-terminal 'tmux-256color'
|
||||
set -ga terminal-overrides ',*256col*:Tc'
|
||||
set-option -sa terminal-overrides ',alacritty:RGB'
|
||||
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
|
||||
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
|
||||
# set-option -sa terminal-overrides ',alacritty:RGB'
|
||||
set-option -g focus-events on
|
||||
set-option -sg escape-time 10
|
||||
set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.config/tmux/plugins'
|
||||
|
||||
59
local/bin/news
Executable file
59
local/bin/news
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PID=$$
|
||||
export ID=$PID
|
||||
DIR=/tmp/ueberzug_$PID
|
||||
export UFIFO=$DIR/ufifo
|
||||
# MAX_COLUMNS=60
|
||||
IMAGE=$1
|
||||
|
||||
function cleanup {
|
||||
# remove_image
|
||||
stop_ueberzug
|
||||
if [ -d "$DIR" ];then
|
||||
rm -r $DIR
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
if [ ! -d "$DIR" ];then
|
||||
mkdir $DIR
|
||||
fi
|
||||
|
||||
source $(ueberzug library)
|
||||
|
||||
function start_ueberzug {
|
||||
mkfifo $UFIFO
|
||||
ImageLayer --silent <"$UFIFO" &
|
||||
exec 3>"$UFIFO"
|
||||
}
|
||||
|
||||
function stop_ueberzug {
|
||||
exec 3>&-
|
||||
rm $UFIFO &> /dev/null
|
||||
}
|
||||
|
||||
# function set_image {
|
||||
# x_size=$(tput cols)
|
||||
# y_size=$(tput lines)
|
||||
# MAX_COLUMNS=$(($x_size/5))
|
||||
# x=$(($x_size-$MAX_COLUMNS-5))
|
||||
# y=$(($y_size-5))
|
||||
# echo $x $y
|
||||
# ImageLayer::add [identifier]="$ID" [x]="${x}" [y]="${y}" \
|
||||
# [max_width]="${MAX_COLUMNS}" \
|
||||
# [path]="$@" \
|
||||
# >"$UFIFO"
|
||||
# }
|
||||
|
||||
# function remove_image {
|
||||
# ImageLayer::remove [identifier]="$ID" \
|
||||
# >"$UFIFO"
|
||||
# }
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
start_ueberzug
|
||||
newsboat
|
||||
cleanup
|
||||
53
local/bin/newspager
Executable file
53
local/bin/newspager
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -p "$UFIFO" ];then
|
||||
printf 'UFIFO not set\n'
|
||||
exit
|
||||
fi
|
||||
|
||||
# echo $ID
|
||||
source $(ueberzug library)
|
||||
function set_image {
|
||||
x_size=$(tput cols)
|
||||
y_size=$(tput lines)
|
||||
MAX_COLUMNS=$(($x_size * 3 / 10 ))
|
||||
# MAX_COLUMNS=100
|
||||
x=$(($x_size-$MAX_COLUMNS-5))
|
||||
y=$(($y_size/2))
|
||||
ImageLayer::add [identifier]="$ID" [x]="${x}" [y]="${y}" \
|
||||
[max_width]="${MAX_COLUMNS}" \
|
||||
[path]="$@" \
|
||||
>"$UFIFO"
|
||||
}
|
||||
function remove_image {
|
||||
ImageLayer::remove [identifier]="$ID" \
|
||||
>"$UFIFO"
|
||||
}
|
||||
|
||||
IMG_URL=$(cat $@ | grep image | awk 'NR==2 {print $2}')
|
||||
LINK=$(cat $@ | grep ^Link: | head -1 | cut -d: -f2-)
|
||||
# echo $LINK
|
||||
# non posix
|
||||
# if [[ "$LINK" =~ "https://www.youtube.com/.*" ]];then
|
||||
|
||||
(
|
||||
if [[ "$LINK" =~ "www.youtube.com" ]];then
|
||||
# extract video id.
|
||||
VIDEO_ID=$(echo $LINK | cut -d= -f2)
|
||||
IMG_URL="https://img.youtube.com/vi/$VIDEO_ID/hqdefault.jpg"
|
||||
# youtube-dl --write-thumbnail --skip-download $LINK --output /tmp/temp &> /dev/null
|
||||
fi
|
||||
if [ -n "$IMG_URL" ];then
|
||||
curl -o /tmp/temp $IMG_URL &>/dev/null
|
||||
fi
|
||||
|
||||
if [ -f "/tmp/temp" ];then
|
||||
set_image /tmp/temp
|
||||
fi
|
||||
) &
|
||||
|
||||
nvim -R -c 'set ft=mail nomod noma nolist' -c 'nnoremap q :qa! <CR>' $@
|
||||
remove_image
|
||||
if [ -f /tmp/temp ];then
|
||||
rm /tmp/temp
|
||||
fi
|
||||
Reference in New Issue
Block a user