mirror of
https://github.com/Baipyrus/nvim-config.git
synced 2024-12-26 05:11:45 +00:00
init my config
This commit is contained in:
parent
60b93c95d3
commit
dadc78db76
109
init.lua
109
init.lua
@ -1,46 +1,17 @@
|
||||
--[[
|
||||
-- Set display language
|
||||
vim.api.nvim_exec2('language en_US', {})
|
||||
|
||||
=====================================================================
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
|
||||
Kickstart.nvim is a template for your own configuration.
|
||||
The goal is that you can read every line of code, top-to-bottom, understand
|
||||
what your configuration is doing, and modify it to suit your needs.
|
||||
|
||||
Once you've done that, you should start exploring, configuring and tinkering to
|
||||
explore Neovim!
|
||||
|
||||
If you don't know anything about Lua, I recommend taking some time to read through
|
||||
a guide. One possible example:
|
||||
- https://learnxinyminutes.com/docs/lua/
|
||||
|
||||
|
||||
And then you can explore or search through `:help lua-guide`
|
||||
- https://neovim.io/doc/user/lua-guide.html
|
||||
|
||||
|
||||
Kickstart Guide:
|
||||
|
||||
I have left several `:help X` comments throughout the init.lua
|
||||
You should run that command and read that help section for more information.
|
||||
|
||||
In addition, I have some `NOTE:` items throughout the file.
|
||||
These are for you, the reader to help understand what is happening. Feel free to delete
|
||||
them once you know what you're doing, but they should serve as a guide for when you
|
||||
are first encountering a few different constructs in your nvim config.
|
||||
|
||||
I hope you enjoy your Neovim journey,
|
||||
- TJ
|
||||
|
||||
P.S. You can delete this when you're done too. It's your config now :)
|
||||
--]]
|
||||
-- Shell options
|
||||
-- Sets the shell to use for system() and ! commands
|
||||
vim.opt.shell = 'powershell.exe'
|
||||
vim.opt.shellcmdflag = '-NonInteractive -NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command '
|
||||
vim.opt.shellxquote = ''
|
||||
vim.opt.shellquote = ''
|
||||
vim.opt.shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
|
||||
vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s'
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
@ -61,14 +32,7 @@ end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- [[ Configure plugins ]]
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
-- You can configure plugins using the `config` key.
|
||||
--
|
||||
-- You can also configure plugins after the setup call,
|
||||
-- as they will be available in your neovim runtime.
|
||||
require('lazy').setup({
|
||||
-- NOTE: First, some plugins that don't require any configuration
|
||||
|
||||
-- Git related plugins
|
||||
'tpope/vim-fugitive',
|
||||
'tpope/vim-rhubarb',
|
||||
@ -76,8 +40,6 @@ require('lazy').setup({
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
'tpope/vim-sleuth',
|
||||
|
||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
||||
-- The configuration is done below. Search for lspconfig to find it below.
|
||||
{
|
||||
-- LSP Configuration & Plugins
|
||||
'neovim/nvim-lspconfig',
|
||||
@ -87,7 +49,6 @@ require('lazy').setup({
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
-- Useful status updates for LSP
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
@ -230,9 +191,6 @@ require('lazy').setup({
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||
-- Only load if `make` is available. Make sure you have the system
|
||||
-- requirements installed.
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
-- NOTE: If you are having trouble with this installation,
|
||||
@ -254,24 +212,12 @@ require('lazy').setup({
|
||||
build = ':TSUpdate',
|
||||
},
|
||||
|
||||
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||
-- These are some example plugins that I've included in the kickstart repository.
|
||||
-- Uncomment any of the lines below to enable them.
|
||||
-- require 'kickstart.plugins.autoformat',
|
||||
-- require 'kickstart.plugins.debug',
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||
-- up-to-date with whatever is in the kickstart repo.
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
--
|
||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||
-- { import = 'custom.plugins' },
|
||||
}, {})
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
@ -423,10 +369,8 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc =
|
||||
vim.defer_fn(function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash' },
|
||||
ensure_installed = { 'lua', 'python', 'rust', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash', 'batch', 'powershell' },
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = false,
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = false,
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
@ -496,12 +440,6 @@ end, 0)
|
||||
-- [[ Configure LSP ]]
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||
-- many times.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
@ -556,32 +494,19 @@ require('which-key').register({
|
||||
['<leader>h'] = { 'Git [H]unk' },
|
||||
}, { mode = 'v' })
|
||||
|
||||
-- mason-lspconfig requires that these setup functions are called in this order
|
||||
-- before setting up the servers.
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup()
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
--
|
||||
-- If you want to override the default filetypes that your language server will attach to you can
|
||||
-- define the property 'filetypes' to the map in question.
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- tsserver = {},
|
||||
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||
|
||||
local servers = {
|
||||
powershell_es = {},
|
||||
rust_analyzer = {},
|
||||
tsserver = {},
|
||||
pyright = {},
|
||||
bashls = {},
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user