Browse Source

Clean up more code

pull/14/head
Ptrzl 3 years ago
parent
commit
bbf67fbfdc
  1. 69
      lua/configs/autocomplete.lua
  2. 126
      lua/configs/filetree.lua
  3. 16
      lua/configs/treesitter.lua

69
lua/configs/autocomplete.lua

@ -14,71 +14,50 @@ function M.config()
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
mapping = {
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
mapping = { -- TODO: do these mappings
['<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.
--[''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
--[''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
--[''] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
--[''] = cmp.mapping({
-- i = cmp.mapping.abort(),
-- c = cmp.mapping.close(),
--}),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
{ name = 'luasnip' },
-- { name = 'nvim_lsp' },
-- { name = 'ultisnips' },
-- { name = 'snippy' },
}, {{ name = 'buffer' }})
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
-- completion for status line commands (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
sources = {
{ name = 'buffer' }
}
})
-- 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' }
})
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- nvim-lspconfig config
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'ccls' }
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
flags = {
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
-- This will be the default in neovim 0.7+
debounce_text_changes = 150,
}
}
end
-- C-CPP-Modern config
vim.g.cpp_function_highlight = 1
vim.g.cpp_attributes_highlight = 1
vim.g.cpp_member_highlight = 1
vim.g.cpp_simple_highlight = 1
end
return M

126
lua/configs/filetree.lua

@ -2,73 +2,73 @@ local M = {}
function M.config()
-- nvim-tree config
require'nvim-tree'.setup {
disable_netrw = true,
hijack_netrw = true,
open_on_setup = true,
ignore_ft_on_setup = {},
auto_close = false,
auto_reload_on_write = true,
open_on_tab = false,
hijack_cursor = false,
update_cwd = false,
update_to_buf_dir = {
enable = true,
auto_open = true,
},
diagnostics = {
enable = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
filters = {
dotfiles = true,
custom = {}
},
git = {
enable = true,
ignore = true,
timeout = 500,
},
view = {
width = 30,
height = 30,
hide_root_folder = false,
side = 'left',
auto_resize = false,
mappings = {
custom_only = false,
list = {}
disable_netrw = true,
hijack_netrw = true,
open_on_setup = true,
ignore_ft_on_setup = {},
auto_close = false,
auto_reload_on_write = true,
open_on_tab = false,
hijack_cursor = false,
update_cwd = false,
update_to_buf_dir = {
enable = true,
auto_open = true,
},
diagnostics = {
enable = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
number = false,
relativenumber = false,
signcolumn = "yes"
},
trash = {
cmd = "trash",
require_confirm = true
},
actions = {
change_dir = {
global = false,
filters = {
dotfiles = true,
custom = {}
},
open_file = {
quit_on_open = false,
git = {
enable = true,
ignore = true,
timeout = 500,
},
view = {
width = 30,
height = 30,
hide_root_folder = false,
side = 'left',
auto_resize = true,
mappings = {
custom_only = false,
list = {}
},
number = false,
relativenumber = false,
signcolumn = "yes"
},
trash = {
cmd = "trash",
require_confirm = true
},
actions = {
change_dir = {
global = false,
},
open_file = {
quit_on_open = false,
}
}
}
}
vim.cmd([[
let g:nvim_tree_icons = {
\ 'default': '',

16
lua/configs/treesitter.lua

@ -2,14 +2,14 @@ local M = {}
function M.config()
-- nvim-treesitter config
require'nvim-treesitter.configs'.setup {
-- ensure_installed = "maintained", -- for installing all maintained parsers
ensure_installed = { "c", "cpp", "rust", "lua" }, -- for installing specific parsers
sync_install = true, -- install synchronously
ignore_install = { }, -- parsers to not install
highlight = {
enable = true,
additional_vim_regex_highlighting = false, -- disable standard vim highlighting
},
-- ensure_installed = "maintained", -- for installing all maintained parsers
ensure_installed = { "c", "cpp", "rust", "lua" }, -- for installing specific parsers
sync_install = true, -- install synchronously
ignore_install = { }, -- parsers to not install
highlight = {
enable = true,
additional_vim_regex_highlighting = false, -- disable standard vim highlighting
},
}
end
return M

Loading…
Cancel
Save