147 lines
5.3 KiB
Lua
147 lines
5.3 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 fn = vim.fn
|
|
|
|
-- Auto install packer.nvim if not exists
|
|
local fn = vim.fn
|
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
|
if fn.empty(fn.glob(install_path)) > 0 then
|
|
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
|
vim.cmd 'packadd packer.nvim'
|
|
end
|
|
vim.cmd [[packadd packer.nvim]]
|
|
local utils = require('utils')
|
|
-- Install plugins
|
|
require('plugins')
|
|
require('keymappings')
|
|
-------------------- OPTIONS -------------------------------
|
|
cmd 'colorscheme gruvbox-material' -- Put your favorite colorscheme here
|
|
cmd 'syntax enable'
|
|
cmd 'filetype plugin indent on'
|
|
cmd 'language en_US.utf-8'
|
|
utils.opt('o', 'hlsearch', true)
|
|
utils.opt('o', 'guifont', 'Hack NF:h9')
|
|
utils.opt('o', 'swapfile', false)
|
|
utils.opt('o', 'backup', false)
|
|
utils.opt('o', 'spelllang', 'en,de')
|
|
local indent = 2
|
|
utils.opt('b', 'expandtab', true)
|
|
utils.opt('b', 'shiftwidth', indent)
|
|
utils.opt('b', 'smartindent', true)
|
|
utils.opt('b', 'tabstop', indent)
|
|
utils.opt('o', 'hidden', true)
|
|
utils.opt('o', 'ignorecase', true)
|
|
utils.opt('o', 'scrolloff', 4 )
|
|
utils.opt('o', 'shiftround', true)
|
|
utils.opt('o', 'relativenumber', false)
|
|
utils.opt('o', 'smartcase', true)
|
|
utils.opt('o', 'splitbelow', true)
|
|
utils.opt('o', 'splitright', true)
|
|
utils.opt('o', 'wildmode', 'list:longest')
|
|
utils.opt('w', 'number', true)
|
|
utils.opt('o', 'clipboard', 'unnamed,unnamedplus')
|
|
utils.opt('o', 'mouse', 'a')
|
|
utils.opt('o', 'wrap', false)
|
|
utils.opt('o', 'termguicolors', true)
|
|
utils.opt('o', 'splitbelow', true)
|
|
utils.opt('o', 'splitright', true)
|
|
utils.opt('o', 'list', true)
|
|
utils.opt('o', 'updatetime', 300)
|
|
utils.opt('o', 'wrap', true)
|
|
utils.opt('o', 'showmatch', true)
|
|
|
|
-------------------- AUTOCOMMANDS --------------------------
|
|
require("autocommands")
|
|
-------------------- TREE-SITTER ---------------------------
|
|
local ts = require 'nvim-treesitter.configs'
|
|
ts.setup {ensure_installed = 'maintained', highlight = {enable = true}}
|
|
|
|
-------------------- FZF -----------------------------------
|
|
--utils.map('n', '<C-P>', ':FZF<CR>')
|
|
-------------------- TELESCOPE -----------------------------
|
|
require('my_telescope')
|
|
-------------------- LSP -----------------------------------
|
|
require('mylsp')
|
|
|
|
-------------------- GITSIGNS ------------------------------
|
|
require('gitsigns').setup()
|
|
-------------------- LIGHTBULB -----------------------------
|
|
require('nvim-lightbulb').update_lightbulb()
|
|
vim.cmd [[autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()]]
|
|
-------------------- CMP -----------------------------------
|
|
require('cmp_plug')
|
|
-------------------- 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,
|
|
},
|
|
})
|
|
utils.map('n', '<leader>tt', '<cmd>NvimTreeToggle<CR>')
|
|
g.nvim_tree_highlight_opened_files = 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')
|
|
g.cmake_build_dir = '{cwd}/build_nvim'
|
|
utils.map('n', '<F5>', ':CMake build<CR>:copen<CR>')
|
|
-------------------- NEOCLIP -------------------------------
|
|
require('neoclip').setup({
|
|
default_register = '+',
|
|
})
|
|
require('telescope').load_extension('neoclip')
|
|
-------------------- LUALINE -------------------------------
|
|
require('lualine').setup {
|
|
options = {theme = 'gruvbox'},
|
|
sections = {lualine_c = {'getcwd', 'filename', 'nvim_treesitter#statusline'},
|
|
}
|
|
}
|
|
-------------------- PROJECT -------------------------------
|
|
require("project_nvim").setup {
|
|
silent_chdir = true,
|
|
}
|
|
require('telescope').load_extension('projects')
|
|
utils.map('n', '<space>p', '<cmd>Telescope projects<cr>')
|
|
-------------------- TS-RAINBOW ----------------------------
|
|
require'nvim-treesitter.configs'.setup {
|
|
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
|
|
}
|
|
}
|
|
-------------------- LUASNIP -------------------------------
|
|
require("luasnip.loaders.from_vscode").load()
|
|
-------------------- AUTOPAIRS -----------------------------
|
|
require('nvim-autopairs').setup{}
|
|
require("nvim-autopairs.completion.cmp").setup({
|
|
map_cr = true, -- map <CR> on insert mode
|
|
map_complete = true, -- it will auto insert `(` (map_char) after select function or method item
|
|
auto_select = true, -- automatically select the first item
|
|
insert = false, -- use insert confirm behavior instead of replace
|
|
map_char = { -- modifies the function or method delimiter by filetypes
|
|
all = '(',
|
|
tex = '{'
|
|
}
|
|
})
|
|
-------------------- FZF NATIVE ----------------------------
|
|
require('telescope').load_extension('fzf')
|