You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

203 lines
4.6 KiB
Lua

require("plugins")
local builtin = require('telescope.builtin')
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
local api = vim.api
local g = vim.g
local opt = vim.opt
local keymap = vim.api.nvim_set_keymap
require('lualine').setup {
options = {
icons_enabled = true,
theme= 'palenight',
component_separators = { left = '|', right = '|'},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
},
}
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "rust", "cpp" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { "javascript" },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
local cmp = require("cmp")
cmp.setup {
window = {
completion = cmp.config.window.bordered()
},
mapping = cmp.mapping.preset.insert({
["<CR>"] = cmp.mapping.confirm{ select = false },
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, {"i", "s"}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end)
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "path" }
}, {
{ name = "buffer" },
})
}
cmp.setup.cmdline({"/"}, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" }
}
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" }
}, {
{ name = "cmdline" }
})
})
require('formatter').setup({
filetype = {
cpp = {
function()
return {
exe = "clang-format",
stdin = true
}
end
},
}
})
require("mason").setup {
ensure_installed = {
"clangd", "clang-format",
}
}
local lspconfig = require('lspconfig')
lspconfig.clangd.setup {
on_attach = function(client, bufnr)
client.server_capabilities.signatureHelpProvider = false
on_attach(client,bufnr)
end,
capabilities = capabilities,
}
lspconfig.pyright.setup {}
lspconfig.rust_analyzer.setup {}
require("luasnip.loaders.from_vscode").lazy_load()
require('gitsigns').setup {
signs = {
add = { hl = 'GitGutterAdd', text = '|' },
change = { hl = 'GitGutterChange', text = '|' },
delete = { hl = 'GitGutterDelete', text = '_' },
topdelete = { hl = 'GitGutterDelete', text = '' },
changedelete = { hl = 'GitGutterChange', text = '~' },
},
}
require('Comment').setup()
require("nightfox").setup({
palettes = {
terafox = {
bg1 = "#1A1B1F",
},
},
})
-- vim.cmd("colorscheme terafox")
require('decay').setup({
style = 'dark',
italics = {
code = true,
comments = false -- to disable italic comments, replace to true to enable
},
nvim_tree = {
contrast = true
}
})
-- require('decay').setup({
-- style = 'dark',
-- nvim_tree = {
-- contrast = true -- or false to disable tree contrast,
-- },
-- })
-- vim.cmd("colorscheme decay")
opt.number = true
opt.tabstop = 4
opt.shiftwidth = 4
opt.relativenumber = true
opt.mouse = "a"
opt.ignorecase = true
opt.termguicolors = true
-- opt.showtabline = 2
opt.list = true
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
g.mapleader = " "
g.vimtex_view_method = "zathura"
g.vimtex_compiler_method = "latexmk"
keymap("n", "<leader>f", ":NvimTreeToggle<CR>", {silent = true} )
keymap("n", "<leader>t", ":ToggleTerm<CR>", {silent = true} )
keymap('n', '<leader>y', '"+y', {silent = true})
keymap('n', '<leader>d', '"+d', {silent = true})
keymap('n', '<leader>pp', '"+p', {silent = true})
keymap('n', '<leader>l', ":!zathura <C -r >= expand('%:r')<cr>.pdf &<cr>", {silent = true})
keymap('n', '<leader><Left>', ":BufferLineCyclePrev<CR>", {silent = true})
keymap('n', '<leader><Right>', ":BufferLineCycleNext<CR>", {silent = true})
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<leader>pg', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<leader>e", ui.toggle_quick_menu)
vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.format()]]