BREAKING (nvim): Use lua config
- LazyVim - Replaced many plugins with lua versions - So much faster! - Added devicons - And more!
This commit is contained in:
parent
c03b639ed5
commit
93fadc0cbd
|
@ -1,3 +0,0 @@
|
|||
if has("nvim-0.6")
|
||||
au BufWritePost lua require('lint').try_lint()
|
||||
endif
|
|
@ -1,107 +0,0 @@
|
|||
" NOTE: To be deprecated in the future
|
||||
"
|
||||
" This file is only executed if we don't have nvim-0.5, if we do, lua LSP will
|
||||
" be used instead. See plugins.vim
|
||||
"
|
||||
" ==============
|
||||
" CoC Settings
|
||||
" ==============
|
||||
|
||||
" === coc installs ===
|
||||
" TODO: Track .config/coc in dotfiles so I can remove this
|
||||
" coc-go
|
||||
" coc-html
|
||||
" coc-snippets
|
||||
" coc-python
|
||||
" coc-marketplace
|
||||
|
||||
" coc-yank
|
||||
nnoremap <silent> <space>y :<C-u>CocList -A --normal yank<cr>
|
||||
|
||||
" Below is mostly or completely copied from coc's readme
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
" other plugin before putting this into your config.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
|
||||
" position. Coc only does snippet and additional edit on confirm.
|
||||
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
|
||||
if exists('*complete_info')
|
||||
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
else
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
endif
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming.
|
||||
nmap <F2> <Plug>(coc-rename)
|
||||
|
||||
" Formatting selected code.
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
|
||||
" Add `:Format` command to format current buffer.
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Add `:Fold` command to fold current buffer.
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" Add `:OR` command for organize imports of the current buffer.
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Mappings using CoCList:
|
||||
" Show all diagnostics.
|
||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions.
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands.
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document.
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols.
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list.
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
|
|
@ -0,0 +1 @@
|
|||
autocmd BufNewFile,BufRead *.moon set filetype=moon
|
|
@ -0,0 +1,3 @@
|
|||
setl tabstop=2
|
||||
setl shiftwidth=2
|
||||
setl softtabstop=2
|
|
@ -1 +0,0 @@
|
|||
source $HOME/iswsl.vim
|
|
@ -1,105 +0,0 @@
|
|||
" ================
|
||||
" General settings
|
||||
" ================
|
||||
|
||||
set number " Relative number lines can be toggled, see mappings.vim
|
||||
set mouse=a " allow mouse for all; TODO: I rarely use mouse (duh) so maybe remove this
|
||||
set cursorline " highlight current cursor line (this is SO GOOD)
|
||||
set showcmd " show incomplete commands
|
||||
set hlsearch " highlight search
|
||||
set wildmenu " command line's tab complete in a menu
|
||||
set noerrorbells " no beeps please
|
||||
set visualbell " flash screen instead
|
||||
set title " set window title to file name
|
||||
set incsearch " incrementally find next match while typing search
|
||||
set scrolloff=6 " screen lines to keep above and below cursor
|
||||
set sidescrolloff=8 " screen columns to keep on left and right of cursor
|
||||
set confirm " display confirmation when closing unsaved file
|
||||
set encoding=utf-8 " set encoding with Unicode
|
||||
set showmatch " match brackets when cursor is over it
|
||||
set mat=2 " how many tenths of second to blink when matching brackets
|
||||
set inccommand=nosplit " neovim only
|
||||
|
||||
" Indenting
|
||||
set autoindent " Keep indentation from previous line when RET (I think)
|
||||
set expandtab " AIUI, tab -> spaces
|
||||
set softtabstop=4 " indent by 2 spaces with tab
|
||||
set tabstop=4 " show existing tabs with 4 spaces width
|
||||
set shiftwidth=4 " Put or remove 4 spaces with using < and >
|
||||
set smarttab " Delete spaces at tabstop width
|
||||
set copyindent " Copy indentation from previous line
|
||||
|
||||
" Settings required from coc
|
||||
" Still keeping this if we're using lua+lsp instead of CoC because why not
|
||||
set hidden " Let's you switch to another file while current is unsaved.
|
||||
set cmdheight=2
|
||||
" set updatetime=300 " This is horrible - can't even finish reading those
|
||||
" messages before they disappear!
|
||||
" set shortmess+=c " This wouldve disabled ins-completion-menu messages
|
||||
" (see :help shortmes)
|
||||
" Always show the signcolumn, otherwise it would shift the text each time
|
||||
" diagnostics appear/become resolved.
|
||||
if has("patch-8.1.1564")
|
||||
" Recently vim can merge signcolumn and number column into one
|
||||
set signcolumn=number
|
||||
else
|
||||
set signcolumn=yes
|
||||
endif
|
||||
|
||||
" Bunch of shit really, spent *hours* trying to get tmux + nvim true colors to work
|
||||
" TODO: check has('termguicolors') and set a env var or something
|
||||
set termguicolors
|
||||
|
||||
" Let <left> <right> and h, l keys be able to move to previous or next line
|
||||
" when currently on start or end of line respectively
|
||||
set whichwrap+=<,>,h,l
|
||||
|
||||
" fold settings
|
||||
set foldenable
|
||||
set foldlevelstart=10
|
||||
set foldnestmax=10
|
||||
set foldmethod=manual
|
||||
set foldcolumn=2
|
||||
|
||||
" Set the swp, backup and undo settings
|
||||
set noswapfile
|
||||
set nobackup nowritebackup
|
||||
set undodir=~/.local/share/nvim/undodir/
|
||||
set undofile
|
||||
|
||||
" Ignore compiled files
|
||||
set wildignore=*.o,*~,*.pyc
|
||||
if has("win16") || has("win32")
|
||||
set wildignore+=.git\*,.hg\*,.svn\*
|
||||
else
|
||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
|
||||
endif
|
||||
|
||||
" Return to last edit position when opening files
|
||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||
|
||||
" highlight trailing whitespace
|
||||
match ErrorMsg '\s\+$'
|
||||
|
||||
" setting the shell for fish to bash
|
||||
if &shell =~# 'fish$'
|
||||
set shell=bash
|
||||
endif
|
||||
|
||||
" IsWSL function sourced in functions.vim, declared in ~/iswsl.vim
|
||||
" I think this is a neovim-only thing, +1 for neovim :smirk:
|
||||
if IsWSL()
|
||||
let g:clipboard = {
|
||||
\ 'name': 'WSLClip',
|
||||
\ 'copy': {
|
||||
\ '+': 'clip.exe',
|
||||
\ '*': 'clip.exe',
|
||||
\ },
|
||||
\ 'paste': {
|
||||
\ '+': 'pbpaste',
|
||||
\ '*': 'pbpaste',
|
||||
\ },
|
||||
\ 'cache_enabled': 0,
|
||||
\ }
|
||||
endif
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
vim.g.mapleader = [[ ]]
|
||||
vim.g.maplocalleader = [[;]]
|
||||
-- The cool thing about ';' is that it is at the same
|
||||
-- position as ':', the char used for commands.
|
||||
|
||||
require('loadlazy')
|
||||
|
||||
require('general')
|
||||
require('mappings')
|
||||
require('autocmds')
|
|
@ -1,11 +0,0 @@
|
|||
set nocompatible
|
||||
let mapleader=";" " setting leader key to ';'
|
||||
nmap , ;
|
||||
" ',' as leader key is useful in some occasions.
|
||||
|
||||
source $HOME/.config/nvim/functions.vim
|
||||
source $HOME/.config/nvim/general.vim
|
||||
source $HOME/.config/nvim/mappings.vim
|
||||
source $HOME/.config/nvim/autocmds.vim
|
||||
source $HOME/.config/nvim/plugins.vim
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
require('nvim-autopairs').setup({
|
||||
enable_check_bracket_line = false, -- Don't close pair when next char is a closing pair
|
||||
ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol
|
||||
})
|
||||
|
||||
-- require("nvim-autopairs.completion.compe").setup({
|
||||
-- map_cr = true, -- map <CR> on insert mode
|
||||
-- map_complete = true, -- it will auto insert `(` after select function or method item
|
||||
-- auto_select = false, -- auto select first item
|
||||
-- })
|
||||
|
||||
-- TODO: add fastwrap and other stuff support
|
|
@ -0,0 +1,62 @@
|
|||
local o = vim.opt
|
||||
|
||||
o.number = true
|
||||
o.mouse = "a"
|
||||
|
||||
o.cursorline = true -- highlight current cursor line (this is SO GOOD)
|
||||
o.showcmd = true -- show incomplete commands
|
||||
o.hlsearch = true -- highlight search
|
||||
o.wildmenu = true -- command line's tab complete in a menu
|
||||
o.errorbells = false-- no beeps please
|
||||
o.visualbell = true -- flash screen instead
|
||||
o.title = true -- set window title to file name
|
||||
o.incsearch = true -- incrementally find next match while typing search
|
||||
o.scrolloff = 6 -- screen lines to keep above and below cursor
|
||||
o.sidescrolloff = 8 -- screen columns to keep on left and right of cursor
|
||||
o.confirm = true
|
||||
o.showmatch = true
|
||||
|
||||
o.encoding = "utf-8"
|
||||
o.mat = 2
|
||||
o.inccommand = "nosplit" -- neovim only
|
||||
o.autoindent = true
|
||||
o.fileformat = "unix"
|
||||
|
||||
o.expandtab = true-- AIUI, tab -> spaces
|
||||
o.softtabstop = 4 -- indent by 2 spaces with tab
|
||||
o.tabstop = 4 -- show existing tabs with 4 spaces width
|
||||
o.shiftwidth=4 -- Put or remove 4 spaces with using < and >
|
||||
o.smarttab = true -- Delete spaces at tabstop width
|
||||
o.copyindent = true -- Copy indentation from previous line
|
||||
o.hidden = true -- Let's you switch to another file while current is unsaved.
|
||||
o.cmdheight = 2
|
||||
|
||||
-- Show LSP W/E hints on another column next to the line numbers
|
||||
o.signcolumn = "yes" -- Set to "number" will merge the LSP W/E hints with the number col
|
||||
|
||||
-- Bunch of shit really, spent *hours* trying to get tmux + nvim true colors to work
|
||||
o.termguicolors = true
|
||||
o.whichwrap:append '<,>,h,l'
|
||||
|
||||
-- fold settings
|
||||
o.foldenable = true
|
||||
o.foldlevelstart = 10
|
||||
o.foldnestmax = 10
|
||||
o.foldmethod = "manual"
|
||||
o.foldcolumn = "2"
|
||||
|
||||
-- Set the swp, backup and undo settings
|
||||
o.swapfile = false
|
||||
o.backup = false
|
||||
o.undodir = vim.fn.expand("~") .. "/.local/share/nvim/undodir/"
|
||||
o.undofile = true
|
||||
|
||||
-- Ignore compiled files
|
||||
o.wildignore = { "*.o", "*~", "*.pyc", "*/.git/*", "*/.hg/*", "*/.svn/*", "*/.DS_Store" }
|
||||
|
||||
-- Return to last edit position when opening files
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
pattern = "*", command = [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]]
|
||||
})
|
||||
|
||||
vim.cmd [[ match ErrorMsg '\s\+$' ]]
|
|
@ -1,6 +0,0 @@
|
|||
-- https://github.com/errata-ai/vale/releases
|
||||
require('lint').linters_by_ft = {
|
||||
markdown = {'codespell',},
|
||||
lua = {'luacheck',},
|
||||
python = {'codespell',},
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git", "clone", "--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git", "--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
vim.opt.completeopt = { "menuone", "noinsert", "noselect", "preview" }
|
||||
|
||||
require('lazy').setup('plugin_spec')
|
|
@ -0,0 +1,118 @@
|
|||
local silent = { silent = true }
|
||||
local function map(...) vim.keymap.set(...) end
|
||||
-- ==============-=
|
||||
-- Leader mappings
|
||||
-- ===============
|
||||
map("n", "<Leader>rn", '<cmd>set relativenumber!<cr>')
|
||||
-- Open all folds in current buffer (Reduce)
|
||||
map("n", "<Leader>z", "zR")
|
||||
-- The 3 mappings that I use most often out of all vim mappings :D
|
||||
map("n", "<Leader>w", "<cmd>w<CR>")
|
||||
map("n", "<Leader>x", "<cmd>xa<CR>")
|
||||
map("n", "<Leader>q", "<cmd>qa<CR>")
|
||||
-- Clear search
|
||||
map("n", "<Leader>nh", "<cmd>noh<CR>")
|
||||
-- Paste (rarely used because I commonly work in ssh'ed environments)
|
||||
map("n", "<Leader>pa", "+p")
|
||||
-- Show what registers contain
|
||||
map("n", "<Leader>rg", "<cmd>registers<CR>")
|
||||
|
||||
|
||||
-- =============================
|
||||
-- Normal and Universal Mappings
|
||||
-- =============================
|
||||
-- Close a buffer, useful when doing PlugInstall and then closing that
|
||||
-- Or is it close a window? frame? DAMN all this emacs terminology got me so
|
||||
-- confused
|
||||
map("n", "Q", "<cmd>q<CR>")
|
||||
|
||||
-- NOTE: These mappings Just Work in wsl so no need the extra binding like
|
||||
-- in vimrc, this is why you use neovim instead of vim ;)
|
||||
map("", "<M-j>", "<cmd>m+1<CR>==")
|
||||
map("", "<M-k>", "<cmd>m-2<CR>==")
|
||||
map("", "<M-J>", "<cmd>t.<CR>==")
|
||||
map("", "<M-K>", "<cmd>t.-1<CR>==")
|
||||
|
||||
-- ===============
|
||||
-- VIsual mappings
|
||||
-- ===============
|
||||
-- dot command in visual mode
|
||||
map("v", ".", "<cmd>normal.<CR>")
|
||||
|
||||
-- Move visual selection
|
||||
map("v", "J", "<cmd>m '>+1<CR>gv=gv")
|
||||
map("v", "K", "<cmd>m '<-2<CR>gv=gv")
|
||||
|
||||
-- Visual mode pressing * or # searches for the current selection
|
||||
map("v", "*", "<cmd><C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>", silent)
|
||||
map("v", "#", "<cmd><C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>", silent)
|
||||
|
||||
-- Keep text selected after indentation
|
||||
-- This is... really useful sometimes but annoying other times
|
||||
map("v", "<", "<gv")
|
||||
map("v", ">", ">gv")
|
||||
|
||||
|
||||
-- ==========================
|
||||
-- Window/Buffer/Tab mappings
|
||||
-- ==========================
|
||||
-- Better way to move between windows
|
||||
map("", "<C-j>", "<C-W>j")
|
||||
map("", "<C-k>", "<C-W>k")
|
||||
map("", "<C-h>", "<C-W>h")
|
||||
map("", "<C-l>", "<C-W>l")
|
||||
|
||||
-- Managing buffers
|
||||
-- map("n", "<leader>bd", "<cmd>bd<cr>") -- I now use moll/vim-bbye, see plugin_spec.lua
|
||||
map("n", "<leader>bn", "<cmd>bnext<cr>")
|
||||
map("n", "<leader>bp", "<cmd>bprev<cr>")
|
||||
|
||||
-- Useful mappings for managing tabs
|
||||
-- Tab create
|
||||
map("n", "<leader>tc", "<cmd>tabnew<cr>")
|
||||
map("n", "<leader>to", "<cmd>tabonly<cr>")
|
||||
-- Tab delete
|
||||
map("n", "<leader>td", "<cmd>tabclose<cr>")
|
||||
-- I rarely have >3 tabs, let alone organize their placements <cmd>D but it's here
|
||||
-- because why not
|
||||
map("n", "<leader>tm", "<cmd>tabmove<cr>")
|
||||
-- Switching tabs
|
||||
map("n", "<leader>tn", "<cmd>tabnext<cr>")
|
||||
map("n", "<leader>tp", "<cmd>tabprev<cr>")
|
||||
|
||||
|
||||
if vim.fn.has("macunix") == 1 then
|
||||
-- WTF?? (I checked using C-v in insert mode)
|
||||
-- TODO: Fix in tmux
|
||||
map("", "<C-@>", "<cmd>split term://fish<cr>i")
|
||||
else
|
||||
map("", "<C-`>", "<cmd>split term://fish<cr>i")
|
||||
end
|
||||
map("n", "<leader>t", "<cmd>echom 'Deprecated. Please use C-` instead'<cr>")
|
||||
map("t", "<Esc>", "<C-\\><C-n>")
|
||||
|
||||
-- SHUSH
|
||||
map("n", "<Leader>lsh", "<cmd>LspStop")
|
||||
map("n", "<Leader>lst", "<cmd>LspStart")
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.b.lsp_lines_enabled = false
|
||||
end
|
||||
})
|
||||
|
||||
map("n", "<Leader>lx", function()
|
||||
require("lsp_lines").toggle()
|
||||
-- Disable virtual_text since it's redundant due to lsp_lines.
|
||||
if vim.b.lsp_lines_enabled then
|
||||
-- IT was enabled, now it's disabled.
|
||||
vim.diagnostic.config({ virtual_text = true })
|
||||
vim.b.lsp_lines_enabled = false
|
||||
else
|
||||
vim.diagnostic.config({ virtual_text = false })
|
||||
vim.b.lsp_lines_enabled = true
|
||||
end
|
||||
end
|
||||
)
|
|
@ -0,0 +1,130 @@
|
|||
-- Used by Lazy.nvim in loadlazy.lua
|
||||
return {
|
||||
{ "dracula/vim", name = "dracula", init = function()
|
||||
-- THE most important nvim configuration
|
||||
vim.cmd("colorscheme dracula")
|
||||
end },
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
config = function()
|
||||
require("nvim-tree").setup({
|
||||
view = { width = 20, },
|
||||
-- renderer = { group_empty = true, },
|
||||
-- filters = { dotfiles = true, },
|
||||
})
|
||||
end
|
||||
},
|
||||
"tpope/vim-fugitive",
|
||||
"jreybert/vimagit", -- emacs' magit ✨
|
||||
"tpope/vim-surround", -- quoting and parenthesizing manipulation
|
||||
"tpope/vim-commentary", -- I'd rather not clog <Leader> mappings with nerd commentor
|
||||
"airblade/vim-gitgutter", -- Show git diff overview stuff in the left column
|
||||
{ -- Quickly jump to a symbol in buffer (one of my most used). Requires exuberant ctags
|
||||
"majutsushi/tagbar",
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>tt", "<cmd>TagbarToggle<CR>")
|
||||
vim.g.tagbar_width = 20
|
||||
end,
|
||||
},
|
||||
"bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks
|
||||
"tpope/vim-endwise", -- Add those 'endif'/'fi'/'done'
|
||||
{ "moll/vim-bbye", -- smart buffer closer
|
||||
config = function()
|
||||
vim.keymap.set("n", "<Leader>bd", "<cmd>Bdelete<cr>")
|
||||
vim.keymap.set("n", "<Leader>bx", "<cmd>Bwipeout<cr>") -- like bd but removes from jumplist
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons", lazy = true,
|
||||
enabled = vim.fn.has("nvim-0.7") == 1,
|
||||
config = function() require('plugins/icons') end,
|
||||
},
|
||||
{ -- STATUS LINE
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
|
||||
config = function() require('plugins/statusline') end,
|
||||
},
|
||||
{ -- Neat popout window to browse dirs and manipulate within the editor!
|
||||
"echasnovski/mini.files",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function() require('mini.files').setup() end,
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("indent_blankline").setup({
|
||||
-- These require treesitter
|
||||
-- show_current_context = true,
|
||||
-- show_current_context_start = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
--- File type, syntax, language helper plugins ---
|
||||
{
|
||||
url = "https://git.sr.ht/~torresjrjr/gemini.vim",
|
||||
-- ft = "gemini",
|
||||
},
|
||||
{ "cespare/vim-toml", },
|
||||
{ "blankname/vim-fish", },
|
||||
{
|
||||
url = "https://git.rawtext.club/slope-lang/slope-vim-syntax",
|
||||
-- ft = "slope",
|
||||
},
|
||||
{ "mzlogin/vim-markdown-toc", },
|
||||
{ "leafo/moonscript-vim", },
|
||||
|
||||
------ LSP and autopair plugins ------
|
||||
-- This plugin below is really good, but whenever I'm on a commented line,
|
||||
-- press o, press backspace, the line below is joined up above. You won't
|
||||
-- believe how long it took me to debug this problem and finally realize it's
|
||||
-- because of this plugin.
|
||||
-- "jiangmiao/auto-pairs",
|
||||
--
|
||||
-- So now I'm using this instead:
|
||||
-- windwp/nvim-autopairs - extremely customizable, written in lua -
|
||||
-- integrates wth hrsh7th/nvim-cmp
|
||||
-- For nvim < 0.5, use: townk/vim-autoclose
|
||||
"nvim-lua/plenary.nvim", -- Helper lua functions many plugins depend on
|
||||
{
|
||||
"mfussenegger/nvim-lint", enabled = vim.fn.has("nvim-0.6") == 1,
|
||||
config = function() require("plugins/linting") end,
|
||||
|
||||
},
|
||||
{ "windwp/nvim-autopairs", commit = vim.fn.has("nvim-0.7") == 1 and "b7672cd",
|
||||
config = function() require("plugins/autopair") end,
|
||||
},
|
||||
|
||||
-- Best IDE autocomplete setup ever
|
||||
-- Please see ./lua/complete.lua
|
||||
{ "neovim/nvim-lspconfig", config = function() require('plugins/lsp') end },
|
||||
{ "hrsh7th/cmp-nvim-lsp", dependencies = "neovim/nvim-lspconfig" },
|
||||
-- Completions of words in current buffer
|
||||
{ "hrsh7th/cmp-buffer", dependencies = "hrsh7th/nvim-cmp" },
|
||||
-- File paths
|
||||
{ "hrsh7th/cmp-path", dependencies = "hrsh7th/nvim-cmp" },
|
||||
-- Fire your way through the neovim cmd line
|
||||
{ "hrsh7th/cmp-cmdline", dependencies = "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-calc", dependencies = "hrsh7th/nvim-cmp" },
|
||||
-- 😏 :smirk:
|
||||
{ "hrsh7th/cmp-emoji", dependencies = "hrsh7th/nvim-cmp" },
|
||||
{ "mtoohey31/cmp-fish", dependencies = "hrsh7th/nvim-cmp" },
|
||||
{ "petertriho/cmp-git", dependencies = "hrsh7th/nvim-cmp" },
|
||||
-- τ long live \tau
|
||||
{ "kdheepak/cmp-latex-symbols", dependencies = "hrsh7th/nvim-cmp" },
|
||||
{ "dcampos/nvim-snippy", enabled = vim.fn.has("nvim-0.7") == 1 },
|
||||
{ "dcampos/cmp-snippy",
|
||||
enabled = vim.fn.has("nvim-0.7") == 1,
|
||||
dependencies = {"hrsh7th/nvim-cmp", "dcampos/nvim-snippy"},
|
||||
},
|
||||
{ "hrsh7th/nvim-cmp", config = function() require('plugins/complete') end },
|
||||
|
||||
"onsails/lspkind.nvim", -- Symbols in the completion
|
||||
{
|
||||
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||
config = function()
|
||||
require("lsp_lines").setup()
|
||||
vim.diagnostic.config({ virtual_lines = false })
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
require('nvim-autopairs').setup({
|
||||
enable_check_bracket_line = false, -- Don't close pair when next char is a closing pair
|
||||
ignored_next_char = "[%w%.]", -- will ignore alphanumeric and `.` symbol
|
||||
fast_wrap = {},
|
||||
})
|
|
@ -8,8 +8,27 @@ cmp.setup({
|
|||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = {
|
||||
border = "shadow",
|
||||
-- winhighlight = "Normal:CmpNormal",
|
||||
},
|
||||
documentation = {
|
||||
border = "shadow",
|
||||
-- winhighlight = "Normal:CmpDocNormal",
|
||||
}
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
if vim.tbl_contains({ 'path' }, entry.source.name) then
|
||||
local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label)
|
||||
if icon then
|
||||
vim_item.kind = icon
|
||||
vim_item.kind_hl_group = hl_group
|
||||
return vim_item
|
||||
end
|
||||
end
|
||||
return require('lspkind').cmp_format({ with_text = false })(entry, vim_item)
|
||||
end
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
||||
|
@ -79,3 +98,7 @@ cmp.event:on(
|
|||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
|
||||
-- Set the completion item color of unmatched portion to white
|
||||
-- Somehow it is set to black by default ever since I switched my config to lua.
|
||||
vim.api.nvim_set_hl(0, "CmpItemAbbr", { fg=vim.g['dracula#palette.fg'] })
|
|
@ -0,0 +1,40 @@
|
|||
-- Remember to install the Symbols Only font zip, then configure terminal to
|
||||
-- use that font too.
|
||||
-- Used by lazy, nvim-tree, and others
|
||||
|
||||
-- https://github.com/nvim-tree/nvim-web-devicons
|
||||
require'nvim-web-devicons'.setup {
|
||||
-- your personnal icons can go here (to override)
|
||||
-- you can specify color or cterm_color instead of specifying both of them
|
||||
-- DevIcon will be appended to `name`
|
||||
--
|
||||
-- globally enable different highlight colors per icon (default to true)
|
||||
-- if set to false all icons will have the default icon's color
|
||||
color_icons = true;
|
||||
-- globally enable default icons (default to false)
|
||||
-- will get overriden by `get_icons` option
|
||||
-- default = true;
|
||||
-- globally enable "strict" selection of icons - icon will be looked up in
|
||||
-- different tables, first by filename, and if not found by extension; this
|
||||
-- prevents cases when file doesn't have any extension but still gets some icon
|
||||
-- because its name happened to match some extension (default to false)
|
||||
strict = true;
|
||||
-- same as `override` but specifically for overrides by filename
|
||||
-- takes effect when `strict` is true
|
||||
override_by_filename = {
|
||||
[".gitignore"] = {
|
||||
icon = "",
|
||||
color = "#f1502f", -- Add the color so it's readable
|
||||
name = "Gitignore"
|
||||
}
|
||||
};
|
||||
-- same as `override` but specifically for overrides by extension
|
||||
-- takes effect when `strict` is true
|
||||
-- override_by_extension = {
|
||||
-- ["log"] = {
|
||||
-- icon = "",
|
||||
-- color = "#81e043",
|
||||
-- name = "Log"
|
||||
-- }
|
||||
-- };
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
-- https://github.com/errata-ai/vale/releases
|
||||
local lint = require('lint')
|
||||
lint.linters_by_ft = {
|
||||
markdown = {'codespell'},
|
||||
python = {'codespell'},
|
||||
mail = {'proselint'},
|
||||
template = {'proselint'},
|
||||
c = {'cpplint'},
|
||||
cpp = {'cpplint'},
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePost", { pattern = "*", callback = function() lint.try_lint() end })
|
|
@ -59,6 +59,7 @@ local servers = {
|
|||
"bashls", -- sudo npm i -g bash-language-server
|
||||
"vimls", -- sudo npm i -g vim-language-server
|
||||
"marksman", -- https://github.com/artempyanykh/marksman/releases
|
||||
"ccls", -- https://github.com/MaskRay/ccls/wiki
|
||||
}
|
||||
for _, lsp in pairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
|
@ -76,7 +77,6 @@ lspconfig.pylsp.setup{
|
|||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
-- formatCommand = {"black"},
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pylint = { enabled = true },
|
||||
|
@ -112,24 +112,23 @@ lspconfig.gopls.setup{
|
|||
usePlaceholders = true,
|
||||
}
|
||||
}
|
||||
-- https://github.com/sumneko/lua-language-server/wiki/Getting-Started#command-line
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#sumneko_lua
|
||||
lspconfig.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls
|
||||
lspconfig.lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
runtime = { version = 'LuaJIT' },
|
||||
-- Get the language server to recognize the `vim` global
|
||||
diagnostics = {
|
||||
globals = {'vim'},
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
local function lineinfo()
|
||||
local total = tostring(vim.fn.line('$'))
|
||||
-- Left pad the current line count to max width of this value, to avoid jittering
|
||||
return string.format("%"..total:len().."d", vim.fn.line('.'))..'/'..total
|
||||
end
|
||||
|
||||
local diagnostics_config = {
|
||||
'diagnostics',
|
||||
symbols = {error = 'E:', warn = 'W:', info = 'I:', hint = 'H:'},
|
||||
}
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '/', right = '/'},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {{ 'mode', fmt = function(str)
|
||||
if str == "NORMAL" then
|
||||
return "NORM"
|
||||
elseif str == "INSERT" then
|
||||
return "INS"
|
||||
elseif str == "COMMAND" then
|
||||
return "CMD"
|
||||
elseif str == "VISUAL" then
|
||||
return "VIS"
|
||||
elseif str == "REPLACE" then
|
||||
return "REP"
|
||||
elseif str == "VISUAL BLOCK" then
|
||||
return "VBL"
|
||||
elseif str == "TERMINAL" then
|
||||
return "TERM"
|
||||
elseif str == "SUBSTITUTE" then
|
||||
return "SUB"
|
||||
end
|
||||
return str
|
||||
end }},
|
||||
lualine_b = {'branch', 'diff'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', { 'fileformat',
|
||||
icons_enabled = true,
|
||||
symbols = { unix = 'LF', dos = 'CRLF', mac = 'CR', },
|
||||
}, 'filetype'},
|
||||
lualine_y = {diagnostics_config},
|
||||
lualine_z = {lineinfo},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {'brach', 'diff'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {diagnostics_config},
|
||||
lualine_y = {'searchcount'},
|
||||
lualine_z = {lineinfo},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {'nvim-tree'},
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
" ========
|
||||
" Mappings
|
||||
" ========
|
||||
|
||||
" === Leader Mappings ===
|
||||
" Leader is mapped to ';' in init.vim
|
||||
" Toggle relative number
|
||||
nnoremap <Leader>rn :set relativenumber!<CR>
|
||||
" Open all folds in current buffer (Reduce)
|
||||
nnoremap <Leader>z zR
|
||||
" The 3 mappings that I use most often out of all vim mappings :D
|
||||
nnoremap <Leader>w :w<CR>
|
||||
nnoremap <Leader>x :xa<CR>
|
||||
nnoremap <Leader>q :qa<CR>
|
||||
" Clear search
|
||||
nnoremap <Leader>nh :noh<CR>
|
||||
" Paste (rarely used because I commonly work in ssh'ed environments)
|
||||
nnoremap <Leader>pa "+p
|
||||
" Show what registers contain
|
||||
nnoremap <Leader>rg :registers<CR>
|
||||
|
||||
|
||||
" === Normal and Universal Mappings ===
|
||||
" Close a buffer, useful when doing PlugInstall and then closing that
|
||||
" Or is it close a window? frame? DAMN all this emacs terminology got me so
|
||||
" confused
|
||||
nnoremap Q :q<CR>
|
||||
|
||||
" NOTE: These mappings Just Work in wsl so no need the extra binding like
|
||||
" in vimrc, this is why you use neovim instead of vim ;)
|
||||
noremap <M-j> :m+1<CR>==
|
||||
noremap <M-k> :m-2<CR>==
|
||||
noremap <M-J> :t.<CR>==
|
||||
noremap <M-K> :t.-1<CR>==
|
||||
|
||||
|
||||
" === Visual Mappings ===
|
||||
" dot command in visual mode
|
||||
vnoremap . :normal.<CR>
|
||||
|
||||
" Move visual selection
|
||||
vnoremap J :m '>+1<CR>gv=gv
|
||||
vnoremap K :m '<-2<CR>gv=gv
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
|
||||
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>"
|
||||
|
||||
" Keep text selected after indentation
|
||||
" This is... really useful sometimes but annoying other times
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
|
||||
|
||||
" === Window/Buffer/Tab mappings ===
|
||||
" Better way to move between windows
|
||||
noremap <C-j> <C-W>j
|
||||
noremap <C-k> <C-W>k
|
||||
noremap <C-h> <C-W>h
|
||||
noremap <C-l> <C-W>l
|
||||
|
||||
" Managing buffers
|
||||
nnoremap <leader>bd :bd<cr>
|
||||
nnoremap <leader>bn :bnext<cr>
|
||||
nnoremap <leader>bp :bprev<cr>
|
||||
|
||||
" Useful mappings for managing tabs
|
||||
" Tab create
|
||||
nnoremap <leader>tc :tabnew<cr>
|
||||
nnoremap <leader>to :tabonly<cr>
|
||||
" Tab delete
|
||||
nnoremap <leader>td :tabclose<cr>
|
||||
" I rarely have >3 tabs, let alone organize their placements :D but it's here
|
||||
" because why not
|
||||
nnoremap <leader>tm :tabmove<cr>
|
||||
" Switching tabs
|
||||
nnoremap <leader>tn :tabnext<cr>
|
||||
nnoremap <leader>tp :tabprev<cr>
|
||||
|
||||
|
||||
" === Misc Mappings ===
|
||||
" Hooray for neovim :)))))
|
||||
" Terminal mappings
|
||||
if has('macunix')
|
||||
" WTF?? (I checked using C-v in insert mode)
|
||||
" TODO: Fix in tmux
|
||||
noremap <C-@> :split term://fish<cr>i
|
||||
else
|
||||
noremap <C-`> :split term://fish<cr>i
|
||||
endif
|
||||
" LOL!
|
||||
nnoremap <leader>t :echom 'Deprecated. Please use C-` instead'<cr>
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
|
||||
" Command mode mappings
|
||||
cnoremap <C-p> PlugInstall<cr>
|
||||
cnoremap <C-f> Format<cr>
|
||||
|
||||
" Quickly apply (n)vimrc changes
|
||||
" Does not load ftplugins though
|
||||
command! ReloadConfig so $HOME/.config/nvim/init.vim
|
||||
nnoremap <Leader>rc :ReloadConfig<cr>
|
||||
|
|
@ -1,248 +0,0 @@
|
|||
" ==========================
|
||||
" Plugins and their settings
|
||||
" ==========================
|
||||
"
|
||||
" === Plugin declarations ===
|
||||
call plug#begin(stdpath('data') . '/plugged')
|
||||
|
||||
" dracula color theme (THE most important plugin, yes)
|
||||
Plug 'dracula/vim', {'name': 'dracula'}
|
||||
Plug 'preservim/nerdtree' " Perhaps switch to nvim-tree when I drop
|
||||
" v0.5 support
|
||||
Plug 'Xuyuanp/nerdtree-git-plugin' " Show git statuses in NERDTree
|
||||
Plug 'Yggdroot/indentLine' " Show indentation levels with vertical bars
|
||||
Plug 'tpope/vim-fugitive' " git commands
|
||||
Plug 'jreybert/vimagit' " emacs' magit ✨
|
||||
Plug 'tpope/vim-surround' " quoting and parenthesizing manipulation
|
||||
Plug 'tpope/vim-commentary' " I'd rather not clog <Leader> mappings
|
||||
" with nerd commentor
|
||||
Plug 'itchyny/lightline.vim' " airline was throwing shitty errors so yeah.
|
||||
" Pretty and customizable status bar; faster than
|
||||
" other vim statusline plugins, for components
|
||||
" see below; TODO: switch to galaxyline, lualine
|
||||
" or express_line in the future?
|
||||
" Commented out because I realized I never use it (lol)
|
||||
" Plug 'mbbill/undotree' " undo tree
|
||||
Plug 'bling/vim-bufferline' " buffer line (one of my most used plugins!)
|
||||
Plug 'ctrlpvim/ctrlp.vim' " Quickly find a fine with fuzzy find
|
||||
" TODO: use telescope instead
|
||||
Plug 'airblade/vim-gitgutter' " Show git diff overview stuff in the left
|
||||
" column
|
||||
Plug 'majutsushi/tagbar' " Quickly jump to a symbol in buffer (one of my
|
||||
" most used). Requires exuberant ctags
|
||||
Plug 'tpope/vim-endwise' " Add those 'endif'/'fi'/'done'
|
||||
" TODO: work with nvim-cmp
|
||||
|
||||
" === File type, syntax, or language helper plugins ===
|
||||
" gemtext syntax highlighting; I know there are more popular alternatives but
|
||||
" this is the best IMO
|
||||
Plug 'https://git.sr.ht/~torresjrjr/gemini.vim' , { 'for': 'gemini' }
|
||||
Plug 'cespare/vim-toml' , { 'for': 'toml' }
|
||||
Plug 'blankname/vim-fish' , { 'for': 'fish' }
|
||||
Plug 'hedyhli/vim-bun' , { 'for': 'bun' }
|
||||
Plug 'https://git.rawtext.club/slope-lang/slope-vim-syntax' , { 'for': 'slope' }
|
||||
Plug 'mzlogin/vim-markdown-toc' , { 'for': 'markdown' }
|
||||
Plug 'leafo/moonscript-vim' , { 'for': 'moon' }
|
||||
|
||||
" beware, this<tab>
|
||||
" Plug 'github/copilot.vim'
|
||||
|
||||
" === LSP and autopair plugins ===
|
||||
" This plugin below is really good, but whenever I'm on a commented line,
|
||||
" press o, press backspace, the line below is joined up above. You won't
|
||||
" believe how long it took me to debug this problem and finally realize it's
|
||||
" because of this plugin.
|
||||
" Plug 'jiangmiao/auto-pairs'
|
||||
"
|
||||
" So now I'm using these instead:
|
||||
" 1. windwp/nvim-autopairs - extremely customizable, written in lua -
|
||||
" integrates wth hrsh7th/nvim-cmp
|
||||
" 2. townk/vim-autoclose - fallback if nvim < v0.5
|
||||
if has('nvim-0.5')
|
||||
Plug 'nvim-lua/plenary.nvim' " Helper lua functions many plugins depend on
|
||||
Plug 'mfussenegger/nvim-lint'
|
||||
|
||||
if has('nvim-0.7')
|
||||
Plug 'windwp/nvim-autopairs'
|
||||
else
|
||||
Plug 'windwp/nvim-autopairs', { 'commit': 'b7672cd' }
|
||||
endif
|
||||
" Best IDE autocomplete setup ever
|
||||
" Please see ./lua/complete.lua
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'hrsh7th/cmp-buffer' " Completions of words in current buffer
|
||||
Plug 'hrsh7th/cmp-path' " File paths
|
||||
Plug 'hrsh7th/cmp-cmdline' " Fire your way through the neovim cmd line
|
||||
Plug 'hrsh7th/cmp-calc'
|
||||
Plug 'hrsh7th/cmp-emoji' " 😏 :smirk:
|
||||
Plug 'mtoohey31/cmp-fish', { 'for': 'fish' }
|
||||
Plug 'petertriho/cmp-git'
|
||||
Plug 'kdheepak/cmp-latex-symbols' " τ long live \tau
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
" Snippets
|
||||
if has('nvim-0.7')
|
||||
Plug 'dcampos/nvim-snippy'
|
||||
Plug 'dcampos/cmp-snippy'
|
||||
endif
|
||||
else
|
||||
Plug 'townk/vim-autoclose'
|
||||
" Picking the right LSP completion method, see bottom of file for more
|
||||
if has('node')
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
endif
|
||||
endif
|
||||
|
||||
call plug#end()
|
||||
" Plugin declarations ends here
|
||||
|
||||
|
||||
colorscheme dracula " THE most important nvim configuration
|
||||
|
||||
|
||||
" === Statusline ✨ ===
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'dracula',
|
||||
\ 'mode_map': {
|
||||
\ 'n' : 'NORM',
|
||||
\ 'i' : 'INS',
|
||||
\ 'R' : 'REP',
|
||||
\ 'v' : 'VIS',
|
||||
\ 'V' : 'VL',
|
||||
\ "\<C-v>": 'VB',
|
||||
\ 'c' : 'C',
|
||||
\ 's' : 'S',
|
||||
\ 'S' : 'SL',
|
||||
\ "\<C-s>": 'SB',
|
||||
\ 't': 'T',
|
||||
\ },
|
||||
\ 'component': {
|
||||
\ 'tagbar': '%{tagbar#currenttag("[%s]", "")}',
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'LightlineFugitive',
|
||||
\ 'diagnosticscount': 'LightlineDiagnostics',
|
||||
\ 'morelineinfo': 'LightlineMoreLineinfo',
|
||||
\ },
|
||||
\ 'component_type': {
|
||||
\ 'diagnosticscount': 'error',
|
||||
\ },
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['tagbar'] ],
|
||||
\ 'right': [ [ 'diagnosticscount' ], ['morelineinfo'], ['fileformat', 'fileencoding', 'filetype'] ]
|
||||
\ },
|
||||
\ }
|
||||
|
||||
function! LightlineMoreLineinfo()
|
||||
" Like lineinfo but appends total line number and removes col num:
|
||||
" 123/200 (cur line / total lines)
|
||||
" This shows current line and total lines together at a glimpse.
|
||||
" NOTE: Current col number can be obtained using g<C-g>.
|
||||
" The col number is used less than current line number, plus the value
|
||||
" updates at every keystroke, hence it doesn't make the status bar very
|
||||
" performant, so it isn't included in the status line.
|
||||
return printf("%7s", line('.').'/'.line('$'))
|
||||
" Left pad so his component doesn't need dynamic widths - makes status bar
|
||||
" appear to glitch less.
|
||||
endfunction
|
||||
|
||||
function! LightlineFugitive()
|
||||
" Referenced from Lightline docs; I'm not 100% sure what this does but seems
|
||||
" like it just grabs the current git branch
|
||||
try
|
||||
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' &&
|
||||
\ exists('*FugitiveHead')
|
||||
let mark = '' " I'm not sure what this mark does either
|
||||
let branch = FugitiveHead()
|
||||
return branch !=# '' ? mark.branch : ''
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! GetDiagnosticCount(level)
|
||||
return len(luaeval('vim.diagnostic.get(0, {severity = vim.diagnostic.severity.' . a:level . '})'))
|
||||
endfunction
|
||||
|
||||
function! LightlineDiagnostics()
|
||||
" Grabs the current buffer's diagnostics count and displays it in the
|
||||
" format 'E:x W:x i:x h:x'
|
||||
" If all 4 types of diagnostics are 0 then don't display anything
|
||||
if !has('nvim-0.5')
|
||||
" TODO: if we don't have nvim-0.5 then call some CoC function?
|
||||
return '!0.5'
|
||||
endif
|
||||
|
||||
let errors = GetDiagnosticCount('ERROR')
|
||||
let warnings = GetDiagnosticCount('WARN')
|
||||
let infos = GetDiagnosticCount('INFO')
|
||||
let hints = GetDiagnosticCount('HINT')
|
||||
if (errors + warnings + infos + hints) == 0
|
||||
return '' " Exit early even though this case is handled below
|
||||
endif
|
||||
|
||||
let string = ''
|
||||
if errors != 0
|
||||
let string = string . 'E:' . errors . ' '
|
||||
endif
|
||||
if warnings != 0
|
||||
let string = string . 'W:' . warnings . ' '
|
||||
endif
|
||||
if infos != 0
|
||||
let string = string . 'i:' . infos . ' '
|
||||
endif
|
||||
if hints != 0
|
||||
let string = string . 'h:' . hints . ' '
|
||||
endif
|
||||
|
||||
return substitute(string, '\s$', '', '') " Strip trailing whitespace
|
||||
endfunction
|
||||
|
||||
|
||||
" === Other plugins' settings ===
|
||||
let NERDTreeWinSize = 20
|
||||
" Open current dir in nerdtree
|
||||
noremap <Leader>nf :NERDTreeFind<CR>
|
||||
noremap <Leader>nt :NERDTreeToggle<CR>
|
||||
|
||||
" NerdTree Git plugin
|
||||
let g:NERDTreeGitStatusIndicatorMapCustom = {
|
||||
\ "Modified" : "M",
|
||||
\ "Staged" : "A",
|
||||
\ "Untracked" : "?",
|
||||
\ "Renamed" : "R",
|
||||
\ "Unmerged" : "═",
|
||||
\ "Deleted" : "D",
|
||||
\ "Dirty" : "X",
|
||||
\ "Clean" : "✔︎",
|
||||
\ 'Ignored' : 'i',
|
||||
\ "Unknown" : "?"
|
||||
\ }
|
||||
|
||||
" tagbar
|
||||
nnoremap <leader>tt :TagbarToggle<CR>
|
||||
let g:tagbar_width = 20
|
||||
|
||||
" Make indentLine still work, but disable conceal characters. eg, hiding the
|
||||
" asterisks for a bold text in markdown is extremely annoying when you want to
|
||||
" delete or change those asterisks.
|
||||
let g:markdown_syntax_conceal=0
|
||||
let g:vim_json_conceal=0
|
||||
|
||||
" === LSP ===
|
||||
if has("nvim-0.5")
|
||||
" Set completeopt to have a better completion experience
|
||||
set completeopt=menuone,noinsert,noselect,preview
|
||||
lua require('autopair')
|
||||
lua require('lsp')
|
||||
lua require('complete')
|
||||
if has('nvim-0.6')
|
||||
lua require('linting')
|
||||
endif
|
||||
else
|
||||
if has('node')
|
||||
source $HOME/.config/nvim/coc.vim
|
||||
endif
|
||||
endif
|
||||
|
Loading…
Reference in New Issue