mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
12 Commits
f308ccad7b
...
v0.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d40d87cb61 | ||
|
|
81663c8f3c | ||
|
|
2c7e4aa87a | ||
|
|
07dd60206b | ||
|
|
c3d4eb371b | ||
|
|
597a2aba80 | ||
|
|
f1f6d0b351 | ||
|
|
e1930ba153 | ||
|
|
a8db734e75 | ||
|
|
4026baef19 | ||
|
|
f63152f79b | ||
|
|
5229c460ea |
@@ -58,7 +58,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ Code, snippet, word auto-completion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp).
|
+ Code, snippet, word auto-completion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp).
|
||||||
+ Language server protocol (LSP) support via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
|
+ Language server protocol (LSP) support via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
|
||||||
+ Git integration via [vim-fugitive](https://github.com/tpope/vim-fugitive).
|
+ Git integration via [vim-fugitive](https://github.com/tpope/vim-fugitive).
|
||||||
+ Better escaping from insert mode via [better-escape.vim](https://github.com/jdhao/better-escape.vim).
|
+ Better escaping from insert mode via [better-escape.vim](https://github.com/nvim-zh/better-escape.vim).
|
||||||
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
|
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
|
||||||
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
|
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
|
||||||
+ Faster matching pair insertion and jump via [delimitMate](https://github.com/Raimondi/delimitMate).
|
+ Faster matching pair insertion and jump via [delimitMate](https://github.com/Raimondi/delimitMate).
|
||||||
@@ -75,7 +75,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
|
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
|
||||||
+ Code editing using true nvim inside browser via [firenvim](https://github.com/glacambre/firenvim).
|
+ Code editing using true nvim inside browser via [firenvim](https://github.com/glacambre/firenvim).
|
||||||
+ Beautiful colorscheme via [sainnhe/gruvbox-material](https://github.com/sainnhe/gruvbox-material) and other colorschemes.
|
+ Beautiful colorscheme via [sainnhe/gruvbox-material](https://github.com/sainnhe/gruvbox-material) and other colorschemes.
|
||||||
+ Markdown writing and previewing via [vim-markdown](https://github.com/plasticboy/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
+ Markdown writing and previewing via [vim-markdown](https://github.com/preservim/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
||||||
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex) <sup id="a1">[1](#f1)</sup>.
|
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex) <sup id="a1">[1](#f1)</sup>.
|
||||||
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
||||||
+ Smooth scroll experience via [neoscroll](https://github.com/karb94/neoscroll.nvim).
|
+ Smooth scroll experience via [neoscroll](https://github.com/karb94/neoscroll.nvim).
|
||||||
|
|||||||
@@ -47,10 +47,6 @@ if not vim.g.is_mac then
|
|||||||
vim.cmd [[language en_US.utf-8]]
|
vim.cmd [[language en_US.utf-8]]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- use filetype.lua instead of filetype.vim
|
|
||||||
vim.g.do_filetype_lua = 1
|
|
||||||
vim.g.did_load_filetypes = 0
|
|
||||||
|
|
||||||
-- Disable loading certain plugins
|
-- Disable loading certain plugins
|
||||||
|
|
||||||
-- Whether to load netrw by default, see https://github.com/bling/dotvim/issues/4
|
-- Whether to load netrw by default, see https://github.com/bling/dotvim/issues/4
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ set termguicolors
|
|||||||
" https://github.com/neovim/neovim/wiki/FAQ#how-to-change-cursor-color-in-the-terminal
|
" https://github.com/neovim/neovim/wiki/FAQ#how-to-change-cursor-color-in-the-terminal
|
||||||
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor20
|
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor20
|
||||||
|
|
||||||
set signcolumn=auto:2
|
set signcolumn=yes:1
|
||||||
|
|
||||||
" Remove certain character from file name pattern matching
|
" Remove certain character from file name pattern matching
|
||||||
set isfname-==
|
set isfname-==
|
||||||
|
|||||||
@@ -182,14 +182,7 @@ let g:neoformat_c_clangformat = {
|
|||||||
let g:neoformat_enabled_cpp = ['clangformat']
|
let g:neoformat_enabled_cpp = ['clangformat']
|
||||||
let g:neoformat_enabled_c = ['clangformat']
|
let g:neoformat_enabled_c = ['clangformat']
|
||||||
|
|
||||||
"""""""""""""""""""""""""vim-signify settings""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""vim-markdown settings"""""""""""""""""""
|
||||||
" The VCS to use
|
|
||||||
let g:signify_vcs_list = [ 'git' ]
|
|
||||||
|
|
||||||
" Change the sign for certain operations
|
|
||||||
let g:signify_sign_change = '~'
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""plasticboy/vim-markdown settings"""""""""""""""""""
|
|
||||||
" Disable header folding
|
" Disable header folding
|
||||||
let g:vim_markdown_folding_disabled = 1
|
let g:vim_markdown_folding_disabled = 1
|
||||||
|
|
||||||
@@ -311,11 +304,6 @@ if ( g:is_win || g:is_mac ) && executable('latex')
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""""""vim-startify settings""""""""""""""""""""""""""""
|
|
||||||
" Do not change working directory when opening files.
|
|
||||||
let g:startify_change_to_dir = 0
|
|
||||||
let g:startify_fortune_use_unicode = 1
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""vim-matchup settings"""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vim-matchup settings"""""""""""""""""""""""""""""
|
||||||
" Improve performance
|
" Improve performance
|
||||||
let g:matchup_matchparen_deferred = 1
|
let g:matchup_matchparen_deferred = 1
|
||||||
@@ -362,16 +350,20 @@ if exists('g:started_by_firenvim') && g:started_by_firenvim
|
|||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! s:setup_firenvim() abort
|
function s:setup_firenvim() abort
|
||||||
set noruler noshowcmd
|
set signcolumn=no
|
||||||
set laststatus=0 showtabline=0
|
set noruler
|
||||||
|
set noshowcmd
|
||||||
|
set laststatus=0
|
||||||
|
set showtabline=0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup firenvim
|
augroup firenvim
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType text call s:setup_firenvim()
|
autocmd BufEnter * call s:setup_firenvim()
|
||||||
autocmd BufNewFile github.com_*.txt set filetype=markdown
|
autocmd BufEnter sqlzoo*.txt set filetype=sql
|
||||||
autocmd BufNewFile stackoverflow.com_*.txt set filetype=markdown
|
autocmd BufEnter github.com_*.txt set filetype=markdown
|
||||||
|
autocmd BufEnter stackoverflow.com_*.txt set filetype=markdown
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
2
init.lua
2
init.lua
@@ -12,7 +12,7 @@ local api = vim.api
|
|||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
-- check if we have the latest stable version of nvim
|
-- check if we have the latest stable version of nvim
|
||||||
local expected_ver = "0.7.2"
|
local expected_ver = "0.8.0"
|
||||||
local nvim_ver = utils.get_nvim_version()
|
local nvim_ver = utils.get_nvim_version()
|
||||||
|
|
||||||
if nvim_ver ~= expected_ver then
|
if nvim_ver ~= expected_ver then
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ vim.api.nvim_create_autocmd('ColorScheme', {
|
|||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
hi GitSignsChangeInline guibg=fg guifg=bg
|
hi GitSignsChangeInline guibg=fg guifg=bg
|
||||||
|
hi GitSignsAddInline guibg=fg guifg=bg
|
||||||
|
hi GitSignsDeleteInline guibg=fg guifg=bg
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -33,11 +33,8 @@ local custom_attach = function(client, bufnr)
|
|||||||
end, { desc = "list workspace folder" })
|
end, { desc = "list workspace folder" })
|
||||||
|
|
||||||
-- Set some key bindings conditional on server capabilities
|
-- Set some key bindings conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
map("n", "<space>f", vim.lsp.buf.formatting_sync, { desc = "format code" })
|
map("n", "<space>f", vim.lsp.buf.format, { desc = "format code" })
|
||||||
end
|
|
||||||
if client.resolved_capabilities.document_range_formatting then
|
|
||||||
map("x", "<space>f", vim.lsp.buf.range_formatting, { desc = "range format" })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
api.nvim_create_autocmd("CursorHold", {
|
api.nvim_create_autocmd("CursorHold", {
|
||||||
@@ -56,9 +53,8 @@ local custom_attach = function(client, bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cursor_pos = api.nvim_win_get_cursor(0)
|
local cursor_pos = api.nvim_win_get_cursor(0)
|
||||||
if
|
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
|
||||||
(cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
|
and #vim.diagnostic.get() > 0
|
||||||
and #vim.diagnostic.get() > 0
|
|
||||||
then
|
then
|
||||||
vim.diagnostic.open_float(nil, float_opts)
|
vim.diagnostic.open_float(nil, float_opts)
|
||||||
end
|
end
|
||||||
@@ -68,7 +64,7 @@ local custom_attach = function(client, bufnr)
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- The blow command will highlight the current variable and its usages in the buffer.
|
-- The blow command will highlight the current variable and its usages in the buffer.
|
||||||
if client.resolved_capabilities.document_highlight then
|
if client.server_capabilities.documentHighlightProvider then
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
hi! link LspReferenceRead Visual
|
hi! link LspReferenceRead Visual
|
||||||
hi! link LspReferenceText Visual
|
hi! link LspReferenceText Visual
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ require("nvim-treesitter.configs").setup {
|
|||||||
ignore_install = {}, -- List of parsers to ignore installing
|
ignore_install = {}, -- List of parsers to ignore installing
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true, -- false will disable the whole extension
|
enable = true, -- false will disable the whole extension
|
||||||
disable = {}, -- list of language that will be disabled
|
disable = { 'help' }, -- list of language that will be disabled
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ vim.cmd("packadd packer.nvim")
|
|||||||
local packer = require("packer")
|
local packer = require("packer")
|
||||||
local packer_util = require("packer.util")
|
local packer_util = require("packer.util")
|
||||||
|
|
||||||
|
-- check if firenvim is active
|
||||||
|
local firenvim_not_active = function()
|
||||||
|
return not vim.g.started_by_firenvim
|
||||||
|
end
|
||||||
|
|
||||||
packer.startup {
|
packer.startup {
|
||||||
function(use)
|
function(use)
|
||||||
-- it is recommended to put impatient.nvim before any other plugins
|
-- it is recommended to put impatient.nvim before any other plugins
|
||||||
@@ -130,13 +135,19 @@ packer.startup {
|
|||||||
use {
|
use {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
|
cond = firenvim_not_active,
|
||||||
config = [[require('config.statusline')]],
|
config = [[require('config.statusline')]],
|
||||||
}
|
}
|
||||||
|
|
||||||
use { "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] }
|
use { "akinsho/bufferline.nvim", event = "VimEnter",
|
||||||
|
cond = firenvim_not_active,
|
||||||
|
config = [[require('config.bufferline')]] }
|
||||||
|
|
||||||
-- fancy start screen
|
-- fancy start screen
|
||||||
use { "glepnir/dashboard-nvim", event = "VimEnter", config = [[require('config.dashboard-nvim')]] }
|
use { "glepnir/dashboard-nvim", event = "VimEnter",
|
||||||
|
cond = firenvim_not_active,
|
||||||
|
config = [[require('config.dashboard-nvim')]]
|
||||||
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
@@ -236,7 +247,7 @@ packer.startup {
|
|||||||
use { "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] }
|
use { "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] }
|
||||||
|
|
||||||
-- Another markdown plugin
|
-- Another markdown plugin
|
||||||
use { "plasticboy/vim-markdown", ft = { "markdown" } }
|
use { "preservim/vim-markdown", ft = { "markdown" } }
|
||||||
|
|
||||||
-- Faster footnote generation
|
-- Faster footnote generation
|
||||||
use { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }
|
use { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }
|
||||||
@@ -251,9 +262,7 @@ packer.startup {
|
|||||||
if vim.g.is_win or vim.g.is_mac then
|
if vim.g.is_win or vim.g.is_mac then
|
||||||
use {
|
use {
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
run = function()
|
run = "cd app && npm install",
|
||||||
fn["mkdp#util#install"]()
|
|
||||||
end,
|
|
||||||
ft = { "markdown" },
|
ft = { "markdown" },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user