Compare commits

..

71 Commits

Author SHA1 Message Date
Julian Raufelder 8eb5b3b325
Merge branch 'master' of github.com:nvim-lua/kickstart.nvim 2023-12-31 13:58:27 +01:00
Julian Raufelder ca3c4010c2
Add copilot 2023-12-31 03:29:04 +01:00
John Pekcan 4d0dc8d4b1
fix: restore mason config timing for dap startup (#555)
Co-authored-by: John Pekcan <john.pekcan@epicgames.com>
2023-12-23 23:59:59 -05:00
Ari Pollak e39a8bce9d
Switch cmp up mapping from C-d to C-b to match regular vim up key (#549) 2023-12-21 15:35:28 -05:00
Shashwat Agrawal 76c5b1ec57
feat(cmp): path completion feature (#536) 2023-12-08 08:14:06 -05:00
Damjan 9000 3824342d10
Adds two essential telescope keymaps (#528)
* Added keymap for select Telescope picker

* Added keymap for search in all open files
2023-12-04 10:45:01 -05:00
Damjan 9000 f8c8b08bc1
Add gitsigns recommended keymaps (#531)
* Import gitsigns README.md recommended keymaps (and apply stylua)

the previously added visual mode for ]c [c is kept.

* Add gitsigns keymap descriptions
2023-12-04 10:35:54 -05:00
Damjan 9000 12bd68e8b9
Run stylua (#525) 2023-12-03 14:23:39 -05:00
Damjan 9000 3ca08acf0e
Add a github action on pull request to check lua formatting (#526)
GitHub Action used:
https://github.com/marketplace/actions/stylua

This runs `stylua --check` on a PR and it will show
success or failure. The suggested stylua changes can
be inspected when clicking on the details.

The PR can still be merged even if the check fails.
2023-12-02 16:27:13 -05:00
Sudo 39ae0829ac
Use alias instead of a wrapper script (#524)
It is much easier to stick an alias statement in `~/.{z,ba}shrc` than create a script, invoke another instance of interpreter and then run neovim
2023-11-30 17:30:55 -05:00
Damjan 9000 afafc9ab19
README.md: update install section formatting (#523) 2023-11-30 04:04:27 -05:00
matt 14cf319dbd
Update README.md (#520) 2023-11-29 19:34:43 -05:00
Tommy Williams ee9790b381
option to reduce noisy Lua_LS's missing-fields warnings (#511) 2023-11-24 11:55:19 -05:00
Chris Patti 1915cea32e
Merge pull request #505 from j-hui/update-fidget
init.lua: remove 'legacy' tag from fidget.nvim
2023-11-13 15:59:01 -05:00
j-hui 711e5976dd init.lua: remove 'legacy' tag from fidget.nvim 2023-11-13 15:46:34 -05:00
Chris Patti fa94716dce
Merge pull request #502 from ShashwatAgrawal20/item-selection 2023-11-12 14:38:40 -05:00
Shashwat Agrawal af4f51b2cd fix(auto-completion): ensure first menu item is selected by default 2023-11-11 20:31:05 +05:30
Chris Patti a005f15cec
Merge pull request #495 from dam9000/pr-minor-cleanup
Minor cleanups
2023-11-07 10:02:57 -05:00
Damjan 9000 c8dd8e7e0c init.lua: minor edits of section comments for consistency 2023-11-07 11:27:14 +01:00
Damjan 9000 f23484cf88 init.lua: move diagnostic keymaps together with other keymaps 2023-11-07 11:18:15 +01:00
Chris Patti 47974f7db1
Merge pull request #494 from slara/master 2023-11-06 21:07:53 -05:00
Sebastian Lara Menares 1d14453024 Live Grep from Git root falls back to cwd on special buffers 2023-11-06 22:29:05 -03:00
Chris Patti bced1c2943
Merge pull request #492 from slara/master
add Telescope live_grep on Git root
2023-11-06 16:36:35 -05:00
Chris Patti 1c59dc28c8
Merge pull request #485 from n-a11s/patch-1
Differences in CMD and Powershell env variables.
2023-11-06 15:56:59 -05:00
Sebastian Lara Menares 5ce4f38e1e change keymap to not disrupt existing users of Search by Grep 2023-11-06 15:29:09 -03:00
Sebastian Lara Menares 0fda9af7c9 add Telescope live_grep on Git root 2023-11-06 11:10:16 -03:00
Chris Patti 29c77cd7e5
Merge pull request #486 from dam9000/pr-faq-single-file
README.md: Added a FAQ: why is init.lua a single file
2023-11-03 15:57:52 -04:00
Damjan 9000 1ad1ec2509 README.md: Added a FAQ: why is init.lua a single file 2023-11-03 20:55:42 +01:00
n-a11s 4d2cf48fb6
Update README.md
Added information on where to install if you use Powershell in windows. Since CMD and Powershell work differently.

`%userprofile%` only works for the CMD application.
`$env:USERPROFILE` works in Powershell.
2023-11-03 13:47:30 +01:00
Chris Patti 99acb843ac
Merge pull request #480 from dam9000/pr-faq-appname
README.md: add a note about NVIM_APPNAME in the FAQ section
2023-10-29 14:17:10 -04:00
Damjan 9000 0dd934ee01 README.md: add a note about NVIM_APPNAME in the FAQ section 2023-10-28 23:41:53 +02:00
Chris Patti a3f3e08f34
Merge pull request #479 from dam9000/update-readme-lazy-sync 2023-10-26 08:35:53 -04:00
Damjan 9000 68b1981f02 Update README Post Installation steps
Change the recommendation to just run nvim normally instead of the headless
mode for the first run. This will show Lazy UI updating the plugins which
would match what the video show and may be easier to understand what is going
on thant the silent headless run.
2023-10-26 06:47:18 +02:00
Julian Raufelder f0cc2f931e
Merge branch 'master' of github.com:nvim-lua/kickstart.nvim 2023-10-14 14:12:07 +02:00
Julian Raufelder 8171e1dd91
Fix typo 2023-10-14 14:09:44 +02:00
Chris Patti 9b256d9368
Merge pull request #467 from theopn/master
Use Telescope builtin functions for LSP definition and type definition
2023-10-13 15:07:41 -04:00
Theo P 5d8921990b feat(lsp): use Telescope builtin functions for LSP definition and type
definition
2023-10-13 16:22:02 +09:00
Chris Patti 0b659bd508
Merge pull request #462 from Alvaro-Kothe/fix-help-ibl
Fix help for indent-blankline plugin
2023-10-12 11:16:50 -04:00
Julian Raufelder c53c42350d
Change keybindings 2023-10-11 11:33:18 +02:00
Julian Raufelder b09370df83
Remove bufferline and add vim-surround and vim-commentary 2023-10-11 11:33:01 +02:00
Julian Raufelder 235b9c5f49
Add some further keybindinds and plugins 2023-10-11 11:28:39 +02:00
Julian Raufelder 9682dda165
Add some further keybindinds 2023-10-11 11:28:29 +02:00
Julian Raufelder 4230158ff5
Add further customizations 2023-10-11 11:28:01 +02:00
Julian Raufelder c705d03a4b
Add vim-tmux-plugin 2023-10-11 11:26:21 +02:00
Julian Raufelder d77d805495
Further improvements 2023-10-11 11:26:09 +02:00
Julian Raufelder a64cddd5c8
Add my customisations 2023-10-11 11:25:55 +02:00
Alvaro-Kothe db7189f35c Fix help for indent-blankline plugin
Since version 3 `:help indent_blankline` no longer works. Replace it
with `:help ibl`.
2023-10-10 20:02:44 -03:00
Chris Patti 58f2dbab70
Merge pull request #452 from AshrafMichail23/fix_bash_errors
Fix Treesitter bash errors when editing README.md
2023-10-10 11:31:33 -04:00
Chris Patti 9fe8b20f03
Merge pull request #458 from pedrosantayana/master
Simple misstype fix on README.md
2023-10-10 11:30:54 -04:00
Pedro Santayana c27b05467a
docs: fix misstype on README.md 2023-10-07 22:34:24 -03:00
Ashraf Michail 01ed2525bb Fix bash errors 2023-10-08 00:25:27 +00:00
Chris Patti 53e925240f
Merge pull request #456 from goatfiles/fix-diagnostic-errors
fix: remove spaces in empty lines
2023-10-07 19:51:19 -04:00
Chris Patti f70edeec1b
Merge pull request #455 from Anthony-Fiddes/fix-mason-setup
Fix Mason setup bug and run stylua
2023-10-07 19:50:17 -04:00
Anthony Fiddes 36224daa1b Move mason setup up further
This helps if a user needs to find a mason executable
2023-10-07 16:14:26 -07:00
amtoine 21b175d21b
remove spaces in empty lines 2023-10-07 13:49:47 +02:00
Anthony Fiddes 6ffc5a169f Fix Mason setup issue and run stylua. 2023-10-06 16:25:57 -07:00
Chris Patti f15af9b8be
Merge pull request #448 from AshrafMichail23/main
Defer Treesitter setup to improve startup time of nvim {filename}
2023-10-01 22:05:20 -04:00
Chris Patti 313bd75ca0 Fix git clone instruction - separate code blocks for Windows and UNIX. 2023-09-30 20:06:22 -04:00
Ashraf Michail 4d5f24d6c1 Defer Treesitter setup to improve startup time of nvim {filename} 2023-09-30 00:35:22 +00:00
Chris Patti daf2dc38fc
Merge pull request #438 from tcld/which_key_documentation
Which key documentation and 2-3 changed keybindings
2023-09-29 15:29:20 -04:00
Chris Patti fca29aa644
Merge pull request #446 from lukas-reineke/fix-indent-blankline
fix: fix indent-blankline config
2023-09-29 11:31:02 -04:00
Lukas Reineke 7a58588a92 fix: fix indent-blankline config 2023-09-28 23:11:05 +09:00
Chris Patti e8c70473c9
Merge pull request #443 from emmanuelchucks/patch-1
fix(init.lua): indent blankline v3 setup
2023-09-28 09:28:20 -04:00
Emmanuel Chucks 878ec12318
fix(init.lua): indent blankline v3 setup 2023-09-28 05:57:53 +00:00
Chris Patti 3668af39f4
Merge pull request #442 from Anthony-Fiddes/add-lazy-lock
Remove lazy-lock.json from .gitignore
2023-09-27 20:11:19 -04:00
Anthony Fiddes aff064f714 Remove lazy-lock.json from .gitignore 2023-09-27 16:44:03 -07:00
tcld 0340f77200 Add documentation for custom which-key groups 2023-09-24 10:24:33 +02:00
Chris Patti d891f4ac5a
Merge pull request #436 from Chris-Gillis/telescope-config-typo-fix 2023-09-23 19:11:35 -04:00
Christopher Gillis 8443853cfe
Remove extra "r" Search Resume description 2023-09-23 12:10:51 -04:00
Chris Patti 4b31f8ef9e
Merge pull request #422 from saccarosium/master
Iterate over #420
2023-09-13 10:19:55 -04:00
Luca Saccarola 24885f2483 docs: remove archive installation 2023-09-13 16:14:58 +02:00
5 changed files with 323 additions and 101 deletions

18
.github/workflows/stylua.yml vendored Normal file
View File

@ -0,0 +1,18 @@
# Check Lua Formatting
name: Check Lua Formatting
on: pull_request
jobs:
stylua-check:
name: Stylua Check
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Stylua Check
uses: JohnnyMorganz/stylua-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check .

1
.gitignore vendored
View File

@ -2,4 +2,3 @@ tags
test.sh
.luarc.json
nvim
lazy-lock.json

View File

@ -20,7 +20,7 @@ Distribution Alternatives:
### Installation
> **NOTE**
> **NOTE**
> [Backup](#FAQ) your previous configuration (if any exists)
Requirements:
@ -32,35 +32,46 @@ Neovim's configurations are located under the following paths, depending on your
| OS | PATH |
| :- | :--- |
| Linux | `~/.config/nvim` |
| MacOS | `~/.config/nvim` |
| Windows | `%userprofile%\AppData\Local\nvim\` |
| Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` |
| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` |
#### Archive Installation
* On the home/landing page for the project find the green "`<> CODE`" button click it and select `Local > Download ZIP`.
* Extract the archive to the appropriate configuration path.
* Ensure your extraction method did not extract with a parent folder. For example in `~/.config/nvim` you should have `init.lua` not another folder called `kickstart.nvim`.
#### Git Clone Installation
From a terminal `cd`/`dir` to the configuration path and then run:
Clone kickstart.nvim:
- on Linux and Mac
```sh
git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim
# OR
gh repo clone nvim-lua/kickstart.nvim
git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
```
- on Windows (cmd)
```
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
```
- on Windows (powershell)
```
git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\
```
### Post Installation
Run the following command and then **you are ready to go**!
Start Neovim
```sh
nvim
```
The `Lazy` plugin manager will start automatically on the first run and install the configured plugins - as can be seen in the introduction video. After the installation is complete you can press `q` to close the `Lazy` UI and **you are ready to go**! Next time you run nvim `Lazy` will no longer show up.
If you would prefer to hide this step and run the plugin sync from the command line, you can use:
```sh
nvim --headless "+Lazy! sync" +qa
```
### Recommended Optional
### 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.
@ -144,11 +155,27 @@ Each PR, especially those which increase the line count, should have a descripti
* You should back it up, then delete all files associated with it.
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
* You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide)
* 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:
```
alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim'
```
When you run Neovim using `nvim-kickstart` alias it will use the alternative config directory and the matching local directory `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim distribution that you would like to try out.
* What if I want to "uninstall" this configuration:
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
* Are there any cool videos about this plugin?
* Current iteration of kickstart (coming soon)
* Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s). Note the install via init.lua no longer works as specified. Please follow the install instructions in this file instead as they're up to date.
* 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.
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
same functionality is available here:
* [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim)
* Discussions on this topic can be found here:
* [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218)
* [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473)
### Windows Installation

298
init.lua
View File

@ -37,13 +37,14 @@ I hope you enjoy your Neovim journey,
P.S. You can delete this when you're done too. It's your config now :)
--]]
-- 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 = ' '
-- Install package manager
-- [[ Install `lazy.nvim` plugin manager ]]
-- https://github.com/folke/lazy.nvim
-- `:help lazy.nvim.txt` for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
@ -59,6 +60,7 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
-- [[ Configure plugins ]]
-- NOTE: Here is where you install your plugins.
-- You can configure plugins using the `config` key.
--
@ -86,7 +88,7 @@ require('lazy').setup({
-- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
{ 'j-hui/fidget.nvim', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
@ -103,6 +105,7 @@ require('lazy').setup({
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
@ -125,19 +128,69 @@ require('lazy').setup({
},
on_attach = function(bufnr)
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git hunk' })
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
-- don't override the built-in and fugitive keymaps
local gs = package.loaded.gitsigns
vim.keymap.set({'n', 'v'}, ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
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, buffer = bufnr, desc = "Jump to next hunk"})
vim.keymap.set({'n', 'v'}, '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
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, buffer = bufnr, desc = "Jump to previous hunk"})
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,
},
},
@ -169,11 +222,9 @@ require('lazy').setup({
-- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt`
opts = {
char = '',
show_trailing_blankline_indent = false,
},
-- See `:help ibl`
main = 'ibl',
opts = {},
},
-- "gc" to comment visual regions/lines
@ -256,6 +307,7 @@ require('lazy').setup({
'mbbill/undotree',
'tpope/vim-surround',
'tpope/vim-commentary',
'github/copilot.vim',
-- 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.
@ -342,6 +394,12 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
@ -376,6 +434,42 @@ require('telescope').setup {
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
-- Telescope live_grep in git root
-- Function to find the git root directory based on the current buffer's path
local function find_git_root()
-- Use the current buffer's path as the starting point for the git search
local current_file = vim.api.nvim_buf_get_name(0)
local current_dir
local cwd = vim.fn.getcwd()
-- If the buffer is not associated with a file, return nil
if current_file == '' then
current_dir = cwd
else
-- Extract the directory from the current file's path
current_dir = vim.fn.fnamemodify(current_file, ':h')
end
-- Find the Git root directory from the current file's path
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
if vim.v.shell_error ~= 0 then
print 'Not a git repository. Searching on current working directory'
return cwd
end
return git_root
end
-- Custom live_grep function to search in git root
local function live_grep_git_root()
local git_root = find_git_root()
if git_root then
require('telescope.builtin').live_grep {
search_dirs = { git_root },
}
end
end
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
-- See `:help telescope.builtin`
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
@ -387,86 +481,92 @@ vim.keymap.set('n', '<leader>/', function()
})
end, { desc = '[/] Fuzzily search in current buffer' })
local function telescope_live_grep_open_files()
require('telescope.builtin').live_grep {
grep_open_files = true,
prompt_title = 'Live Grep in Open Files',
}
end
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sG', ':LiveGrepGitRoot<cr>', { desc = '[S]earch by [G]rep on Git Root' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]resume' })
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>sfn', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles [N]o Hidden' })
vim.keymap.set('n', '<leader>sfh', '<Cmd>Telescope find_files hidden=true no_ignore=true<Cr>', { desc = '[S]earch [F]iles [H]idden' })
-- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'lua', 'python', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash', 'css', 'dockerfile', 'html', 'java', 'kotlin', 'json', 'markdown_inline', 'ruby', 'rust', 'sql', 'toml', 'vue', 'yaml' },
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
vim.defer_fn(function()
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
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. 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,
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
textobjects = {
select = {
highlight = { enable = true },
indent = { enable = true },
incremental_selection = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<M-space>',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[']m'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
goto_previous_start = {
['[m'] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}
-- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
}
end, 0)
-- [[ Configure LSP ]]
-- This function gets run when an LSP connects to a particular buffer.
@ -488,10 +588,10 @@ local on_attach = function(_, bufnr)
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
@ -513,6 +613,29 @@ local on_attach = function(_, bufnr)
end, { desc = 'Format current buffer with LSP' })
end
-- document existing key chains
require('which-key').register {
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
}
-- register which-key VISUAL mode
-- required for visual <leader>hs (hunk stage) to work
require('which-key').register({
['<leader>'] = { name = 'VISUAL <leader>' },
['<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.
--
@ -533,6 +656,8 @@ local servers = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
},
},
}
@ -559,7 +684,7 @@ mason_lspconfig.setup_handlers {
settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
}
end
end,
}
-- [[ Configure nvim-cmp ]]
@ -575,10 +700,13 @@ cmp.setup {
luasnip.lsp_expand(args.body)
end,
},
completion = {
completeopt = 'menu,menuone,noinsert',
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
@ -607,7 +735,7 @@ cmp.setup {
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'vim-dadbod-completion' },
{ name = 'path' },
},
}
@ -654,13 +782,19 @@ vim.keymap.set('n', '<leader>nq', '<Cmd>DBUILastQueryInfo<Cr>', { desc = 'Last q
local mark = require('harpoon.mark')
local ui = require('harpoon.ui')
vim.keymap.set('n', '<leader>h', mark.add_file, { desc = 'Add file to harpoon'})
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-h>', function () ui.nav_file(1) end, { desc = 'Harpoon file 1'})
-- vim.keymap.set('n', '<C-h>', function () ui.nav_file(1) end, { desc = 'Harpoon file 1'})
vim.keymap.set('n', '<C-t>', function () ui.nav_file(2) end, { desc = 'Harpoon file 2'})
vim.keymap.set('n', '<C-n>', function () ui.nav_file(3) end, { desc = 'Harpoon file 3'})
vim.keymap.set('n', '<C-s>', function () ui.nav_file(4) end, { desc = 'Harpoon file 4'})
-- 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
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', {})

44
lazy-lock.json Normal file
View File

@ -0,0 +1,44 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "2463d687fe704b76eb0aa3bb34e95f69a5bb0362" },
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"copilot.vim": { "branch": "release", "commit": "5b19fb001d7f31c4c7c5556d7a97b243bd29f45f" },
"fidget.nvim": { "branch": "main", "commit": "a4a7edfea37e557dbff5509ee374ffb57051bba9" },
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
"gitsigns.nvim": { "branch": "main", "commit": "d195f0c35ced5174d3ecce1c4c8ebb3b5bc23fa9" },
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
"indent-blankline.nvim": { "branch": "master", "commit": "5da5546947f3125dfd6aa85ab21074dc83f776d5" },
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "56e435e09f8729af2d41973e81a0db440f8fe9c9" },
"mason.nvim": { "branch": "main", "commit": "a09da6ac634926a299dd439da08bdb547a8ca011" },
"neo-tree.nvim": { "branch": "main", "commit": "77d9f484b88fd380386b46ed9206e5374d69d9d8" },
"neodev.nvim": { "branch": "main", "commit": "7cb4f7f29c6bf6f1d21a37f6dd6d12ba64266b09" },
"noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
"nui.nvim": { "branch": "main", "commit": "80445d015d2b5f9af0d9e8bce63d303bc86eda8a" },
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-lspconfig": { "branch": "master", "commit": "9bedcfed749755e43fc8bed46f85ce2044fe3b77" },
"nvim-notify": { "branch": "master", "commit": "ebcdd8219e2a2cbc0a4bef68002f6867f1fde269" },
"nvim-treesitter": { "branch": "master", "commit": "e49f1e8ef3e8450a8446cb1f2bbb53c919f60b6d" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "0e2d5bd4cbe75849a013901555d436a48c6680cb" },
"nvim-web-devicons": { "branch": "master", "commit": "808627b8d412b2a6b6fc6eed816fec3557198b01" },
"onedark.nvim": { "branch": "master", "commit": "c5476a091b0f1b4e853db91c91ff941f848a1cdd" },
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
"undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" },
"vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" },
"vim-dadbod": { "branch": "master", "commit": "738cfc2ea6a1510fe23cba9006fef9291be70f7b" },
"vim-dadbod-completion": { "branch": "master", "commit": "c920cb0ba3dff4b1b0ed373e1c0b3007dec696c2" },
"vim-dadbod-ui": { "branch": "master", "commit": "9ddb0623e69d696b7a8355b93e3950a8dc6e00a0" },
"vim-fugitive": { "branch": "master", "commit": "59659093581aad2afacedc81f009ed6a4bfad275" },
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-tmux-navigator": { "branch": "master", "commit": "38b1d0402c4600543281dc85b3f51884205674b6" },
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" }
}