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
|
tasklib
|
||||||
pynvim
|
pynvim
|
||||||
six
|
six
|
||||||
#pyls-mypy
|
python-lsp-server
|
||||||
#pyls-isort
|
pylsp-mypy
|
||||||
#pyls-black
|
python-lsp-black
|
||||||
|
pylint
|
||||||
# other python packages you want
|
# other python packages you want
|
||||||
];
|
];
|
||||||
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
|
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
|
||||||
|
@ -55,10 +56,9 @@ in
|
||||||
python-with-my-packages
|
python-with-my-packages
|
||||||
clojure-lsp
|
clojure-lsp
|
||||||
rnix-lsp
|
rnix-lsp
|
||||||
#python3Packages.pynvim
|
terraform-lsp
|
||||||
#python3Packages.six
|
nodePackages.typescript-lsp-server
|
||||||
#python3Packages.tasklib
|
# Other LSPs
|
||||||
#python3
|
|
||||||
( neovim.override {
|
( neovim.override {
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
withPython3 = true;
|
withPython3 = true;
|
||||||
|
@ -71,38 +71,46 @@ in
|
||||||
vim-elixir
|
vim-elixir
|
||||||
emmet-vim
|
emmet-vim
|
||||||
nerdtree
|
nerdtree
|
||||||
|
ayu-vim
|
||||||
goyo-vim
|
goyo-vim
|
||||||
vim-sneak
|
vim-sneak
|
||||||
lightline-vim
|
|
||||||
csv-vim
|
csv-vim
|
||||||
vimwiki
|
|
||||||
coc-nvim
|
|
||||||
coc-json
|
|
||||||
ale
|
|
||||||
coc-pyright
|
|
||||||
coc-pairs
|
|
||||||
coc-emmet
|
|
||||||
LanguageClient-neovim
|
|
||||||
ayu-vim
|
|
||||||
rainbow_parentheses-vim
|
rainbow_parentheses-vim
|
||||||
vim-surround
|
vim-surround
|
||||||
vim-fugitive
|
bufferline-nvim
|
||||||
vim-signify
|
feline-nvim
|
||||||
fzf-checkout-vim
|
nvim-webdev-icons
|
||||||
#nvim-colorizer
|
|
||||||
vim-devicons
|
vim-devicons
|
||||||
# testing
|
# kitaab stuff
|
||||||
#vim-processing
|
vimwiki
|
||||||
#vim-tidal
|
|
||||||
taskwiki
|
taskwiki
|
||||||
vim-zettel
|
vim-zettel
|
||||||
#vimwiki-sync
|
|
||||||
telescope-nvim
|
telescope-nvim
|
||||||
plenary-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
|
# Clojure stuff
|
||||||
conjure
|
conjure
|
||||||
vim-sexp
|
vim-sexp
|
||||||
vim-sexp-mappings-for-regular-people
|
vim-sexp-mappings-for-regular-people
|
||||||
|
# testing
|
||||||
|
#vim-processing
|
||||||
|
#vim-tidal
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,6 +120,7 @@ in
|
||||||
set shiftwidth=2
|
set shiftwidth=2
|
||||||
set noexpandtab
|
set noexpandtab
|
||||||
set autoindent
|
set autoindent
|
||||||
|
set undofile
|
||||||
|
|
||||||
" set foldmethod=indent " fold based on indent
|
" set foldmethod=indent " fold based on indent
|
||||||
set number
|
set number
|
||||||
|
@ -143,11 +152,6 @@ in
|
||||||
let mapleader = "\<Space>"
|
let mapleader = "\<Space>"
|
||||||
let maplocalleader = ","
|
let maplocalleader = ","
|
||||||
|
|
||||||
" lightline colorscheme
|
|
||||||
let g:lightline = {
|
|
||||||
\ 'colorscheme': 'seoul256',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
" moving splits with vim movements.
|
" moving splits with vim movements.
|
||||||
:tnoremap <A-h> <C-\><C-N><C-w>h
|
:tnoremap <A-h> <C-\><C-N><C-w>h
|
||||||
:tnoremap <A-j> <C-\><C-N><C-w>j
|
:tnoremap <A-j> <C-\><C-N><C-w>j
|
||||||
|
@ -171,15 +175,9 @@ in
|
||||||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||||
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
||||||
|
|
||||||
|
|
||||||
" exit normal mode in terminal
|
" exit normal mode in terminal
|
||||||
:tnoremap <C-n> <C-\><C-n>
|
: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)
|
" Sexp in Conjure (since it's fennel)
|
||||||
" let g:sexp_filetypes = [ "fennel" ]
|
" let g:sexp_filetypes = [ "fennel" ]
|
||||||
|
|
||||||
|
@ -215,6 +213,10 @@ in
|
||||||
inoremap <c-k> <esc>:m .-2<CR>==
|
inoremap <c-k> <esc>:m .-2<CR>==
|
||||||
nnoremap <leader>j <esc>:m .+1<CR>==
|
nnoremap <leader>j <esc>:m .+1<CR>==
|
||||||
nnoremap <leader>k <esc>:m .-2<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
|
" git
|
||||||
nmap <leader>gd :SignifyDiff<CR>
|
nmap <leader>gd :SignifyDiff<CR>
|
||||||
|
@ -238,13 +240,8 @@ in
|
||||||
" fzf
|
" fzf
|
||||||
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
|
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
|
||||||
|
|
||||||
|
|
||||||
" ALE + clj-kondo
|
" ALE + clj-kondo
|
||||||
let g:ale_linters = {'clojure': ['clj-kondo']}
|
let g:ale_linters = {'clojure': ['clj-kondo'], 'python': ['black', 'pylint']}
|
||||||
|
|
||||||
" coc
|
|
||||||
" conjure extension
|
|
||||||
let g:coc_global_extensions = ['coc-conjure']
|
|
||||||
|
|
||||||
" if hidden is not set, TextEdit might fail.
|
" if hidden is not set, TextEdit might fail.
|
||||||
set hidden
|
set hidden
|
||||||
|
@ -265,129 +262,444 @@ in
|
||||||
" always show signcolumns
|
" always show signcolumns
|
||||||
set signcolumn=yes
|
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.
|
" lsp commands
|
||||||
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR>
|
||||||
inoremap <silent><expr> <TAB>
|
nnoremap <leader>vi :lua vim.lsp.buf.implementation()<CR>
|
||||||
\ pumvisible() ? "\<C-n>" :
|
nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR>
|
||||||
\ <SID>check_back_space() ? "\<TAB>" :
|
nnoremap <leader>vrr :lua vim.lsp.buf.references()<CR>
|
||||||
\ coc#refresh()
|
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
|
||||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
|
||||||
|
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
|
||||||
function! s:check_back_space() abort
|
nnoremap <leader>vsd :lua vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
|
||||||
let col = col('.') - 1
|
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
|
||||||
return !col || getline('.')[col - 1] =~# '\s'
|
nnoremap <leader>vll :call LspLocationList()<CR>
|
||||||
endfunction
|
augroup THE_PRIMEAGEN_LSP
|
||||||
|
|
||||||
" 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
|
|
||||||
autocmd!
|
autocmd!
|
||||||
" Setup formatexpr specified filetype(s).
|
autocmd! BufWrite,BufEnter,InsertLeave * :call LspLocationList()
|
||||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
augroup END
|
||||||
" 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
|
"bufferline
|
||||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
" These commands will navigate through buffers in order regardless of which mode you are using
|
||||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
nnoremap <silent>[b :BufferLineCycleNext<CR>
|
||||||
|
nnoremap <silent>b] :BufferLineCyclePrev<CR>
|
||||||
|
|
||||||
" Remap for do codeAction of current line
|
" lua config
|
||||||
nmap <leader>ac <Plug>(coc-codeaction)
|
lua <<EOF
|
||||||
" Fix autofix problem of current line
|
-- luasnip
|
||||||
nmap <leader>qf <Plug>(coc-fix-current)
|
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.
|
-- Setup nvim-cmp.
|
||||||
xmap if <Plug>(coc-funcobj-i)
|
local cmp = require'cmp'
|
||||||
xmap af <Plug>(coc-funcobj-a)
|
cmp.setup({
|
||||||
omap if <Plug>(coc-funcobj-i)
|
snippet = {
|
||||||
omap af <Plug>(coc-funcobj-a)
|
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
|
-- Setup lspconfig.
|
||||||
nmap <silent> <C-d> <Plug>(coc-range-select)
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
xmap <silent> <C-d> <Plug>(coc-range-select)
|
require('lspconfig')['nvim_lsp', clojure_lsp', 'rnix-lsp', 'pylsp', 'terraform_lsp', 'tsserver'].setup {
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
|
||||||
" Use `:Format` to format current buffer
|
-- Feline
|
||||||
command! -nargs=0 Format :call CocAction('format')
|
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
|
-- Buffeline
|
||||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
require('bufferline').setup {
|
||||||
|
options = {
|
||||||
" use `:OR` for organize import of current buffer
|
numbers = "ordinal",
|
||||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
--- @deprecated, please specify numbers as a function to customize the styling
|
||||||
|
number_style = "superscript",
|
||||||
" Add status line support, for integration with other plugin, checkout `:h coc-status`
|
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||||
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function',"")}
|
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"
|
||||||
" Using CocList
|
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||||
" Show all diagnostics
|
-- NOTE: this plugin is designed with this icon in mind,
|
||||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
-- and so changing this is NOT recommended, this is intended
|
||||||
" Manage extensions
|
-- as an escape hatch for people who cannot bear it for whatever reason
|
||||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
indicator_icon = '▎',
|
||||||
" Show commands
|
buffer_close_icon = '',
|
||||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
modified_icon = '●',
|
||||||
" Find symbol of current document
|
close_icon = '',
|
||||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
left_trunc_marker = '',
|
||||||
" Search workspace symbols
|
right_trunc_marker = '',
|
||||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
--- name_formatter can be used to change the buffer's label in the bufferline.
|
||||||
" Do default action for next item.
|
--- Please note some names can/will break the
|
||||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
--- bufferline so use this at your discretion knowing that it has
|
||||||
" Do default action for previous item.
|
--- some limitations that will *NOT* be fixed.
|
||||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
|
||||||
" Resume latest coc list
|
-- remove extension from markdown files for example
|
||||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
if buf.name:match('%.md') then
|
||||||
|
return vim.fn.fnamemodify(buf.name, ':t:r')
|
||||||
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl
|
end
|
||||||
|
end,
|
||||||
" TODO Ugly map
|
max_name_length = 18,
|
||||||
:map <F7> :!xclip -i<CR><CR>
|
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
|
||||||
:vmap <F7> "*y
|
tab_size = 18,
|
||||||
:map <S-F7> :r!xclip -o<CR>
|
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