134 lines
3.4 KiB
Lua
134 lines
3.4 KiB
Lua
|
local set = vim.opt
|
||
|
set.modelines=0
|
||
|
set.hidden=true
|
||
|
set.number=true
|
||
|
set.ruler=true
|
||
|
set.visualbell=true
|
||
|
set.textwidth=120
|
||
|
set.cursorline=true
|
||
|
set.tabstop=2
|
||
|
set.shiftwidth=2
|
||
|
set.showmode=true
|
||
|
set.showcmd=true
|
||
|
set.showmatch=true
|
||
|
set.hlsearch=true
|
||
|
set.ignorecase=true
|
||
|
set.smartcase=true
|
||
|
set.incsearch=true
|
||
|
set.wrapscan=true
|
||
|
set.scrolloff=999
|
||
|
set.backspace="indent,eol,start"
|
||
|
set.mouse="nicr"
|
||
|
set.termguicolors=true
|
||
|
set.matchpairs:append("<:>")
|
||
|
set.completeopt="menuone,noselect,preview"
|
||
|
|
||
|
vim.cmd("hi CursorLine term=bold cterm=bold ctermbg=darkgrey")
|
||
|
|
||
|
require('packer').startup(function(use)
|
||
|
use 'wbthomason/packer.nvim'
|
||
|
use {
|
||
|
"williamboman/mason.nvim",
|
||
|
"williamboman/mason-lspconfig.nvim",
|
||
|
"neovim/nvim-lspconfig",
|
||
|
"WhoIsSethDaniel/mason-tool-installer.nvim"
|
||
|
}
|
||
|
use 'mfussenegger/nvim-dap'
|
||
|
use 'jose-elias-alvarez/null-ls.nvim'
|
||
|
use {
|
||
|
'nvim-telescope/telescope.nvim', tag = '0.1.0',
|
||
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||
|
}
|
||
|
use 'nvim-lua/lsp-status.nvim'
|
||
|
use 'jiangmiao/auto-pairs'
|
||
|
use 'machakann/vim-sandwich'
|
||
|
use 'machakann/vim-highlightedyank'
|
||
|
use 'bling/vim-airline'
|
||
|
use 'airblade/vim-gitgutter'
|
||
|
use 'easymotion/vim-easymotion'
|
||
|
use {
|
||
|
'antoinemadec/FixCursorHold.nvim',
|
||
|
'kosayoda/nvim-lightbulb'
|
||
|
}
|
||
|
use 'hrsh7th/cmp-nvim-lsp'
|
||
|
use 'hrsh7th/cmp-buffer'
|
||
|
use 'hrsh7th/cmp-path'
|
||
|
use 'hrsh7th/cmp-cmdline'
|
||
|
use 'saadparwaiz1/cmp_luasnip'
|
||
|
use 'L3MON4D3/LuaSnip'
|
||
|
use 'kyazdani42/nvim-web-devicons'
|
||
|
use 'kyazdani42/nvim-tree.lua'
|
||
|
use 'tpope/vim-fugitive'
|
||
|
use {
|
||
|
'nvim-treesitter/nvim-treesitter',
|
||
|
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
|
||
|
}
|
||
|
use 'folke/tokyonight.nvim'
|
||
|
use 'simrat39/rust-tools.nvim'
|
||
|
--use 'morhetz/gruvbox'
|
||
|
|
||
|
end)
|
||
|
|
||
|
vim.cmd[[colorscheme tokyonight]]
|
||
|
|
||
|
--- Treesitter
|
||
|
---BEGINWORKAROUND
|
||
|
--vim.api.nvim_create_autocmd({'BufEnter','BufAdd','BufNew','BufNewFile','BufWinEnter'}, {
|
||
|
-- group = vim.api.nvim_create_augroup('TS_FOLD_WORKAROUND', {}),
|
||
|
-- callback = function()
|
||
|
-- vim.opt.foldmethod = 'expr'
|
||
|
-- vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||
|
-- end
|
||
|
--})
|
||
|
---ENDWORKAROUND
|
||
|
--- Treesitter
|
||
|
--- Utility functions
|
||
|
function map(mode, shortcut, command)
|
||
|
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
|
||
|
end
|
||
|
|
||
|
function nmap(shortcut, command)
|
||
|
map('n', shortcut, command)
|
||
|
end
|
||
|
|
||
|
function imap(shortcut, command)
|
||
|
map('i', shortcut, command)
|
||
|
end
|
||
|
|
||
|
function xmap(shortcut, command)
|
||
|
map('x', shortcut, command)
|
||
|
end
|
||
|
---
|
||
|
require('nvim-lightbulb_config')
|
||
|
require('nvimtree')
|
||
|
require('treesitter_config')
|
||
|
require('dap_config')
|
||
|
require('mason_config')
|
||
|
require('new_lsp_conf')
|
||
|
require('cmp_config')
|
||
|
require("null-ls").setup({
|
||
|
sources = {
|
||
|
require("null-ls").builtins.formatting.stylua,
|
||
|
require("null-ls").builtins.diagnostics.eslint,
|
||
|
require("null-ls").builtins.completion.spell,
|
||
|
},
|
||
|
})
|
||
|
|
||
|
vim.cmd([[
|
||
|
runtime macros/sandwich/keymap/surround.vim
|
||
|
]])
|
||
|
|
||
|
nmap("<SPACE>","<Nop>")
|
||
|
|
||
|
vim.g.mapleader = " "
|
||
|
|
||
|
xmap("p",'\"_dP')
|
||
|
nmap("<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>")
|
||
|
nmap("<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>")
|
||
|
nmap("<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>")
|
||
|
nmap("<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>")
|
||
|
|
||
|
nmap("<C-n>",":NvimTreeToggle<cr>")
|
||
|
nmap("<leader>r",":NvimTreeRefresh<cr>")
|
||
|
nmap("<leader>n",":NvimTreeToggle<cr>")
|