mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-30 12:30:43 +00:00
Rename pluginconf/ to plugins/settings/
This commit is contained in:
parent
8350dc7926
commit
5627b96fff
11 changed files with 16 additions and 1 deletions
36
home/.config/nvim/lua/plugins/settings/airline.lua
Normal file
36
home/.config/nvim/lua/plugins/settings/airline.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local vim = require("vim")
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Don't use special separators
|
||||
g.airline_right_sep = "" -- (default: <)
|
||||
g.airline_left_sep = "" -- (default: >)
|
||||
|
||||
-- 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
|
||||
]]
|
||||
--]]
|
99
home/.config/nvim/lua/plugins/settings/coc.vim
Normal file
99
home/.config/nvim/lua/plugins/settings/coc.vim
Normal file
|
@ -0,0 +1,99 @@
|
|||
" 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
|
||||
|
||||
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','')}
|
10
home/.config/nvim/lua/plugins/settings/commentary.lua
Normal file
10
home/.config/nvim/lua/plugins/settings/commentary.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local m = require("utility.mappings")
|
||||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Set up shortcuts to quickly comment some code
|
||||
m.keymap("n", "<A-/>", ":Commentary<CR>")
|
||||
m.keymap("v", "<A-/>", ":Commentary<CR>")
|
||||
|
||||
-- Set up comments for unhandled file types
|
||||
cmd[[autocmd FileType apache setlocal commentstring=#\ %s]]
|
31
home/.config/nvim/lua/plugins/settings/deprecated/semshi.lua
Normal file
31
home/.config/nvim/lua/plugins/settings/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.
|
||||
-- Plugin: numirias/semshi
|
||||
|
||||
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()
|
||||
]]
|
36
home/.config/nvim/lua/plugins/settings/fzf.lua
Normal file
36
home/.config/nvim/lua/plugins/settings/fzf.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local m = require("utility.mappings")
|
||||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
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))
|
||||
]]
|
||||
|
||||
m.keymap("n", "<leader>f", ":Files<CR>")
|
||||
m.keymap("n", "<leader>F", ":AllFiles<CR>")
|
||||
m.keymap("n", "<leader>b", ":Buffers<CR>")
|
||||
m.keymap("n", "<leader>h", ":History<CR>")
|
||||
m.keymap("n", "<leader>r", ":Rg<CR>")
|
||||
m.keymap("n", "<leader>R", ":Rg<space>", { silent = false })
|
||||
m.keymap("n", "<leader>gb", ":GBranches<CR>")
|
62
home/.config/nvim/lua/plugins/settings/nerdtree.lua
Normal file
62
home/.config/nvim/lua/plugins/settings/nerdtree.lua
Normal file
|
@ -0,0 +1,62 @@
|
|||
local m = require("utility.mappings")
|
||||
local vim = require("vim")
|
||||
local g = vim.g
|
||||
local fn = vim.fn
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Implement manual NERDTreeToggle, but use NERDTreeFind for openning.
|
||||
-- This makes NERDTree open with the current file pre-selected
|
||||
m.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.
|
||||
-- WARNING: This causes issues when closing buffers
|
||||
--[[
|
||||
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
|
25
home/.config/nvim/lua/plugins/settings/nvim-dap.lua
Normal file
25
home/.config/nvim/lua/plugins/settings/nvim-dap.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local m = require("utility.mappings")
|
||||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Define dap mappings (:help dap-mapping)
|
||||
local prefix = ":lua require('dap')."
|
||||
m.keymap("n", "<F5>", prefix .. "continue()<CR>")
|
||||
m.keymap("n", "<F10>", prefix .. "step_over()<CR>")
|
||||
m.keymap("n", "<F11>", prefix .. "step_into()<CR>")
|
||||
m.keymap("n", "<leader><F11>", prefix .. "step_out()<CR>")
|
||||
m.keymap("n", "<F9>", prefix .. "toggle_breakpoint()<CR>")
|
||||
m.keymap("n", "<leader><F9>", prefix .. "set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>")
|
||||
m.keymap("n", "<F8>", prefix .. "set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>")
|
||||
m.keymap("n", "<leader>di", prefix .. "repl.open()<CR>")
|
||||
m.keymap("n", "<leader>dl", prefix .. "run_last()<CR>")
|
||||
|
||||
-- Setup dap for python (requires nvim-dap-python plugin)
|
||||
require('dap-python').setup('/usr/bin/python') -- Path to python with `debugpy` library installed
|
||||
require('dap-python').test_runner = 'pytest' -- Use pytest to run unit tests
|
||||
|
||||
-- Python mappings
|
||||
local pyprefix = ":lua require('dap-python')."
|
||||
m.keymap("n", "<leader>dptm", pyprefix .. "test_method()<CR>")
|
||||
m.keymap("n", "<leader>dptc", pyprefix .. "test_class()<CR>")
|
||||
m.keymap("v", "<leader>ds", "<ESC>" .. pyprefix .. "debug_selection()<CR>")
|
8
home/.config/nvim/lua/plugins/settings/polyglot.lua
Normal file
8
home/.config/nvim/lua/plugins/settings/polyglot.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local vim = require("vim")
|
||||
local g = vim.g
|
||||
|
||||
-- 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'}
|
4
home/.config/nvim/lua/plugins/settings/vim-code-dark.lua
Normal file
4
home/.config/nvim/lua/plugins/settings/vim-code-dark.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd[[colorscheme codedark]]
|
12
home/.config/nvim/lua/plugins/settings/vimwiki.lua
Normal file
12
home/.config/nvim/lua/plugins/settings/vimwiki.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
local vim = require("vim")
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
|
||||
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