Compare commits
23 Commits
e6710a461a
...
46e5d9c2e6
Author | SHA1 | Date |
---|---|---|
Julian Raufelder | 46e5d9c2e6 | |
Julian Raufelder | ac1dcf733a | |
Damjan 9000 | ea4335f5af | |
stgpepper | da1271db4d | |
TJ DeVries | 7892c0c354 | |
TJ DeVries | 5ac4b58f85 | |
Vladislav Grechannik | 2f494e59ca | |
Rafael Zasas | 452e3a73cf | |
TLW | 7715b7c2ee | |
Chris Patti | b529bc3359 | |
James Karefylakis | d8a1dbc4b4 | |
Damjan 9000 | 000a5c42b0 | |
Chiller Dragon | cb1f16b8ca | |
Ryan Baumgardner | c0d6f98924 | |
Damjan 9000 | 8de494fff2 | |
name.tar.xz | 3cfccc01be | |
Nora Ayesha | 8fae6798b9 | |
Damjan 9000 | 66e2a5a425 | |
Ryan Winchester | f764b7bacd | |
Chiller Dragon | b83b2b061c | |
Chiller Dragon | a02abdb161 | |
Damjan 9000 | c3127f1226 | |
Damjan 9000 | c9122e89e3 |
43
README.md
43
README.md
|
@ -21,12 +21,14 @@ If you are experiencing issues, please make sure you have the latest versions.
|
|||
|
||||
### Install External Dependencies
|
||||
|
||||
> **NOTE**
|
||||
> **NOTE**
|
||||
> [Backup](#FAQ) your previous configuration (if any exists)
|
||||
|
||||
External Requirements:
|
||||
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
|
||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
|
||||
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
|
||||
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
|
||||
- Language Setup:
|
||||
- If want to write Typescript, you need `npm`
|
||||
- If want to write Golang, you will need `go`
|
||||
|
@ -60,13 +62,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO
|
|||
If you're using `cmd.exe`:
|
||||
|
||||
```
|
||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
||||
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
|
||||
```
|
||||
|
||||
If you're using `powershell.exe`
|
||||
|
||||
```
|
||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
|
||||
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
|
||||
```
|
||||
|
||||
</details>
|
||||
|
@ -87,17 +89,15 @@ information about extending and exploring Neovim.
|
|||
|
||||
### Getting Started
|
||||
|
||||
See [Effective Neovim: Instant IDE](https://youtu.be/stqUbv-5u2s), covering the
|
||||
previous version. Note: The install via init.lua is outdated, please follow the
|
||||
install instructions in this file instead. An updated video is coming soon.
|
||||
[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o)
|
||||
|
||||
### Recommended Steps
|
||||
|
||||
[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo
|
||||
(so that you have your own copy that you can modify) and then installing you
|
||||
can install to your machine using the methods above.
|
||||
(so that you have your own copy that you can modify) and then install. You
|
||||
can install it on your machine using the methods above.
|
||||
|
||||
> **NOTE**
|
||||
> **NOTE**
|
||||
> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
|
||||
|
||||
#### Examples of adding popularly requested plugins
|
||||
|
@ -135,13 +135,12 @@ return {
|
|||
<details>
|
||||
<summary>Adding a file tree plugin</summary>
|
||||
|
||||
This will install the tree plugin and add the command `:Neotree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information.
|
||||
This will install the tree plugin and add the command `:Neotree` for you. For more information, see the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim).
|
||||
|
||||
In the file: `lua/custom/plugins/filetree.lua`, add:
|
||||
|
||||
```lua
|
||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
-- File: lua/custom/plugins/filetree.lua
|
||||
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
|
@ -162,10 +161,10 @@ return {
|
|||
### FAQ
|
||||
|
||||
* What should I do if I already have a pre-existing neovim configuration?
|
||||
* You should back it up, then delete all files associated with it.
|
||||
* You should back it up and then delete all associated files.
|
||||
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
|
||||
* Can I keep my existing configuration in parallel to kickstart?
|
||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias:
|
||||
* Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` to maintain multiple configurations. For example, you can install the kickstart configuration in `~/.config/nvim-kickstart` and create an alias:
|
||||
```
|
||||
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
|
||||
```
|
||||
|
@ -174,9 +173,9 @@ return {
|
|||
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
||||
* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files?
|
||||
* The main purpose of kickstart is to serve as a teaching tool and a reference
|
||||
configuration that someone can easily `git clone` as a basis for their own.
|
||||
configuration that someone can easily use to `git clone` as a basis for their own.
|
||||
As you progress in learning Neovim and Lua, you might consider splitting `init.lua`
|
||||
into smaller parts. A fork of kickstart that does this while maintaining the exact
|
||||
into smaller parts. A fork of kickstart that does this while maintaining the
|
||||
same functionality is available here:
|
||||
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
|
||||
* Discussions on this topic can be found here:
|
||||
|
@ -185,19 +184,19 @@ return {
|
|||
|
||||
### Windows Installation
|
||||
|
||||
Installation may require installing build tools, and updating the run command for `telescope-fzf-native`
|
||||
Installation may require installing build tools and updating the run command for `telescope-fzf-native`
|
||||
|
||||
See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation)
|
||||
|
||||
This requires:
|
||||
|
||||
- Install CMake, and the Microsoft C++ Build Tools on Windows
|
||||
- Install CMake and the Microsoft C++ Build Tools on Windows
|
||||
|
||||
```lua
|
||||
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
|
||||
```
|
||||
|
||||
Alternatively one can install gcc and make which don't require changing the config,
|
||||
Alternatively, one can install gcc and make which don't require changing the config,
|
||||
the easiest way is to use choco:
|
||||
|
||||
1. install [chocolatey](https://chocolatey.org/install)
|
||||
|
@ -208,11 +207,9 @@ winget install --accept-source-agreements chocolatey.chocolatey
|
|||
```
|
||||
|
||||
2. install all requirements using choco, exit previous cmd and
|
||||
open a new one so that choco path is set, run in cmd as **admin**:
|
||||
open a new one so that choco path is set, and run in cmd as **admin**:
|
||||
```
|
||||
choco install -y neovim git ripgrep wget fd unzip gzip mingw make
|
||||
```
|
||||
|
||||
Then continue with the [Install Kickstart](#Install-Kickstart) step.
|
||||
|
||||
|
||||
Then, continue with the [Install Kickstart](#Install-Kickstart) step.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
local config = {
|
||||
cmd = { '/usr/bin/jdtls' },
|
||||
root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]),
|
||||
}
|
||||
require('jdtls').start_or_attach(config)
|
377
init.lua
377
init.lua
|
@ -90,6 +90,9 @@ P.S. You can delete this when you're done too. It's your config now! :)
|
|||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed
|
||||
vim.g.have_nerd_font = false
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
|
@ -110,7 +113,7 @@ vim.opt.showmode = false
|
|||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
-- vim.opt.clipboard = 'unnamedplus'
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
@ -127,6 +130,9 @@ vim.opt.signcolumn = 'yes'
|
|||
|
||||
-- Decrease update time
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
-- Displays which-key popup sooner
|
||||
vim.opt.timeoutlen = 300
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
|
@ -218,7 +224,7 @@ vim.opt.rtp:prepend(lazypath)
|
|||
-- :Lazy update
|
||||
--
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
require('lazy').setup {
|
||||
require('lazy').setup({
|
||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
|
||||
|
@ -242,6 +248,7 @@ require('lazy').setup {
|
|||
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
|
@ -249,6 +256,66 @@ require('lazy').setup {
|
|||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map({ 'n', 'v' }, ']c', function()
|
||||
if vim.wo.diff then
|
||||
return ']c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.next_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, desc = 'Jump to next hunk' })
|
||||
|
||||
map({ 'n', 'v' }, '[c', function()
|
||||
if vim.wo.diff then
|
||||
return '[c'
|
||||
end
|
||||
vim.schedule(function()
|
||||
gs.prev_hunk()
|
||||
end)
|
||||
return '<Ignore>'
|
||||
end, { expr = true, desc = 'Jump to previous hunk' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
||||
map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
||||
map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
||||
map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
||||
map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
||||
map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
||||
map('n', '<leader>hb', function()
|
||||
gs.blame_line { full = false }
|
||||
end, { desc = 'git blame line' })
|
||||
map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gs.diffthis '~'
|
||||
end, { desc = 'git diff against last commit' })
|
||||
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
|
||||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
|
||||
|
||||
-- Text object
|
||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -312,10 +379,8 @@ require('lazy').setup {
|
|||
},
|
||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||
|
||||
-- Useful for getting pretty icons, but requires special font.
|
||||
-- If you already have a Nerd Font, or terminal set up with fallback fonts
|
||||
-- you can enable this
|
||||
-- { 'nvim-tree/nvim-web-devicons' }
|
||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||
|
@ -372,6 +437,14 @@ require('lazy').setup {
|
|||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
local function telescope_find_files_in_home()
|
||||
local opts = {
|
||||
hidden = true,
|
||||
cwd = '/home/julian',
|
||||
}
|
||||
require('telescope.builtin').find_files(opts)
|
||||
end
|
||||
vim.keymap.set('n', '<leader>sc', telescope_find_files_in_home, { desc = '[S]earch files starting in ~' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
|
@ -409,6 +482,10 @@ require('lazy').setup {
|
|||
-- Useful status updates for LSP.
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
{ 'folke/neodev.nvim', opts = {} },
|
||||
},
|
||||
config = function()
|
||||
-- Brief Aside: **What is LSP?**
|
||||
|
@ -455,7 +532,7 @@ require('lazy').setup {
|
|||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-T>.
|
||||
-- To jump back, press <C-t>.
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
|
@ -550,18 +627,6 @@ require('lazy').setup {
|
|||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = 'LuaJIT' },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
-- Tells lua_ls where to find all the Lua files that you have loaded
|
||||
-- for your neovim configuration.
|
||||
library = {
|
||||
'${3rd}/luv/library',
|
||||
unpack(vim.api.nvim_get_runtime_file('', true)),
|
||||
},
|
||||
-- If lua_ls is really slow on your computer, you can try this instead:
|
||||
-- library = { vim.env.VIMRUNTIME },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
|
@ -607,10 +672,16 @@ require('lazy').setup {
|
|||
'stevearc/conform.nvim',
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
|
@ -639,6 +710,17 @@ require('lazy').setup {
|
|||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
|
@ -647,12 +729,6 @@ require('lazy').setup {
|
|||
-- into multiple repos for maintenance purposes.
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
|
||||
-- If you want to add a bunch of pre-configured snippets,
|
||||
-- you can use this plugin to help you. It even has snippets
|
||||
-- for various frameworks/libraries/etc. but you will have to
|
||||
-- set up the ones that are useful for you.
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
|
@ -678,6 +754,10 @@ require('lazy').setup {
|
|||
-- Select the [p]revious item
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- scroll the documentation window [b]ack / [f]orward
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
-- Accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
|
@ -706,6 +786,9 @@ require('lazy').setup {
|
|||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
-- For more advanced luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
|
@ -722,11 +805,10 @@ require('lazy').setup {
|
|||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`
|
||||
'folke/tokyonight.nvim',
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
config = function()
|
||||
-- Load the colorscheme here
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
vim.cmd.colorscheme 'onedark'
|
||||
|
||||
-- You can configure highlights by doing something like
|
||||
vim.cmd.hi 'Comment gui=none'
|
||||
|
@ -758,14 +840,15 @@ require('lazy').setup {
|
|||
-- You could remove this setup call if you don't like it,
|
||||
-- and try some other statusline plugin
|
||||
local statusline = require 'mini.statusline'
|
||||
statusline.setup()
|
||||
-- set use_icons to true if you have a Nerd Font
|
||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||
|
||||
-- You can configure sections in the statusline by overriding their
|
||||
-- default behavior. For example, here we disable the section for
|
||||
-- cursor information because line numbers are already enabled
|
||||
-- default behavior. For example, here we set the section for
|
||||
-- cursor location to LINE:COLUMN
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return ''
|
||||
return '%2l:%-2v'
|
||||
end
|
||||
|
||||
-- ... and there is more!
|
||||
|
@ -776,17 +859,45 @@ require('lazy').setup {
|
|||
{ -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'lua',
|
||||
'python',
|
||||
'tsx',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'vimdoc',
|
||||
'vim',
|
||||
'bash',
|
||||
'css',
|
||||
'dockerfile',
|
||||
'html',
|
||||
'java',
|
||||
'kotlin',
|
||||
'json',
|
||||
'markdown_inline',
|
||||
'ruby',
|
||||
'sql',
|
||||
'toml',
|
||||
'vue',
|
||||
'yaml',
|
||||
},
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
||||
-- If you are experiencing weird indenting issues, add the language to
|
||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
}
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
|
||||
-- There are additional nvim-treesitter modules that you can use to interact
|
||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||
|
@ -796,6 +907,75 @@ require('lazy').setup {
|
|||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
end,
|
||||
},
|
||||
-- live autocompletion for commands etc
|
||||
{ 'gelguy/wilder.nvim', version = '*', config = function() end },
|
||||
-- File browser
|
||||
{
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
config = function()
|
||||
require('neo-tree').setup {}
|
||||
end,
|
||||
},
|
||||
-- Markdown preview
|
||||
{
|
||||
'iamcco/markdown-preview.nvim',
|
||||
ft = 'markdown',
|
||||
-- build = "cd app && yarn install", -- after removing Joplin one day
|
||||
build = 'cd app && npm install',
|
||||
init = function()
|
||||
vim.g.mkdp_filetypes = { 'markdown' }
|
||||
end,
|
||||
},
|
||||
-- show notifications etc in a nice area
|
||||
{ 'folke/noice.nvim', event = 'VeryLazy', opts = {}, dependencies = {
|
||||
'MunifTanjim/nui.nvim',
|
||||
'rcarriga/nvim-notify',
|
||||
} },
|
||||
{
|
||||
-- Highlight, edit, and navigate code
|
||||
'ThePrimeagen/harpoon',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
},
|
||||
'mbbill/undotree',
|
||||
'github/copilot.vim',
|
||||
'mfussenegger/nvim-jdtls',
|
||||
'AckslD/nvim-neoclip.lua',
|
||||
{
|
||||
-- Theme inspired by Atom
|
||||
'navarasu/onedark.nvim',
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('onedark').setup {
|
||||
-- Set a style preset. 'dark' is default.
|
||||
style = 'dark', -- dark, darker, cool, deep, warm, warmer, light
|
||||
}
|
||||
require('onedark').load()
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- Set lualine as statusline
|
||||
'nvim-lualine/lualine.nvim',
|
||||
-- See `:help lualine.txt`
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = 'auto',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
-- tmux vim keybindings
|
||||
'christoomey/vim-tmux-navigator',
|
||||
|
||||
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||
|
@ -815,7 +995,116 @@ require('lazy').setup {
|
|||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
|
||||
-- { import = 'custom.plugins' },
|
||||
}
|
||||
}, {
|
||||
ui = {
|
||||
-- If you have a Nerd Font, set icons to an empty table which will use the
|
||||
-- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table
|
||||
icons = vim.g.have_nerd_font and {} or {
|
||||
cmd = '⌘',
|
||||
config = '🛠',
|
||||
event = '📅',
|
||||
ft = '📂',
|
||||
init = '⚙',
|
||||
keys = '🗝',
|
||||
plugin = '🔌',
|
||||
runtime = '💻',
|
||||
require = '🌙',
|
||||
source = '📄',
|
||||
start = '🚀',
|
||||
task = '📌',
|
||||
lazy = '💤 ',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
-- Toggle line numbers depending on the vim mode
|
||||
local augroup = vim.api.nvim_create_augroup('numbertoggle', {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave', 'WinEnter' }, {
|
||||
pattern = '*',
|
||||
group = augroup,
|
||||
callback = function()
|
||||
if vim.o.nu and vim.api.nvim_get_mode().mode ~= 'i' then
|
||||
vim.opt.relativenumber = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'CmdlineEnter', 'WinLeave' }, {
|
||||
pattern = '*',
|
||||
group = augroup,
|
||||
callback = function()
|
||||
if vim.o.nu then
|
||||
vim.opt.relativenumber = false
|
||||
vim.cmd 'redraw'
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set('i', 'jj', '<esc>', { desc = 'Closes insert mode' })
|
||||
vim.keymap.set('n', 'ec', ':', { desc = 'Execute command' })
|
||||
|
||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move line down' })
|
||||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move line up' })
|
||||
|
||||
vim.keymap.set('x', '<leader>p', '"_dP', { desc = '[P]aste with previous still in buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>y', '"+y', { desc = '[Y]ank to system clipboard' })
|
||||
vim.keymap.set('v', '<leader>y', '"+y', { desc = '[Y]ank to system clipboard' })
|
||||
vim.keymap.set('n', '<leader>Y', '"+Y', { desc = '[Y]ank to system clipboard' })
|
||||
|
||||
vim.keymap.set('n', '<leader>rr', [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = '[R]ename by [R]egex pattern' })
|
||||
|
||||
-- map capital b and e to end/start line, should be default?
|
||||
vim.keymap.set('n', 'B', '_', { desc = 'Jump to line [B]eginning' })
|
||||
vim.keymap.set('n', 'E', '$', { desc = 'Jump to line [E]nding' })
|
||||
|
||||
-- wilder
|
||||
local wilder = require 'wilder'
|
||||
wilder.setup { modes = { ':', '/', '?' } }
|
||||
|
||||
-- filetree
|
||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||
vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]]
|
||||
|
||||
-- neo_tree
|
||||
vim.keymap.set('n', '<leader>n', '<Cmd>Neotree toggle <Cr>', { desc = 'Toggle [N]eoTree' })
|
||||
vim.keymap.set('n', '<leader>m', '<Cmd>Neotree float dir=%:p:h:h reveal_file=%:p <CR>', { desc = '[M]odify File NeoTree' })
|
||||
|
||||
vim.keymap.set('n', '<C-P>', ':Telescope find_files<CR>', { desc = 'Toggle [N]eoTree' })
|
||||
|
||||
-- harpoon
|
||||
local mark = require 'harpoon.mark'
|
||||
local ui = require 'harpoon.ui'
|
||||
|
||||
vim.keymap.set('n', '<leader>hh', mark.add_file, { desc = 'Add file to harpoon' })
|
||||
vim.keymap.set('n', '<C-e>', ui.toggle_quick_menu, { desc = 'Toggle harpoon quick menu' })
|
||||
|
||||
vim.keymap.set('n', '<C-t>', function()
|
||||
ui.nav_file(1)
|
||||
end, { desc = 'Harpoon file 1' })
|
||||
vim.keymap.set('n', '<C-n>', function()
|
||||
ui.nav_file(2)
|
||||
end, { desc = 'Harpoon file 2' })
|
||||
|
||||
-- ctrl+s write
|
||||
vim.api.nvim_set_keymap('n', '<C-s>', ':w<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-s>', '<Esc>:w<CR>i', { noremap = true, silent = true })
|
||||
|
||||
--- ctrl+q quit
|
||||
vim.api.nvim_set_keymap('n', '<C-q>', ':q<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('i', '<C-q>', '<Esc>:q<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- undotree
|
||||
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle, { desc = 'Toggle Undotree' })
|
||||
|
||||
-- copilot disabled by default, enable it by typing :let b:copilot_enabled = 1 or executing ThisIsYourCaptainSpeaking
|
||||
vim.g.copilot_assume_mapped = true
|
||||
vim.api.nvim_exec([[ au BufNewFile,BufRead * let b:copilot_enabled = 0 ]], false)
|
||||
vim.api.nvim_create_user_command('ThisIsYourCaptainSpeaking', 'let b:copilot_enabled = 1', {})
|
||||
|
||||
require('neoclip').setup()
|
||||
vim.api.nvim_set_keymap('n', '<leader>cc', ':Telescope neoclip<CR>', { noremap = true, silent = true })
|
||||
|
|
|
@ -6,15 +6,16 @@
|
|||
--]]
|
||||
|
||||
local check_version = function()
|
||||
local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
|
||||
if not vim.version.cmp then
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
return
|
||||
end
|
||||
|
||||
if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
|
||||
vim.health.ok(string.format("Neovim version is: '%s'", tostring(vim.version())))
|
||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||
else
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
|
||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue