150 lines
4.6 KiB
Lua
150 lines
4.6 KiB
Lua
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
|
|
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
|
|
local g = vim.g -- a table to access global variables
|
|
local opt = vim.opt -- to set options
|
|
local utils = require('utils')
|
|
local packerUtil = require'packer.util'
|
|
|
|
-------------------- EXTERNAL ------------------------------
|
|
require('my_plugins')
|
|
require('my_keymappings')
|
|
require('my_options')
|
|
require("my_autocommands")
|
|
|
|
-- plugins
|
|
require('my_neogen')
|
|
require('my_luasnip')
|
|
-------------------- TREE-SITTER ---------------------------
|
|
require('nvim-treesitter.configs').setup({
|
|
ensure_installed = 'maintained',
|
|
highlight = {
|
|
enable = true
|
|
},
|
|
rainbow = {
|
|
enable = true,
|
|
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
|
max_file_lines = nil, -- Do not enable for files with more than n lines, int
|
|
-- colors = {}, -- table of hex strings
|
|
-- termcolors = {} -- table of colour name strings
|
|
},
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
|
|
-- Automatically jump forward to textobj, similar to targets.vim
|
|
lookahead = true,
|
|
|
|
keymaps = {
|
|
-- You can use the capture groups defined in textobjects.scm
|
|
["af"] = "@function.outer",
|
|
["if"] = "@function.inner",
|
|
["ac"] = "@class.outer",
|
|
["ic"] = "@class.inner",
|
|
},
|
|
},
|
|
lsp_interop = {
|
|
enable = true,
|
|
border = 'none',
|
|
peek_definition_code = {
|
|
["<leader>df"] = "@function.outer",
|
|
["<leader>dF"] = "@class.outer",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
-------------------- GITSIGNS ------------------------------
|
|
require('gitsigns').setup({
|
|
current_line_blame = true,
|
|
current_line_blame_opts = {
|
|
virt_text = true,
|
|
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
|
delay = 1000,
|
|
ignore_whitespace = false,
|
|
},
|
|
})
|
|
-------------------- NVIM-TREE -----------------------------
|
|
require('nvim-tree').setup({
|
|
auto_close = true,
|
|
update_cwd = true,
|
|
update_to_buf_dir = {
|
|
-- enable the feature
|
|
enable = true,
|
|
-- allow to open the tree if it was previously closed
|
|
auto_open = false,
|
|
},
|
|
update_focused_file = {
|
|
enable = true,
|
|
update_cwd = false,
|
|
ignore_list = {}
|
|
},
|
|
diagnostics = {
|
|
enable = true,
|
|
icons = {
|
|
hint = "",
|
|
info = "",
|
|
warning = "",
|
|
error = "",
|
|
}
|
|
},
|
|
})
|
|
utils.map('n', '<leader>tt', '<cmd>NvimTreeToggle<CR>')
|
|
g.nvim_tree_highlight_opened_files = 1
|
|
g.nvim_tree_respect_buf_cwd = 1
|
|
-------------------- COMMENTED -----------------------------
|
|
require('Comment').setup({
|
|
toggler = {
|
|
---line-comment toggle
|
|
line = '<leader>cc',
|
|
},
|
|
opleader = {
|
|
---line-comment opfunc mapping
|
|
line = '<leader>c',
|
|
},
|
|
})
|
|
-------------------- CMAKE ---------------------------------
|
|
-- require('telescope').load_extension('cmake')
|
|
require('cmake').setup({
|
|
parameters_file = 'neovim.json', -- JSON file to store information about selected target, run arguments and build type.
|
|
build_dir = '{cwd}/build_nvim', -- Build directory. The expressions `{cwd}`, `{os}` and `{build_type}` will be expanded with the corresponding text values.
|
|
})
|
|
utils.map('n', '<F5>', ':CMake build<CR>:copen<CR>')
|
|
|
|
-- msbuild errorformat
|
|
opt.errorformat:append("\\ %#%f(%l\\\\\\,%c):\\ %m")
|
|
-- cl.exe errorformat
|
|
-- o.errorformat:append('\ %#%f(%l) : %#%t%[A-z]%# %m')
|
|
|
|
-------------------- LUALINE -------------------------------
|
|
require('lualine').setup {
|
|
options = {theme = 'gruvbox-material'},
|
|
sections = {lualine_c = {'getcwd', {'filename', path = 1, file_status = true}}},
|
|
inactive_sections = {lualine_c = {'getcwd', {'filename', path = 1, file_status = true}}}
|
|
}
|
|
-------------------- PROJECT -------------------------------
|
|
require("project_nvim").setup {
|
|
silent_chdir = true,
|
|
}
|
|
require('telescope').load_extension('projects')
|
|
utils.map('n', '<space>p', '<cmd>Telescope projects<cr>')
|
|
-------------------- AUTOPAIRS -----------------------------
|
|
require('nvim-autopairs').setup{}
|
|
-------------------- FZF NATIVE ----------------------------
|
|
require('telescope').load_extension('fzf')
|
|
-------------------- TERMINAL ------------------------------
|
|
require('nvim-terminal').setup({
|
|
toggle_keymap = '<leader>z',
|
|
})
|
|
-------------------- INDENT-BLANKLINE ----------------------
|
|
opt.listchars:append("eol:↴")
|
|
-- opt.listchars:append("space: ")
|
|
opt.listchars:append("trail: ")
|
|
opt.listchars:append("tab:→ ")
|
|
|
|
require("indent_blankline").setup {
|
|
show_end_of_line = true,
|
|
use_treesitter = true,
|
|
show_current_context = true,
|
|
context_patterns = {'class', 'function', 'method', 'block', '^if', '^for', '^while'},
|
|
}
|
|
|