Compare commits

...

16 Commits

Author SHA1 Message Date
Julian Raufelder b9f1478645
Remove bufferline and add vim-surround and vim-commentary 2023-09-12 23:55:21 +02:00
Julian Raufelder f222270b9e
Add some further keybindinds and plugins 2023-09-12 23:55:08 +02:00
Julian Raufelder b175e98bde
Add some further keybindinds 2023-09-12 23:54:55 +02:00
Julian Raufelder aa1c2b31e7
Add further customizations 2023-09-12 23:54:39 +02:00
Julian Raufelder 966fa31055
Add vim-tmux-plugin 2023-09-12 23:51:56 +02:00
Julian Raufelder 1fd1d744d7
Further improvements 2023-09-12 23:51:43 +02:00
Julian Raufelder f7029b5b16
Add my customisations 2023-09-12 23:51:27 +02:00
Chris Patti c80a77488b
Merge pull request #420 from saccarosium/master
docs: restructure README
2023-09-07 02:30:09 -04:00
Chris Patti 6453352e25
Merge pull request #404 from e-aakash/lsp-goto-implementation
Use telescope for goto implementation
2023-09-07 02:29:31 -04:00
Chris Patti c010cc71d5
Merge pull request #406 from gangelop/git-keymaps
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
2023-09-06 16:58:20 -04:00
Chris Patti 304b2445cf
Merge pull request #419 from dilshod/patch-1
Add telescope search resume key binding
2023-09-05 15:38:14 -04:00
Luca Saccarola f3f6a595a2 docs: restructure README 2023-09-05 14:24:39 +02:00
Dilshod Temirkhodjaev ac9b167860
Add telescope search resume key binding 2023-09-04 17:36:28 +05:00
George Angelopoulos 38a0f03231 Revert gitsigns keymaps but fix vimdiff and fugitive conflict
Originally, the keymaps for jumping to next and previous git hunks were
]c and [c. This was changed in #323 (83b65a1) because they overwrote the
built-in vimdiff keymaps.

However, the more traditional solution is to have ]c and [c *extend* the
built-in keymap. This is what fugitive and gitgutter have been doing for
years.

Gitsigns doesn't do this by itself, but it has a recommended keymap
configuration on which the present patch is based:

	https://github.com/lewis6991/gitsigns.nvim#keymaps

The only thing I've added is to have the keymaps work in visual mode as
well, which is the same behavior as the built in vimdiff keymaps.
2023-08-22 07:17:15 +03:00
Chris Patti 1283a0bbe7
Update init.lua
Fix typo in original.

Co-authored-by: Luis G Estrades <luisgarciaestrades@gmail.com>
2023-08-21 17:19:13 -04:00
E. Aakash f00ff6f6ab Use telescope for goto implementation 2023-08-20 14:43:34 +05:30
3 changed files with 206 additions and 36 deletions

View File

@ -20,35 +20,52 @@ Distribution Alternatives:
### Installation ### Installation
* Backup your previous configuration (if any exists) > **NOTE**
> [Backup](#FAQ) your previous configuration (if any exists)
### Archive Installation Requirements:
* On the home/landing page for the project find the blue "<> CODE" button click it and select Local > Download ZIP. * Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
* Extract the archive to: * [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
`~/.config/nvim` (Linux) * See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
`~/.config/nvim` (MacOS)
`%userprofile%\AppData\Local\nvim\` (Windows)
* 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 Neovim's configurations are located under the following paths, depending on your OS:
* From a terminal cd/dir to:
`~/.config/nvim` (Linux)
`~/.config/nvim` (MacOS)
`%userprofile%\AppData\Local\nvim\` (Windows)
* Run: `git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim` OR: `gh repo clone nvim-lua/kickstart.nvim` | OS | PATH |
* Run Neovim (from terminal or shortcut) and allow lazy.nvim to download files and set up the basics. | :- | :--- |
* Once the setup is complete, restart Neovim. | Linux | `~/.config/nvim` |
* **You're ready to go!** | MacOS | `~/.config/nvim` |
| Windows | `%userprofile%\AppData\Local\nvim\` |
* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). #### Archive Installation
* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `%userprofile%\AppData\Local\nvim\` (Windows)
* If you don't want to include it as a git repo, you can just clone it and then move the files to this location
Additional system requirements: * On the home/landing page for the project find the green "`<> CODE`" button click it and select `Local > Download ZIP`.
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: * Extract the archive to the appropriate configuration path.
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. * 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`.
- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native`
#### Git Clone Installation
From a terminal `cd`/`dir` to the configuration path and then run:
```sh
git clone https://github.com/nvim-lua/kickstart.nvim.git ~/.config/nvim
# OR
gh repo clone nvim-lua/kickstart.nvim
```
### Post Installation
Run the following command and then **you are ready to go**!
```sh
nvim --headless "+Lazy! sync" +qa
```
### Recommended Optional
[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.
> **NOTE**
> Your fork's url will be something like this: `https://github.com/<your_github_username>/kickstart.nvim.git`
### Configuration And Extension ### Configuration And Extension

163
init.lua
View File

@ -124,9 +124,20 @@ require('lazy').setup({
changedelete = { text = '~' }, changedelete = { text = '~' },
}, },
on_attach = function(bufnr) on_attach = function(bufnr)
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' }) vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git 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)
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)
return '<Ignore>'
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
end, end,
}, },
}, },
@ -198,7 +209,55 @@ require('lazy').setup({
build = ':TSUpdate', build = ':TSUpdate',
}, },
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart {'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',
}
},
-- tmux vim keybindings
'christoomey/vim-tmux-navigator',
-- databse connections from within vim using DBGUI and DB
'tpope/vim-dadbod',
'kristijanhusak/vim-dadbod-ui',
'kristijanhusak/vim-dadbod-completion',
{
-- Highlight, edit, and navigate code
'ThePrimeagen/harpoon',
dependencies = {
'nvim-lua/plenary.nvim',
},
},
'mbbill/undotree',
'tpope/vim-surround',
'tpope/vim-commentary',
-- 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. -- These are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them. -- Uncomment any of the lines below to enable them.
-- require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.autoformat',
@ -223,14 +282,33 @@ vim.o.hlsearch = false
-- Make line numbers default -- Make line numbers default
vim.wo.number = true vim.wo.number = true
-- 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,
})
-- Enable mouse mode -- Enable mouse mode
vim.o.mouse = 'a' vim.o.mouse = 'a'
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- Enable break indent -- Enable break indent
vim.o.breakindent = true vim.o.breakindent = true
@ -286,6 +364,13 @@ require('telescope').setup {
}, },
}, },
}, },
pickers = {
live_grep = {
additional_args = function(opts)
return {"--hidden"}
end
},
},
} }
-- Enable telescope fzf native, if installed -- Enable telescope fzf native, if installed
@ -303,17 +388,19 @@ vim.keymap.set('n', '<leader>/', function()
end, { desc = '[/] Fuzzily search in current buffer' }) end, { desc = '[/] Fuzzily search in current buffer' })
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) 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>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', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) 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>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 ]] -- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter` -- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter -- 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' }, ensure_installed = { 'lua', 'python', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash', 'css', 'dockerfile', 'html', 'java', 'kotlin', 'json', 'markdown_inline', 'ruby', 'rust', 'sql', 'toml', 'vue', 'yaml' },
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false, auto_install = false,
@ -403,7 +490,7 @@ local on_attach = function(_, bufnr)
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') 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', vim.lsp.buf.type_definition, 'Type [D]efinition')
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') 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') nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
@ -520,8 +607,60 @@ cmp.setup {
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'luasnip' }, { name = 'luasnip' },
{ name = 'vim-dadbod-completion' },
}, },
} }
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et
--
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>f', '<Cmd>Neotree toggle<Cr>', { desc = 'Toggle NeoTree' })
-- database
vim.keymap.set('n', '<leader>nu', '<Cmd>DBUIToggle<Cr>', { desc = 'Toggle UI' })
vim.keymap.set('n', '<leader>nf', '<Cmd>DBUIFindBuffer<Cr>', { desc = 'Find buffer' })
vim.keymap.set('n', '<leader>nr', '<Cmd>DBUIRenameBuffer<Cr>', { desc = 'Rename buffer' })
vim.keymap.set('n', '<leader>nq', '<Cmd>DBUILastQueryInfo<Cr>', { desc = 'Last query info' })
-- harpoon
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', '<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-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'})

View File

@ -0,0 +1,14 @@
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
return {
"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,
}