Merge pull request #2 from micaiah-effiong/feat/markdown-support

markdown support
sync with remote repo
This commit is contained in:
Micah Effiong 2023-10-22 01:22:44 +01:00 committed by GitHub
commit 724fdadbc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 191 additions and 107 deletions

View File

@ -20,42 +20,56 @@ 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 | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
* **You're ready to go!** | MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` |
| Windows | `%userprofile%\AppData\Local\nvim\` |
* (Recommended/Optional) Fork this repo (so that you have your own copy that you can modify). Clone kickstart.nvim:
* 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: ```sh
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular: # on Linux and Mac
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers. git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim
- See [Windows Installation](#Windows-Installation) if you have trouble with `telescope-fzf-native` ```
```
# on Windows
git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\
```
### Post Installation
Run the following command and then **you are ready to go**!
```sh
nvim --headless "+Lazy! sync" +qa
```
### 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.
> **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
* Inside of your copy, feel free to modify any file you like! It's your copy! * Inside of your copy, feel free to modify any file you like! It's your copy!
* Feel free to change any of the default options in `init.lua` to better suit your needs. * Feel free to change any of the default options in `init.lua` to better suit your needs.
* For adding plugins, there are 3 primary options: * For adding plugins, there are 3 primary options:
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` * Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim` (uncomment the line importing the `custom/plugins` directory in the `init.lua` file to enable this)
* Modify `init.lua` with additional plugins. * Modify `init.lua` with additional plugins.
* Include the `lua/kickstart/plugins/*` files in your configuration. * Include the `lua/kickstart/plugins/*` files in your configuration.

View File

@ -17,7 +17,9 @@ Kickstart.nvim is a template for your own configuration.
a guide. One possible example: a guide. One possible example:
- https://learnxinyminutes.com/docs/lua/ - https://learnxinyminutes.com/docs/lua/
And then you can explore or search through `:help lua-guide` And then you can explore or search through `:help lua-guide`
- https://neovim.io/doc/user/lua-guide.html
Kickstart Guide: Kickstart Guide:
@ -86,7 +88,7 @@ require('lazy').setup({
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { dependencies = {
-- Automatically install LSPs to stdpath for neovim -- Automatically install LSPs to stdpath for neovim
{ 'williamboman/mason.nvim', config = true }, 'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
-- Useful status updates for LSP -- Useful status updates for LSP
@ -117,7 +119,7 @@ require('lazy').setup({
-- Useful plugin to show you pending keybinds. -- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} }, { 'folke/which-key.nvim', opts = {} },
{ {
-- Adds git releated signs to the gutter, as well as utilities for managing changes -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
opts = { opts = {
-- See `:help gitsigns.txt` -- See `:help gitsigns.txt`
@ -129,10 +131,28 @@ 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, vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Preview git 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' }) -- don't override the built-in and fugitive keymaps
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' }) 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,
}, },
}, },
@ -164,19 +184,20 @@ require('lazy').setup({
-- Add indentation guides even on blank lines -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim` -- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt` -- See `:help ibl`
opts = { main = 'ibl',
char = '', opts = {},
show_trailing_blankline_indent = false,
},
}, },
-- "gc" to comment visual regions/lines -- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} }, { 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc) -- Fuzzy Finder (files, lsp, etc)
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system -- Only load if `make` is available. Make sure you have the system
-- requirements installed. -- requirements installed.
@ -189,6 +210,8 @@ require('lazy').setup({
return vim.fn.executable 'make' == 1 return vim.fn.executable 'make' == 1
end, end,
}, },
},
},
{ {
-- Highlight, edit, and navigate code -- Highlight, edit, and navigate code
@ -247,7 +270,6 @@ vim.wo.signcolumn = 'yes'
-- Decrease update time -- Decrease update time
vim.o.updatetime = 250 vim.o.updatetime = 250
vim.o.timeout = true
vim.o.timeoutlen = 300 vim.o.timeoutlen = 300
-- Set completeopt to have a better completion experience -- Set completeopt to have a better completion experience
@ -310,15 +332,23 @@ vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc
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]esume' })
-- [[ Configure Treesitter ]] -- [[ Configure Treesitter ]]
-- See `:help nvim-treesitter` -- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup { -- 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 -- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim',
'bash', 'markdown', 'markdown_inline' },
-- 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,
sync_install = true,
ignore_install = {},
modules = {},
highlight = { enable = true }, highlight = { enable = true },
indent = { enable = true }, indent = { enable = true },
@ -375,7 +405,8 @@ require('nvim-treesitter.configs').setup {
}, },
}, },
}, },
} }
end, 0)
-- Diagnostic keymaps -- 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_prev, { desc = 'Go to previous diagnostic message' })
@ -383,17 +414,37 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnos
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating 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' }) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
-- 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 = 'More git', _ = 'which_key_ignore' },
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
}
-- 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 -- Enable the following language servers
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- 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 -- 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. -- 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 = { local servers = {
-- clangd = {}, -- clangd = {},
-- gopls = {}, -- gopls = {},
-- pyright = {}, -- pyright = {},
-- rust_analyzer = {}, -- rust_analyzer = {},
-- tsserver = {}, -- tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
lua_ls = { lua_ls = {
Lua = { Lua = {
@ -423,6 +474,7 @@ mason_lspconfig.setup_handlers {
capabilities = capabilities, capabilities = capabilities,
on_attach = require('custom.utils'), on_attach = require('custom.utils'),
settings = servers[server_name], settings = servers[server_name],
filetypes = (servers[server_name] or {}).filetypes,
} }
end, end,
} }

View File

@ -0,0 +1,3 @@
return {
'jghauser/follow-md-links.nvim'
}

View File

@ -0,0 +1,15 @@
return {
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
-- build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
config = function()
vim.fn["mkdp#util#install"]()
end,
ft = { "markdown" },
}

View File

@ -19,10 +19,10 @@ local on_attach = function(_, bufnr)
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') 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('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', require('telescope.builtin').lsp_type_definitions, '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')