modernizing my nvim config. uses a lot of lua now, and also
cmp,lspconfig,bufferline
This commit is contained in:
parent
c19a9a5705
commit
a317a0e85f
|
@ -37,9 +37,10 @@ let
|
|||
tasklib
|
||||
pynvim
|
||||
six
|
||||
#pyls-mypy
|
||||
#pyls-isort
|
||||
#pyls-black
|
||||
python-lsp-server
|
||||
pylsp-mypy
|
||||
python-lsp-black
|
||||
pylint
|
||||
# other python packages you want
|
||||
];
|
||||
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
|
||||
|
@ -55,10 +56,9 @@ in
|
|||
python-with-my-packages
|
||||
clojure-lsp
|
||||
rnix-lsp
|
||||
#python3Packages.pynvim
|
||||
#python3Packages.six
|
||||
#python3Packages.tasklib
|
||||
#python3
|
||||
terraform-lsp
|
||||
nodePackages.typescript-lsp-server
|
||||
# Other LSPs
|
||||
( neovim.override {
|
||||
vimAlias = true;
|
||||
withPython3 = true;
|
||||
|
@ -71,38 +71,46 @@ in
|
|||
vim-elixir
|
||||
emmet-vim
|
||||
nerdtree
|
||||
ayu-vim
|
||||
goyo-vim
|
||||
vim-sneak
|
||||
lightline-vim
|
||||
csv-vim
|
||||
vimwiki
|
||||
coc-nvim
|
||||
coc-json
|
||||
ale
|
||||
coc-pyright
|
||||
coc-pairs
|
||||
coc-emmet
|
||||
LanguageClient-neovim
|
||||
ayu-vim
|
||||
rainbow_parentheses-vim
|
||||
vim-surround
|
||||
vim-fugitive
|
||||
vim-signify
|
||||
fzf-checkout-vim
|
||||
#nvim-colorizer
|
||||
bufferline-nvim
|
||||
feline-nvim
|
||||
nvim-webdev-icons
|
||||
vim-devicons
|
||||
# testing
|
||||
#vim-processing
|
||||
#vim-tidal
|
||||
# kitaab stuff
|
||||
vimwiki
|
||||
taskwiki
|
||||
vim-zettel
|
||||
#vimwiki-sync
|
||||
telescope-nvim
|
||||
plenary-nvim
|
||||
# lsp stuff
|
||||
ale
|
||||
black-vim
|
||||
nvim-lspconfig
|
||||
nvim-cmp
|
||||
nvim-cmp-lsp
|
||||
nvim-lsp-ts-utils
|
||||
cmp-conjure
|
||||
cmp-buffer
|
||||
cmp-tabnine
|
||||
lspkind-nvim
|
||||
luasnip
|
||||
cmp_luasnip
|
||||
# git stuff
|
||||
vim-fugitive
|
||||
gitsigns-nvim
|
||||
fzf-checkout-vim
|
||||
# Clojure stuff
|
||||
conjure
|
||||
vim-sexp
|
||||
vim-sexp-mappings-for-regular-people
|
||||
# testing
|
||||
#vim-processing
|
||||
#vim-tidal
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -112,6 +120,7 @@ in
|
|||
set shiftwidth=2
|
||||
set noexpandtab
|
||||
set autoindent
|
||||
set undofile
|
||||
|
||||
" set foldmethod=indent " fold based on indent
|
||||
set number
|
||||
|
@ -143,11 +152,6 @@ in
|
|||
let mapleader = "\<Space>"
|
||||
let maplocalleader = ","
|
||||
|
||||
" lightline colorscheme
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'seoul256',
|
||||
\ }
|
||||
|
||||
" moving splits with vim movements.
|
||||
:tnoremap <A-h> <C-\><C-N><C-w>h
|
||||
:tnoremap <A-j> <C-\><C-N><C-w>j
|
||||
|
@ -171,15 +175,9 @@ in
|
|||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
||||
|
||||
|
||||
" exit normal mode in terminal
|
||||
:tnoremap <C-n> <C-\><C-n>
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_auto_loc_list = 1
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
" Sexp in Conjure (since it's fennel)
|
||||
" let g:sexp_filetypes = [ "fennel" ]
|
||||
|
||||
|
@ -215,6 +213,10 @@ in
|
|||
inoremap <c-k> <esc>:m .-2<CR>==
|
||||
nnoremap <leader>j <esc>:m .+1<CR>==
|
||||
nnoremap <leader>k <esc>:m .-2<CR>==
|
||||
" Pasting
|
||||
:map <leader>sy :!xclip -i<CR><CR>
|
||||
:vmap <leader>sy "*y
|
||||
:map <leader>sp :r!xclip -o<CR>
|
||||
|
||||
" git
|
||||
nmap <leader>gd :SignifyDiff<CR>
|
||||
|
@ -238,13 +240,8 @@ in
|
|||
" fzf
|
||||
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
|
||||
|
||||
|
||||
" ALE + clj-kondo
|
||||
let g:ale_linters = {'clojure': ['clj-kondo']}
|
||||
|
||||
" coc
|
||||
" conjure extension
|
||||
let g:coc_global_extensions = ['coc-conjure']
|
||||
let g:ale_linters = {'clojure': ['clj-kondo'], 'python': ['black', 'pylint']}
|
||||
|
||||
" if hidden is not set, TextEdit might fail.
|
||||
set hidden
|
||||
|
@ -265,129 +262,444 @@ in
|
|||
" always show signcolumns
|
||||
set signcolumn=yes
|
||||
|
||||
" note that if you are using Plug mapping you should not use `noremap` mappings.
|
||||
nmap <F5> <Plug>(lcn-menu)
|
||||
" Or map each action separately
|
||||
nmap <silent>K <Plug>(lcn-hover)
|
||||
nmap <silent> gd <Plug>(lcn-definition)
|
||||
nmap <silent> <F2> <Plug>(lcn-r
|
||||
|
||||
" 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)
|
||||
|
||||
" Use K to show documentation in preview window
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight symbol under cursor on CursorHold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" 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 mygroup
|
||||
" lsp commands
|
||||
nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR>
|
||||
nnoremap <leader>vi :lua vim.lsp.buf.implementation()<CR>
|
||||
nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR>
|
||||
nnoremap <leader>vrr :lua vim.lsp.buf.references()<CR>
|
||||
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
|
||||
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
|
||||
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
|
||||
nnoremap <leader>vsd :lua vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
|
||||
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
|
||||
nnoremap <leader>vll :call LspLocationList()<CR>
|
||||
augroup THE_PRIMEAGEN_LSP
|
||||
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
|
||||
autocmd! BufWrite,BufEnter,InsertLeave * :call LspLocationList()
|
||||
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)
|
||||
"bufferline
|
||||
" These commands will navigate through buffers in order regardless of which mode you are using
|
||||
nnoremap <silent>[b :BufferLineCycleNext<CR>
|
||||
nnoremap <silent>b] :BufferLineCyclePrev<CR>
|
||||
|
||||
" 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)
|
||||
" lua config
|
||||
lua <<EOF
|
||||
-- luasnip
|
||||
M.luasnip = function(override_flag)
|
||||
local present, luasnip = pcall(require, "luasnip")
|
||||
if present then
|
||||
local default = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
}
|
||||
if override_flag then
|
||||
default = require("core.utils").tbl_override_req("luasnip", default)
|
||||
end
|
||||
luasnip.config.set_config(default)
|
||||
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
|
||||
require("luasnip/loaders/from_vscode").load()
|
||||
end
|
||||
end
|
||||
|
||||
" 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)
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local icons = require "plugins.configs.lspkind_icons"
|
||||
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
clojure_lsp = "[CLJ]",
|
||||
buffer = "[BUF]",
|
||||
terraform_lsp = "[TER]",
|
||||
pylsp = "[PY]",
|
||||
rnix-lsp = "[NIX]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
{ name = "nvim_lsp"},
|
||||
{ name = "path" },
|
||||
{ name = 'conjure'},
|
||||
{ name = 'cmp_tabnine'},
|
||||
}
|
||||
})
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
|
||||
nmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-d> <Plug>(coc-range-select)
|
||||
-- Setup lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require('lspconfig')['nvim_lsp', clojure_lsp', 'rnix-lsp', 'pylsp', 'terraform_lsp', 'tsserver'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
" Use `:Format` to format current buffer
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
-- Feline
|
||||
local colors = require 'theme.colors'
|
||||
local lsp = require 'feline.providers.lsp'
|
||||
local vi_mode_utils = require 'feline.providers.vi_mode'
|
||||
local vi_mode_colors = {
|
||||
NORMAL = colors.green,
|
||||
INSERT = colors.red,
|
||||
VISUAL = colors.magenta,
|
||||
OP = colors.green,
|
||||
BLOCK = colors.blue,
|
||||
REPLACE = colors.violet,
|
||||
['V-REPLACE'] = colors.violet,
|
||||
ENTER = colors.cyan,
|
||||
MORE = colors.cyan,
|
||||
SELECT = colors.orange,
|
||||
COMMAND = colors.green,
|
||||
SHELL = colors.green,
|
||||
TERM = colors.green,
|
||||
NONE = colors.yellow
|
||||
}
|
||||
local icons = {
|
||||
linux = ' ',
|
||||
macos = ' ',
|
||||
windows = ' ',
|
||||
errs = ' ',
|
||||
warns = ' ',
|
||||
infos = ' ',
|
||||
hints = ' ',
|
||||
lsp = ' ',
|
||||
git = ''
|
||||
}
|
||||
local function file_osinfo()
|
||||
local os = vim.bo.fileformat:upper()
|
||||
local icon
|
||||
if os == 'UNIX' then
|
||||
icon = icons.linux
|
||||
elseif os == 'MAC' then
|
||||
icon = icons.macos
|
||||
else
|
||||
icon = icons.windows
|
||||
end
|
||||
return icon .. os
|
||||
end
|
||||
local function lsp_diagnostics_info()
|
||||
return {
|
||||
errs = lsp.get_diagnostics_count('Error'),
|
||||
warns = lsp.get_diagnostics_count('Warning'),
|
||||
infos = lsp.get_diagnostics_count('Information'),
|
||||
hints = lsp.get_diagnostics_count('Hint')
|
||||
}
|
||||
end
|
||||
local function diag_enable(f, s)
|
||||
return function()
|
||||
local diag = f()[s]
|
||||
return diag and diag ~= 0
|
||||
end
|
||||
end
|
||||
local function diag_of(f, s)
|
||||
local icon = icons[s]
|
||||
return function()
|
||||
local diag = f()[s]
|
||||
return icon .. diag
|
||||
end
|
||||
end
|
||||
local function vimode_hl()
|
||||
return {
|
||||
name = vi_mode_utils.get_mode_highlight_name(),
|
||||
fg = vi_mode_utils.get_mode_color()
|
||||
}
|
||||
end
|
||||
-- LuaFormatter off
|
||||
local comps = {
|
||||
vi_mode = {
|
||||
left = {
|
||||
provider = '▊',
|
||||
hl = vimode_hl,
|
||||
right_sep = ' '
|
||||
},
|
||||
right = {
|
||||
provider = '▊',
|
||||
hl = vimode_hl,
|
||||
left_sep = ' '
|
||||
}
|
||||
},
|
||||
file = {
|
||||
info = {
|
||||
provider = 'file_info',
|
||||
hl = {
|
||||
fg = colors.blue,
|
||||
style = 'bold'
|
||||
}
|
||||
},
|
||||
encoding = {
|
||||
provider = 'file_encoding',
|
||||
left_sep = ' ',
|
||||
hl = {
|
||||
fg = colors.violet,
|
||||
style = 'bold'
|
||||
}
|
||||
},
|
||||
type = {
|
||||
provider = 'file_type'
|
||||
},
|
||||
os = {
|
||||
provider = file_osinfo,
|
||||
left_sep = ' ',
|
||||
hl = {
|
||||
fg = colors.violet,
|
||||
style = 'bold'
|
||||
}
|
||||
}
|
||||
},
|
||||
line_percentage = {
|
||||
provider = 'line_percentage',
|
||||
left_sep = ' ',
|
||||
hl = {
|
||||
style = 'bold'
|
||||
}
|
||||
},
|
||||
scroll_bar = {
|
||||
provider = 'scroll_bar',
|
||||
left_sep = ' ',
|
||||
hl = {
|
||||
fg = colors.blue,
|
||||
style = 'bold'
|
||||
}
|
||||
},
|
||||
diagnos = {
|
||||
err = {
|
||||
provider = diag_of(lsp_diagnostics_info, 'errs'),
|
||||
left_sep = ' ',
|
||||
enabled = diag_enable(lsp_diagnostics_info, 'errs'),
|
||||
hl = {
|
||||
fg = colors.red
|
||||
}
|
||||
},
|
||||
warn = {
|
||||
provider = diag_of(lsp_diagnostics_info, 'warns'),
|
||||
left_sep = ' ',
|
||||
enabled = diag_enable(lsp_diagnostics_info, 'warns'),
|
||||
hl = {
|
||||
fg = colors.yellow
|
||||
}
|
||||
},
|
||||
info = {
|
||||
provider = diag_of(lsp_diagnostics_info, 'infos'),
|
||||
left_sep = ' ',
|
||||
enabled = diag_enable(lsp_diagnostics_info, 'infos'),
|
||||
hl = {
|
||||
fg = colors.blue
|
||||
}
|
||||
},
|
||||
hint = {
|
||||
provider = diag_of(lsp_diagnostics_info, 'hints'),
|
||||
left_sep = ' ',
|
||||
enabled = diag_enable(lsp_diagnostics_info, 'hints'),
|
||||
hl = {
|
||||
fg = colors.cyan
|
||||
}
|
||||
},
|
||||
},
|
||||
lsp = {
|
||||
name = {
|
||||
provider = 'lsp_client_names',
|
||||
left_sep = ' ',
|
||||
icon = icons.lsp,
|
||||
hl = {
|
||||
fg = colors.yellow
|
||||
}
|
||||
}
|
||||
},
|
||||
git = {
|
||||
branch = {
|
||||
provider = 'git_branch',
|
||||
icon = icons.git,
|
||||
left_sep = ' ',
|
||||
hl = {
|
||||
fg = colors.violet,
|
||||
style = 'bold'
|
||||
},
|
||||
},
|
||||
add = {
|
||||
provider = 'git_diff_added',
|
||||
hl = {
|
||||
fg = colors.green
|
||||
}
|
||||
},
|
||||
change = {
|
||||
provider = 'git_diff_changed',
|
||||
hl = {
|
||||
fg = colors.orange
|
||||
}
|
||||
},
|
||||
remove = {
|
||||
provider = 'git_diff_removed',
|
||||
hl = {
|
||||
fg = colors.red
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
local properties = {
|
||||
force_inactive = {
|
||||
filetypes = {
|
||||
'NvimTree',
|
||||
'dbui',
|
||||
'packer',
|
||||
'startify',
|
||||
'fugitive',
|
||||
'fugitiveblame'
|
||||
},
|
||||
buftypes = {'terminal'},
|
||||
bufnames = {}
|
||||
}
|
||||
}
|
||||
local components = {
|
||||
left = {
|
||||
active = {
|
||||
comps.vi_mode.left,
|
||||
comps.file.info,
|
||||
comps.lsp.name,
|
||||
comps.diagnos.err,
|
||||
comps.diagnos.warn,
|
||||
comps.diagnos.hint,
|
||||
comps.diagnos.info
|
||||
},
|
||||
inactive = {
|
||||
comps.vi_mode.left,
|
||||
comps.file.info
|
||||
}
|
||||
},
|
||||
mid = {
|
||||
active = {},
|
||||
inactive = {}
|
||||
},
|
||||
right = {
|
||||
active = {
|
||||
comps.git.add,
|
||||
comps.git.change,
|
||||
comps.git.remove,
|
||||
comps.file.os,
|
||||
comps.git.branch,
|
||||
comps.line_percentage,
|
||||
comps.scroll_bar,
|
||||
comps.vi_mode.right
|
||||
},
|
||||
inactive = {}
|
||||
}
|
||||
}
|
||||
-- LuaFormatter on
|
||||
require'feline'.setup {
|
||||
default_bg = colors.bg,
|
||||
default_fg = colors.fg,
|
||||
components = components,
|
||||
properties = properties,
|
||||
vi_mode_colors = vi_mode_colors
|
||||
}
|
||||
|
||||
" 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',"")}
|
||||
|
||||
" Using CocList
|
||||
" Show all diagnostics
|
||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl
|
||||
|
||||
" TODO Ugly map
|
||||
:map <F7> :!xclip -i<CR><CR>
|
||||
:vmap <F7> "*y
|
||||
:map <S-F7> :r!xclip -o<CR>
|
||||
-- Buffeline
|
||||
require('bufferline').setup {
|
||||
options = {
|
||||
numbers = "ordinal",
|
||||
--- @deprecated, please specify numbers as a function to customize the styling
|
||||
number_style = "superscript",
|
||||
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||
-- NOTE: this plugin is designed with this icon in mind,
|
||||
-- and so changing this is NOT recommended, this is intended
|
||||
-- as an escape hatch for people who cannot bear it for whatever reason
|
||||
indicator_icon = '▎',
|
||||
buffer_close_icon = '',
|
||||
modified_icon = '●',
|
||||
close_icon = '',
|
||||
left_trunc_marker = '',
|
||||
right_trunc_marker = '',
|
||||
--- name_formatter can be used to change the buffer's label in the bufferline.
|
||||
--- Please note some names can/will break the
|
||||
--- bufferline so use this at your discretion knowing that it has
|
||||
--- some limitations that will *NOT* be fixed.
|
||||
name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
|
||||
-- remove extension from markdown files for example
|
||||
if buf.name:match('%.md') then
|
||||
return vim.fn.fnamemodify(buf.name, ':t:r')
|
||||
end
|
||||
end,
|
||||
max_name_length = 18,
|
||||
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
|
||||
tab_size = 18,
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_update_in_insert = false,
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
return "("..count..")"
|
||||
end,
|
||||
-- NOTE: this will be called a lot so don't do any heavy processing here
|
||||
custom_filter = function(buf_number, buf_numbers)
|
||||
-- filter out filetypes you don't want to see
|
||||
if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
|
||||
return true
|
||||
end
|
||||
-- filter out by buffer name
|
||||
if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
|
||||
return true
|
||||
end
|
||||
-- filter out based on arbitrary rules
|
||||
-- e.g. filter out vim wiki buffer from tabline in your work repo
|
||||
if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
|
||||
return true
|
||||
end
|
||||
-- filter out by it's index number in list (don't show first buffer)
|
||||
if buf_numbers[1] ~= buf_number then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
-- offsets = {{filetype = "NvimTree", text = "File Explorer" | function , text_align = "left" | "center" | "right"}},
|
||||
show_buffer_icons = true, -- disable filetype icons for buffers
|
||||
show_buffer_close_icons = false,
|
||||
show_close_icon = false,
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thick",
|
||||
enforce_regular_tabs = true,
|
||||
always_show_bufferline = true,
|
||||
sort_by = 'relative_directory'
|
||||
end
|
||||
}
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue