mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-30 12:30:43 +00:00
Rename plugins.d/ to pluginconf/
This commit is contained in:
parent
9aeb792628
commit
c5baadf07f
10 changed files with 3 additions and 3 deletions
42
home/.config/nvim/lua/pluginconf/airline.lua
Normal file
42
home/.config/nvim/lua/pluginconf/airline.lua
Normal file
|
@ -0,0 +1,42 @@
|
|||
local vim = require("vim")
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd[[
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
]]
|
||||
|
||||
-- Airline specific theming settings
|
||||
g.airline_theme = 'codedark' -- Use codedark theme from vim-airline-themes
|
||||
g.airline_right_sep = "" -- Don't use special separators (<)
|
||||
g.airline_left_sep = "" -- Don't use special separators (>)
|
||||
|
||||
-- Tabline setup
|
||||
-- TODO: Figure out how to set # separated variables in lua (open for PRs)
|
||||
cmd[[let g:airline#extensions#tabline#enabled = 1]] -- Enable tabline (top line)
|
||||
cmd[[let g:airline#tabline#formatter = 'unique_tail']] -- Tabline filename formatter
|
||||
|
||||
-- Special symbols
|
||||
g.webdevicons_enable_airline_statusline = 0 -- Use special icons from vim-devicons (requires nerdfonts)
|
||||
g.airline_powerline_fonts = 1 -- Use special symbols from poweline fonts (line no, col no)
|
||||
if not os.getenv("DISPLAY") then -- Use ASCII-only if we're in TTY
|
||||
g.airline_symbols_ascii = 1
|
||||
end
|
||||
|
||||
-- Disable airline in nerdtree buffer
|
||||
-- TODO; For some reason, this fails even though it works in regular vimscript
|
||||
--[[
|
||||
cmd[[
|
||||
augroup filetype_nerdtree
|
||||
au!
|
||||
au FileType nerdtree call s:disable_airline_on_nerdtree()
|
||||
au WinEnter,BufWinEnter,TabEnter * call s:disable_airline_on_nerdtree()
|
||||
augroup END
|
||||
|
||||
fu s:disable_airline_on_nerdtree() abort
|
||||
let nerdtree_winnr = index(map(range(1, winnr('$')), {_,v -> getbufvar(winbufnr(v), '&ft')}), 'nerdtree') + 1
|
||||
call timer_start(0, {-> nerdtree_winnr && setwinvar(nerdtree_winnr, '&stl', '%#Normal#')})
|
||||
endfu
|
||||
]]
|
||||
--]]
|
102
home/.config/nvim/lua/pluginconf/coc.vim
Normal file
102
home/.config/nvim/lua/pluginconf/coc.vim
Normal file
|
@ -0,0 +1,102 @@
|
|||
" Converting these settings into lua isn't easy since we utilize
|
||||
" <SID> which needs to be in a vim script context, making it impossible
|
||||
" to replicate with simple vim.cmd call. It also contains a lot of function
|
||||
" definitions taken from the coc github page without provided lua alternatives
|
||||
" this makes it quite complicated to replicate this in pure lua,
|
||||
" however if anyone knows how to completely reproduce everything here in lua,
|
||||
" this is open to pull requests
|
||||
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'antoinemadec/coc-fzf'
|
||||
|
||||
let g:coc_global_extensions = [
|
||||
\ 'coc-pyright', 'coc-json', 'coc-git', 'coc-html', 'coc-css',
|
||||
\ 'coc-clangd', 'coc-cmake', 'coc-java', 'coc-sh', 'coc-toml',
|
||||
\ 'coc-yaml', 'coc-omnisharp', 'coc-markdownlint', 'coc-pairs',
|
||||
\ 'coc-lua'
|
||||
\ ]
|
||||
|
||||
nmap <leader>l :CocFzfList<cr>
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
|
||||
" Coc only does snippet and additional edit on confirm.
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
" Or use `complete_info` if your vim support it, like:
|
||||
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Remap keys for gotos
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Remap for format selected region
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
augroup CocGroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap for do codeAction of current line
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Fix autofix problem of current line
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Create mappings for function text object, requires document symbols feature of languageserver.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
|
||||
" Use `:Format` to format current buffer
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Use `:Fold` to fold current buffer
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" use `:OR` for organize import of current buffer
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add status line support, for integration with other plugin, checkout `:h coc-status`
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
9
home/.config/nvim/lua/pluginconf/commentary.lua
Normal file
9
home/.config/nvim/lua/pluginconf/commentary.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd[[Plug 'tpope/vim-commentary']]
|
||||
|
||||
Keymap("n", "<A-/>", ":Commentary<CR>")
|
||||
Keymap("v", "<A-/>", ":Commentary<CR>")
|
||||
|
||||
cmd[[autocmd FileType apache setlocal commentstring=#\ %s]]
|
31
home/.config/nvim/lua/pluginconf/deprecated/semshi.lua
Normal file
31
home/.config/nvim/lua/pluginconf/deprecated/semshi.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
local fn = vim.fn
|
||||
|
||||
-- Unused because the extension significantly slows down the opening time for vim.
|
||||
-- Also, while the semantic highlighting in it is neat, for me, it isn't worth in.
|
||||
--
|
||||
-- The extension default colorscheme makes the code look like unicorn vommit.
|
||||
-- I'd prefer a simpler extension that only really distinguishes between classes,
|
||||
-- functions and perhaps unused variables. I don't need to see a different color
|
||||
-- when I access something as an attribute, but it would be neat to see what that
|
||||
-- attribute actually holds, is it a class or a fucntion. But from my searching,
|
||||
-- I wasn't able to find anything like this. This is open to pull requests.
|
||||
cmd[[Plug 'numirias/semshi', { 'do': ':UpdateRemotePlugins' }]]
|
||||
|
||||
if (fn.has("python3")) then
|
||||
fn.system({"pip", "install", "nvim", "--upgrade"})
|
||||
end
|
||||
|
||||
cmd[[
|
||||
function MyCustomHighlights()
|
||||
hi semshiParameter ctermfg=117 guifg=#93CCED
|
||||
hi semshiParameterUnused ctermfg=117 guifg=#5e8193 cterm=underline gui=underline
|
||||
hi semshiBuiltin ctermfg=29 guifg=#48bda5
|
||||
hi semshiAttribute ctermfg=254 guifg=#d1d1d1
|
||||
hi semshiImported ctermfg=214 guifg=#f8c466 cterm=bold gui=bold
|
||||
hi semshiLocal ctermfg=209 guifg=#ff875f
|
||||
endfunction
|
||||
|
||||
autocmd FileType python call MyCustomHighlights()
|
||||
]]
|
39
home/.config/nvim/lua/pluginconf/fzf.lua
Normal file
39
home/.config/nvim/lua/pluginconf/fzf.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
cmd[[Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }]]
|
||||
cmd[[Plug 'junegunn/fzf.vim']]
|
||||
cmd[[Plug 'stsewd/fzf-checkout.vim']]
|
||||
|
||||
g.fzf_layout = {
|
||||
up = '~90%',
|
||||
window = {
|
||||
width = 0.8,
|
||||
height = 0.8,
|
||||
yoffset = 0.5,
|
||||
offset = 0.5
|
||||
}
|
||||
}
|
||||
|
||||
cmd[[let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline']]
|
||||
|
||||
-- Customize the Files command to use ripgrep which respects .gitignore files
|
||||
cmd[[
|
||||
command! -bang -nargs=? -complete=dir Files
|
||||
\ call fzf#run(fzf#wrap('files', fzf#vim#with_preview({ 'dir': <q-args>, 'sink': 'e', 'source': 'rg --files --hidden' }), <bang>0))
|
||||
]]
|
||||
|
||||
-- Add an AllFiles variation that shows ignored files too
|
||||
cmd[[
|
||||
command! -bang -nargs=? -complete=dir AllFiles
|
||||
\ call fzf#run(fzf#wrap('allfiles', fzf#vim#with_preview({ 'dir': <q-args>, 'sink': 'e', 'source': 'rg --files --hidden --no-ignore' }), <bang>0))
|
||||
]]
|
||||
|
||||
Keymap("n", "<leader>f", ":Files<CR>")
|
||||
Keymap("n", "<leader>F", ":AllFiles<CR>")
|
||||
Keymap("n", "<leader>b", ":Buffers<CR>")
|
||||
Keymap("n", "<leader>h", ":History<CR>")
|
||||
Keymap("n", "<leader>r", ":Rg<CR>")
|
||||
Keymap("n", "<leader>R", ":Rg<space>", { silent = false })
|
||||
Keymap("n", "<leader>gb", ":GBranches<CR>")
|
65
home/.config/nvim/lua/pluginconf/nerdtree.lua
Normal file
65
home/.config/nvim/lua/pluginconf/nerdtree.lua
Normal file
|
@ -0,0 +1,65 @@
|
|||
local vim = require("vim")
|
||||
local g = vim.g
|
||||
local fn = vim.fn
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd[[
|
||||
Plug 'preservim/nerdtree'
|
||||
Plug 'Xuyuanp/nerdtree-git-plugin'
|
||||
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
|
||||
]]
|
||||
|
||||
-- Implement manual NERDTreeToggle, but use NERDTreeFind for openning.
|
||||
-- This makes NERDTree open with the current file pre-selected
|
||||
Keymap("n", "<C-n>", "g:NERDTree.IsOpen() ? ':NERDTreeClose<CR>' : @% == '' ? ':NERDTree<CR>' : ':NERDTreeFind<CR>'", {expr=true})
|
||||
|
||||
g.NERDTreeShowHidden = 1
|
||||
g.NERDTreeMinimalUI = 1
|
||||
g.NERDTreeShowLineNumbers = 0
|
||||
g.NERDTreeWinSize = 25
|
||||
|
||||
g.NERDTreeDirArrowExpandable = '►'
|
||||
g.NERDTreeDirArrowCollapsible = '▼'
|
||||
|
||||
-- Disable devicons for nerdtree in TTY
|
||||
if not os.getenv("DISPLAY") then
|
||||
g.webdevicons_enable_nerdtree = 0
|
||||
else
|
||||
g.DevIconsEnableFoldersOpenClose = 1
|
||||
end
|
||||
|
||||
-- If a directory is specified, start NERDTree
|
||||
cmd[[
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
|
||||
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] |
|
||||
\ endif
|
||||
]]
|
||||
|
||||
-- Exit Vim if NERDTree is the only window left.
|
||||
cmd[[
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
|
||||
\ quit | endif
|
||||
]]
|
||||
|
||||
-- If another buffer tries to replace NerdTree, put it in another window, and bring back NerdTree.
|
||||
cmd[[
|
||||
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
|
||||
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
|
||||
]]
|
||||
|
||||
-- Use $NERDTREE_BOOKMARKS environment variable for the location of .NERDTreeBookmarks file
|
||||
local bookmark_loc = os.getenv("NERDTREE_BOOKMARKS")
|
||||
if bookmark_loc then
|
||||
-- Check if file exists (lua doesn't have a built-in function for this)
|
||||
local file_exists = os.rename(bookmark_loc, bookmark_loc) and true or false
|
||||
|
||||
if not file_exists then
|
||||
-- While this is possible with os.execute in lua, we would need to do some hacky
|
||||
-- things to capture output from os.execute and it's simpler to just use vimscript
|
||||
local dir = fn.system("dirname $NERDTREE_BOOKMARKS")
|
||||
fn.system({"mkdir", "-p", dir})
|
||||
fn.system("touch $NERDTREE_BOOKMARKS")
|
||||
end
|
||||
g.NERDTreeBookmarksFile = bookmark_loc
|
||||
end
|
11
home/.config/nvim/lua/pluginconf/polyglot.lua
Normal file
11
home/.config/nvim/lua/pluginconf/polyglot.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
cmd[[Plug 'sheerun/vim-polyglot']]
|
||||
|
||||
-- Disable polyglot's "sensible" settings, while there are some nice things it
|
||||
-- does, I set these manually in my default config and I don't like depending
|
||||
-- on single plugin for so many things, doing it manually doing it manually is
|
||||
-- also more explicit making it obvious what's happening
|
||||
g.polyglot_disabled = {'sensible'}
|
12
home/.config/nvim/lua/pluginconf/vim-code-dark.lua
Normal file
12
home/.config/nvim/lua/pluginconf/vim-code-dark.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd[[Plug 'tomasiser/vim-code-dark']]
|
||||
|
||||
-- Set vim-code-dark as colortheme after plugin loading was finished
|
||||
cmd[[
|
||||
augroup VimCodeDark
|
||||
autocmd!
|
||||
autocmd User PlugLoaded ++nested colorscheme codedark
|
||||
augroup end
|
||||
]]
|
14
home/.config/nvim/lua/pluginconf/vimwiki.lua
Normal file
14
home/.config/nvim/lua/pluginconf/vimwiki.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
cmd[[Plug 'vimwiki/vimwiki']]
|
||||
|
||||
local wiki_conf = {}
|
||||
wiki_conf["path"] = "~/Personal/vimwiki"
|
||||
wiki_conf["path_html"] = "~/Personal/vimwiki-html"
|
||||
wiki_conf["html_template"] = "~/Personal/vimwiki-html/template.tpl"
|
||||
wiki_conf["syntax"] = "markdown"
|
||||
wiki_conf["ext"] = ".md"
|
||||
g.vimwiki_list = {wiki_conf}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue