diff options
Diffstat (limited to '.config/nvim/lua/user')
| -rw-r--r-- | .config/nvim/lua/user/func.lua | 138 | ||||
| -rw-r--r-- | .config/nvim/lua/user/keys.lua | 6 | ||||
| -rw-r--r-- | .config/nvim/lua/user/mods.lua | 2 | ||||
| -rw-r--r-- | .config/nvim/lua/user/opts.lua | 98 | ||||
| -rw-r--r-- | .config/nvim/lua/user/pack.lua | 16 | ||||
| -rw-r--r-- | .config/nvim/lua/user/view.lua | 68 |
6 files changed, 164 insertions, 164 deletions
diff --git a/.config/nvim/lua/user/func.lua b/.config/nvim/lua/user/func.lua deleted file mode 100644 index c36d9e2..0000000 --- a/.config/nvim/lua/user/func.lua +++ /dev/null @@ -1,138 +0,0 @@ ---vim.cmd([[ --- function RandomColorScheme() --- let mycolors = split(globpath(&rtp,"**/colors/*.vim"),"\n") --- exe 'so ' . mycolors[localtime() % len(mycolors)] --- unlet mycolors --- endfunction --- --- call RandomColorScheme() --- --- :command NewColor call RandomColorScheme() ---]]) - ---vim.cmd([[ --- function RandomColorSchemeMyPicks() --- let mypicks = ["pyte", "fokus", "github", "peachpuff", "morning", "simple256", "xcode", "gruvbox"] --- let mypick = mypicks[localtime() % len(mypicks)] --- echom mypick --- execute 'colo' mypick --- endfunction --- --- command NewColor call RandomColorSchemeMyPicks() --- --- let s:use_gui = exists('g:neovide') || has('gui_running') || (has('termguicolors') && &termguicolors) --- if (s:use_gui) --- call RandomColorSchemeMyPicks() --- endif ---]]) - ---vim.cmd([[ --- let g:fzf_history_dir = '~/.local/share/fzf-history' --- map <leader>z :FZF<CR> --- map <leader>a :Files<CR> --- map <leader>l :Lines<CR> --- map <leader>L :BLines<CR> --- map <leader>B :Buffers<CR> --- map <leader>h :History:<CR> --- nnoremap <leader>g :Rg<CR> --- "nnoremap <leader>t :Tags<CR> --- nnoremap <leader>m :Marks<CR> --- " This is the default extra key bindings --- let g:fzf_action = { --- \ 'ctrl-t': 'tab split', --- \ 'ctrl-x': 'split', --- \ 'ctrl-y': 'vsplit' } --- let g:fzf_tags_command = 'ctags -R' --- " Border color --- let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } } --- let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline' --- let $FZF_DEFAULT_COMMAND="rg --files --hidden" --- " Customize fzf colors to match your color scheme --- let g:fzf_colors = --- \ { 'fg': ['fg', 'Normal'], --- \ 'bg': ['bg', 'Normal'], --- \ 'hl': ['fg', 'Comment'], --- \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], --- \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], --- \ 'hl+': ['fg', 'Statement'], --- \ 'info': ['fg', 'PreProc'], --- \ 'border': ['fg', 'Ignore'], --- \ 'prompt': ['fg', 'Conditional'], --- \ 'pointer': ['fg', 'Exception'], --- \ 'marker': ['fg', 'Keyword'], --- \ 'spinner': ['fg', 'Label'], --- \ 'header': ['fg', 'Comment'] } --- " Get Files --- command! -bang -nargs=? -complete=dir Files --- \ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0) --- " Get text in files with Rg --- command! -bang -nargs=* Rg --- \ call fzf#vim#grep( --- \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1, --- \ fzf#vim#with_preview(), <bang>0) --- " Ripgrep advanced --- function! RipgrepFzf(query, fullscreen) --- let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' --- let initial_command = printf(command_fmt, shellescape(a:query)) --- let reload_command = printf(command_fmt, '{q}') --- let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} --- call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) --- endfunction --- command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0) --- " Git grep --- command! -bang -nargs=* GGrep --- \ call fzf#vim#grep( --- \ 'git grep --line-number '.shellescape(<q-args>), 0, --- \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0) --- command! -bang FM call fzf#run(fzf#wrap({'source': 'cat ~/.fzf-marks | sed "s/.*: \(.*\)$/\1/" | sed "s#~#${HOME}#"', 'sink': 'lcd'}, <bang>0)) ---]]) --- ---vim.cmd([[ --- " Enable mouse scrollback --- set mouse=a --- tnoremap <Esc> <C-\><C-n> --- tnoremap <c-b> <c-\><c-n> --- function! ClearTerminal() --- set scrollback=1 --- let &g:scrollback=1 --- echo &scrollback --- call feedkeys("\i") --- call feedkeys("clear\<CR>") --- call feedkeys("\<C-\>\<C-n>") --- call feedkeys("\i") --- sleep 100m --- let &scrollback=s:scroll_value --- endfunction ---]]) --- ---vim.cmd([[ --- " :Rename {newname} --- function! RenameFile() --- let old_name = expand('%') --- let new_name = input('New file name: ', expand('%'), 'file') --- if new_name != '' && new_name != old_name --- exec ':saveas ' . new_name --- exec ':silent !rm ' . old_name --- redraw! --- endif --- endfunction --- map <leader>re :call RenameFile()<cr> ---]]) - ---vim.cmd([[ --- " Markdown Settings --- autocmd BufNewFile,BufReadPost *.md set filetype=markdown --- let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'sql', 'pug'] --- let g:markdown_minlines = 100 --- let g:instant_markdown_autostart = 0 ---]]) --- ---vim.cmd([[ --- " On The Fly Table mode --- function! s:isAtStartOfLine(mapping) --- let text_before_cursor = getline('.')[0 : col('.')-1] --- let mapping_pattern = '\V' . escape(a:mapping, '\') --- let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') --- return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') --- endfunction ---]]) diff --git a/.config/nvim/lua/user/keys.lua b/.config/nvim/lua/user/keys.lua index ebafd21..d97d86d 100644 --- a/.config/nvim/lua/user/keys.lua +++ b/.config/nvim/lua/user/keys.lua @@ -138,6 +138,9 @@ map('n', '<leader>vt', '<Cmd>call utils#VerboseToggle()<CR>') -- Jump List map('n', '<leader>j', '<Cmd>call utils#GotoJump()<CR>') +-- Rename file +map('n', '<leader>rf', '<Cmd>call utils#RenameFile()<CR>') + -- Map delete to Ctrl+l map('i', '<C-l>', '<Del>') @@ -432,3 +435,6 @@ map('n', '<leader>co', '<CMD>lua require("user.mods").toggleCodi()<CR>') map('n', '<leader>ss', '<CMD>lua require("user.mods").Scratch("float")<CR>') map('n', '<leader>sh', '<CMD>lua require("user.mods").Scratch("horizontal")<CR>') map('n', '<leader>sv', '<CMD>lua require("user.mods").Scratch("vertical")<CR>') + +-- Hardtime +map('n', '<leader>H', ':Hardtime toggle<CR>') diff --git a/.config/nvim/lua/user/mods.lua b/.config/nvim/lua/user/mods.lua index 6420ed5..b6431a6 100644 --- a/.config/nvim/lua/user/mods.lua +++ b/.config/nvim/lua/user/mods.lua @@ -597,10 +597,12 @@ function M.toggleCodi() -- Close Codi vim.cmd('Codi!') is_codi_open = false + print('Codi off') else -- Open Codi vim.cmd('Codi') is_codi_open = true + print('Codi on') end end diff --git a/.config/nvim/lua/user/opts.lua b/.config/nvim/lua/user/opts.lua index c724710..cc8debc 100644 --- a/.config/nvim/lua/user/opts.lua +++ b/.config/nvim/lua/user/opts.lua @@ -18,30 +18,30 @@ vim.opt.clipboard:append({ 'unnamedplus' }) -- Install xclip or this will slowdo -- Behaviour vim.opt.backspace = { 'start', 'eol', 'indent' } -- Make backspace work as you would expect. -vim.opt.hidden = true -- Switch between buffers without having to save first. -vim.opt.splitbelow = true -- make split put the new buffer below the current buffer -vim.opt.splitright = true -- make vsplit put the new buffer on the right of the current buffer -vim.opt.scrolloff = 8 -- -vim.opt.sidescrolloff = 8 -- how many lines to scroll when using the scrollbar -vim.opt.autoread = true -- reload files if changed externally -vim.opt.display = 'lastline' -- Show as much as possible of the last line. -vim.opt.inccommand = 'split' -- -vim.opt.ttyfast = true -- Faster redrawing. -vim.opt.lazyredraw = false -- Only redraw when necessary -vim.opt.keywordprg = ':help' -- :help options -vim.opt.ruler = true -- -vim.opt.errorbells = false -- -vim.opt.list = true -- Show non-printable characters. -vim.opt.showmatch = true -- -vim.opt.matchtime = 3 -- -vim.opt.showbreak = '↪ ' -- -vim.opt.linebreak = true -- -vim.opt.exrc = true -- +vim.opt.hidden = true -- Switch between buffers without having to save first. +vim.opt.splitbelow = true -- make split put the new buffer below the current buffer +vim.opt.splitright = true -- make vsplit put the new buffer on the right of the current buffer +vim.opt.scrolloff = 8 -- +vim.opt.sidescrolloff = 8 -- how many lines to scroll when using the scrollbar +vim.opt.autoread = true -- reload files if changed externally +vim.opt.display = 'lastline' -- Show as much as possible of the last line. +vim.opt.inccommand = 'split' -- +vim.opt.ttyfast = true -- Faster redrawing. +vim.opt.lazyredraw = false -- Only redraw when necessary +vim.opt.keywordprg = ':help' -- :help options +vim.opt.ruler = true -- +vim.opt.errorbells = false -- +vim.opt.list = true -- Show non-printable characters. +vim.opt.showmatch = true -- +vim.opt.matchtime = 3 -- +vim.opt.showbreak = '↪ ' -- +vim.opt.linebreak = true -- +vim.opt.exrc = true -- --vim.opt.autochdir = true -- or use this to use <:e> to create a file in current directory -vim.opt.autoread = true -- if a file is changed outside of vim, automatically reload it without asking +vim.opt.autoread = true -- if a file is changed outside of vim, automatically reload it without asking --vim.opt.notimeout = true -- Timeout on keycodes and not mappings -vim.opt.ttimeout = true -- Makes terminal vim work sanely -vim.opt.ttimeoutlen = 10 -- +vim.opt.ttimeout = true -- Makes terminal vim work sanely +vim.opt.ttimeoutlen = 10 -- --vim.opt.timeoutlen = 100 -- time to wait for a mapped sequence to complete (in milliseconds) --vim.cmd([[set diffopt = vertical = true]]) -- diffs are shown side-by-side not above/below @@ -179,8 +179,8 @@ vim.opt.fillchars = { } vim.opt.listchars = { tab = '▸ ', trail = '·' } -- --vim.opt.fillchars:append({ eob = " " }) -- remove the ~ from end of buffer -vim.opt.modeline = true -- -vim.opt.modelines = 3 -- modelines (comments that set vim options on a per-file basis) +vim.opt.modeline = true -- +vim.opt.modelines = 3 -- modelines (comments that set vim options on a per-file basis) --vim.opt.modelineexpr = true --vim.opt.nofoldenable = true -- turn folding off --vim.opt.foldenable = false -- turn folding off @@ -192,7 +192,7 @@ vim.opt.hlsearch = true -- Keep matches highlighted. vim.opt.ignorecase = true -- ignore case in search patterns UNLESS /C or capital in search vim.opt.smartcase = true -- smart case vim.opt.synmaxcol = 200 -- Only highlight the first 200 columns. -vim.opt.winblend = 30 +--vim.opt.winblend = 30 --vim.opt.winblend = 5 vim.opt.wildoptions = 'pum' -- --vim.opt.pumblend = 5 -- @@ -301,3 +301,51 @@ vim.cmd([[ " Return to the same line when \ endif augroup END ]]) + +-- Enable mouse scrollback +vim.cmd([[ + set mouse=a + tnoremap <Esc> <C-\><C-n> + tnoremap <c-b> <c-\><c-n> + function! ClearTerminal() + set scrollback=1 + let &g:scrollback=1 + echo &scrollback + call feedkeys("\i") + call feedkeys("clear\<CR>") + call feedkeys("\<C-\>\<C-n>") + call feedkeys("\i") + sleep 100m + let &scrollback=s:scroll_value + endfunction +]]) + +-- Yank to clipboard in Termux +if vim.fn.has('termux') == 1 then + local Job = require('plenary.job') + vim.api.nvim_create_autocmd('TextYankPost', { + pattern = '*', + callback = function() + Job:new({ + command = 'termux-clipboard-set', + writer = vim.fn.getreg('@'), + }):start() + end, + }) +end + +function GetTermuxClipboard() + if vim.fn.has('termux') == 1 then + local sysclip = vim.fn.system('termux-clipboard-get') + if sysclip ~= '@' then + vim.fn.setreg('@', sysclip) + end + end + return '' +end + +if vim.fn.has('termux') == 1 then + vim.cmd('autocmd TextYankPost * call GetTermuxClipboard()') + vim.cmd('noremap <expr> p Paste("p")') + vim.cmd('noremap <expr> P Paste("P")') +end diff --git a/.config/nvim/lua/user/pack.lua b/.config/nvim/lua/user/pack.lua index 2f3e1e8..3cd66c0 100644 --- a/.config/nvim/lua/user/pack.lua +++ b/.config/nvim/lua/user/pack.lua @@ -236,6 +236,19 @@ return packer.startup(function(use) }, }, }) + use('kawre/leetcode.nvim') + use({ + 'm4xshen/hardtime.nvim', + config = function() + require('hardtime').setup() + end, + }) + use({ + 'luckasRanarison/nvim-devdocs', + config = function() + require('nvim-devdocs').setup() + end, + }) -- Colorschemes use('bluz71/vim-nightfly-guicolors') @@ -298,6 +311,7 @@ return packer.startup(function(use) }) end, }) + use('MunifTanjim/nui.nvim') use({ 'j-hui/fidget.nvim', tag = 'legacy', @@ -354,7 +368,7 @@ return packer.startup(function(use) run = function() vim.fn['mkdp#util#install']() end, - vim.cmd("let g:mkdp_auto_close = 0"), + vim.cmd('let g:mkdp_auto_close = 0'), }) use({ 'ellisonleao/glow.nvim', -- Markdown Preview diff --git a/.config/nvim/lua/user/view.lua b/.config/nvim/lua/user/view.lua new file mode 100644 index 0000000..50cea8c --- /dev/null +++ b/.config/nvim/lua/user/view.lua @@ -0,0 +1,68 @@ +-- Colorscheme + +-- Colors +vim.opt.termguicolors = true + +-- Available colorschemes: +-- [[ nightfly ayu onedark doom-one nvimgelion github_dark tokyonight ]] + +require('tokyonight').setup({ + style = 'night', + transparent = true, + transparent_sidebar = true, + styles = { + sidebars = 'transparent', + floats = 'transparent', + }, +}) + +-- Define default color scheme +local default_colorscheme = 'tokyonight' +local fallback_colorscheme = 'desert' + +-- Attempt to set the default color scheme +local status_ok, _ = pcall(vim.cmd, 'colorscheme ' .. default_colorscheme) + +-- If the default color scheme is not found, use the fallback color scheme +if not status_ok then + vim.cmd('colorscheme ' .. fallback_colorscheme) +end + +vim.api.nvim_command('syntax on') +vim.api.nvim_command('highlight Normal guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight NormalNC guibg=NONE') +vim.api.nvim_command('highlight NormalFloat guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight Float guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight NonText guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight SignColumn guibg=NONE') +vim.api.nvim_command('highlight FoldColumn guibg=NONE') +vim.api.nvim_command('highlight CursorLineSign guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight Title guibg=NONE gui=bold') +vim.api.nvim_command('highlight TabLine guibg=#333842 gui=bold') +vim.api.nvim_command('highlight TabLineSel guibg=#333842 gui=bold') +vim.api.nvim_command('highlight TabLineFill guibg=NONE gui=bold') +vim.api.nvim_command('highlight WinBar guibg=NONE ctermbg=NONE gui=bold') +vim.api.nvim_command('highlight WinBarNC guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight LineNr guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight WinSeparator guibg=NONE gui=bold ctermbg=NONE') +vim.api.nvim_command('highlight MsgSeparator guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight EndOfBuffer guibg=NONE guifg=Normal') +vim.api.nvim_command('highlight Comment guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight Winblend guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight NormalFloat guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight Pumblend guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight WildMenu guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight WarningMsg guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight Pmenu guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight PmenuSel guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight PmenuThumb guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight PmenuSbar guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight PmenuExtra guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight PmenuExtraSel guibg=NONE ctermbg=NONE') +vim.api.nvim_command('highlight MoreMsg guibg=NONE ctermbg=NONE') + +-- Set different window separator colorscheme +vim.cmd([[ +au WinEnter * setl winhl=WinSeparator:WinSeparatorA +au WinLeave * setl winhl=WinSeparator:WinSeparator +]]) |
