feat(nvim): Rework configuration from the ground up
This commit is contained in:
parent
90d4dc5ba5
commit
b1fcec3125
2
.config/nvim/.gitignore
vendored
Normal file
2
.config/nvim/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
lazy-lock.json
|
||||
undodir/**
|
@ -1,35 +0,0 @@
|
||||
{
|
||||
"suggest.noselect": true,
|
||||
"vetur.format.options.tabSize": 4,
|
||||
"vetur.format.options.useTabs": true,
|
||||
"rust-analyzer.procMacro.enable": true,
|
||||
"rust-analyzer.procMacro.attributes.enable": true,
|
||||
"rust-analyzer.diagnostics.disabled": ["unresolved-proc-macro"],
|
||||
"yaml.schemas": {
|
||||
"kubernetes": "/*.yaml"
|
||||
},
|
||||
"languageserver": {
|
||||
"bash": {
|
||||
"command": "bash-language-server",
|
||||
"args": ["start"],
|
||||
"filetypes": ["sh", "hbs"],
|
||||
"ignoredRootPaths": ["~"],
|
||||
"sql": {
|
||||
"module": "~/.node_modules/lib/node_modules/sql-language-server/dist/bin/cli.js",
|
||||
"args": ["up", "--method", "node-ipc"],
|
||||
"filetypes": ["sql", "mysql"]
|
||||
},
|
||||
"terraform": {
|
||||
"command": "terraform-ls",
|
||||
"args": ["serve"],
|
||||
"filetypes": ["terraform", "tf", "hcl"],
|
||||
"initializationOptions": {},
|
||||
"settings": {}
|
||||
},
|
||||
"efm": {
|
||||
"command": "efm-langserver",
|
||||
"args": [],
|
||||
"filetypes": ["vim"]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,165 +0,0 @@
|
||||
" TextEdit might fail if hidden is not set.
|
||||
set hidden
|
||||
|
||||
" Some servers have issues with backup files, see #649.
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Give more space for displaying messages.
|
||||
set cmdheight=2
|
||||
|
||||
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
" delays and poor user experience.
|
||||
set updatetime=300
|
||||
|
||||
" Don't pass messages to |ins-completion-menu|.
|
||||
set shortmess+=c
|
||||
|
||||
" 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
|
||||
|
||||
" 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
|
||||
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
||||
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 <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Formatting selected code.
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
augroup mygroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder.
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
" Applying codeAction to the selected region.
|
||||
" Example: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap keys for applying codeAction to the current buffer.
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Apply AutoFix to problem on the current line.
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Map function and class text objects
|
||||
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
xmap ic <Plug>(coc-classobj-i)
|
||||
omap ic <Plug>(coc-classobj-i)
|
||||
xmap ac <Plug>(coc-classobj-a)
|
||||
omap ac <Plug>(coc-classobj-a)
|
||||
|
||||
" Use CTRL-S for selections ranges.
|
||||
" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver
|
||||
nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
|
||||
" 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')
|
||||
|
||||
" Add (Neo)Vim's native statusline support.
|
||||
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
" provide custom statusline: lightline.vim, vim-airline.
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
|
||||
" Mappings for CoCList
|
||||
" Show all diagnostics.
|
||||
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions.
|
||||
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands.
|
||||
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document.
|
||||
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols.
|
||||
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list.
|
||||
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
inoremap <silent><expr> <C-x><C-z> coc#pum#visible() ? coc#pum#stop() : "\<C-x>\<C-z>"
|
||||
" remap for complete to use tab and <cr>
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ coc#pum#visible() ? coc#pum#next(1):
|
||||
\ <SID>check_back_space() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
inoremap <silent><expr> <space> coc#pum#visible() ? "<c-r>=coc#pum#confirm()\<CR> " : "\<space>"
|
||||
|
||||
hi CocSearch ctermfg=12 guifg=#18A3FF
|
||||
hi CocMenuSel ctermbg=109 guibg=#13354A
|
||||
|
@ -1,3 +1,5 @@
|
||||
require("keybindings")
|
||||
-- Install lazy.nvim plugin manager
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
@ -11,137 +13,13 @@ if not vim.loop.fs_stat(lazypath) then
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
{ "Shatur/neovim-ayu", lazy = false, enabled = true },
|
||||
"junegunn/fzf.vim",
|
||||
"yggdroot/indentline",
|
||||
"yuezk/vim-js",
|
||||
{ "neoclide/coc.nvim", branch = "release" },
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
}
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"jremmen/vim-ripgrep",
|
||||
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
}
|
||||
},
|
||||
"tpope/vim-fugitive",
|
||||
{ "rrethy/vim-hexokinase", build = "make hexokinase" },
|
||||
"mbbill/undotree",
|
||||
"skanehira/docker-compose.vim",
|
||||
"chr4/nginx.vim",
|
||||
"machakann/vim-highlightedyank",
|
||||
"godlygeek/tabular",
|
||||
"preservim/vim-markdown",
|
||||
"tpope/vim-obsession",
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
}
|
||||
}
|
||||
})
|
||||
require("lazy").setup("plugins")
|
||||
|
||||
--- THEMING ---
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
require('ayu').setup({
|
||||
mirage = true,
|
||||
overrides = function()
|
||||
if vim.o.background == "dark" then
|
||||
return {
|
||||
Normal = {
|
||||
bg = '#0f1419',
|
||||
fg = '#cbccc6'
|
||||
},
|
||||
Comment = { fg = "#5c6773" }
|
||||
}
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
require('ayu').colorscheme()
|
||||
|
||||
-- Change pane split styling
|
||||
vim.api.nvim_set_hl(0, "VertSplit", { link = "Conceal"})
|
||||
|
||||
--- Change default behaviour ---
|
||||
-- Disable integrated providers
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
vim.g.loaded_perl_provider = 0
|
||||
vim.g.loaded_node_provider = 0
|
||||
|
||||
-- Disable error bell
|
||||
vim.opt.errorbells = false
|
||||
|
||||
-- Hide emptyline ~
|
||||
vim.opt.fillchars = { eob = " " }
|
||||
|
||||
--- Tab configuration ---
|
||||
-- Show tabs at 4 spaces
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
|
||||
-- When indenting with '>', use 4 spaces
|
||||
vim.opt.shiftwidth = 4
|
||||
|
||||
-- Insert 4 spaces instead of tab
|
||||
vim.opt.expandtab = true
|
||||
|
||||
--- Line formatting ---
|
||||
vim.opt.nu = true
|
||||
vim.opt.wrap = false
|
||||
|
||||
--- Search configuration ---
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.ignorecase = true
|
||||
|
||||
--- Window configuration ---
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
-- Remove duplicate -- INSERT --
|
||||
vim.opt.showmode = false
|
||||
|
||||
--- Operation configuration ---
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = vim.fn.expand('~').."/.config/nvim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
--- Folding behaviour configuration ---
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldnestmax = 10
|
||||
vim.opt.foldenable = false
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.signcolumn = "no"
|
||||
|
||||
--- Miscellaneous ---
|
||||
-- rg smart root finder and adds git ignore loading for faster execution
|
||||
if vim.fn.executable("rg") == 1 then
|
||||
vim.g.rg_derive_root = true
|
||||
end
|
||||
|
||||
-- Disable mouse
|
||||
vim.opt.mouse = nil
|
||||
require("theming")
|
||||
|
||||
-- Source CoC configuration
|
||||
vim.cmd("source ~/.config/nvim/coc.vim")
|
||||
|
||||
-- IndentLine configuration
|
||||
vim.g.indentLine_enabled = 1
|
||||
vim.g.indentLine_char_list = {'|', '¦', '┆', '┊'}
|
||||
vim.g.indentLine_setColors = 1
|
||||
vim.g.indentLine_color_gui = "#5C6370"
|
||||
vim.g.indentLine_showFirstIndentLevel = 1
|
||||
--vim.cmd("source ~/.config/nvim/coc.vim")
|
||||
|
||||
-- Advertise 256 colors capability (for tmux)
|
||||
vim.t_Co = 256
|
||||
@ -150,75 +28,5 @@ vim.t_Co = 256
|
||||
--vim.&t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||
--vim.&t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
|
||||
--- Lualine ---
|
||||
-- Setup
|
||||
local custom_ayu_dark = require("lualine.themes.ayu_dark")
|
||||
|
||||
custom_ayu_dark.normal.c.bg = "#080b0d"
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = custom_ayu_dark,
|
||||
section_separators = { left = '', right = '' },
|
||||
component_separators = { left = '', right = '' },
|
||||
globalstatus = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
})
|
||||
|
||||
--- Bufferline (tabs) ---
|
||||
-- Setup
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "tabs",
|
||||
numbers = "ordinal",
|
||||
indicator = {
|
||||
style = "icon"
|
||||
},
|
||||
color_icons = true,
|
||||
show_close_icon = false,
|
||||
show_buffer_close_icons = false,
|
||||
show_duplicate_prefix = false,
|
||||
hover = {
|
||||
enabled = false
|
||||
},
|
||||
},
|
||||
highlights = {
|
||||
buffer_selected = {
|
||||
fg = "fg",
|
||||
bg = "bg",
|
||||
italic = false,
|
||||
},
|
||||
numbers_selected = {
|
||||
fg = "bg",
|
||||
bg = "fg"
|
||||
},
|
||||
indicator_selected = {
|
||||
fg = {
|
||||
attribute = "fg",
|
||||
highlight = "Identifier"
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
--- Treesitter ---
|
||||
require("nvim-treesitter.configs").setup {
|
||||
highlight = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
--- Telescope ---
|
||||
require("telescope-config")
|
||||
require("telescope-mappings")
|
||||
|
||||
require("keybindings")
|
||||
require("options")
|
||||
require("custom-args")
|
||||
|
@ -1,203 +0,0 @@
|
||||
call plug#begin('~/.config/nvim/plugged')
|
||||
" Ayu color scheme
|
||||
Plug 'https://git.halia.dev/therbron/ayu-vim'
|
||||
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
" Display indents
|
||||
Plug 'yggdroot/indentline'
|
||||
|
||||
Plug 'yuezk/vim-js'
|
||||
|
||||
" Autocompletion
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
|
||||
" File finder and live grep
|
||||
Plug 'nvim-telescope/telescope.nvim', {'branch': '0.1.x'}
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
|
||||
" File highlighter with wide language support
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
|
||||
" Grep utility for whole project
|
||||
Plug 'jremmen/vim-ripgrep'
|
||||
" Git integration
|
||||
Plug 'tpope/vim-fugitive'
|
||||
|
||||
Plug 'rrethy/vim-hexokinase', {'do': 'make hexokinase'}
|
||||
" Ctrl-z tree still history manager
|
||||
Plug 'mbbill/undotree'
|
||||
|
||||
" docker-compose wrapper
|
||||
Plug 'skanehira/docker-compose.vim'
|
||||
|
||||
" Nginx syntax highlighter
|
||||
Plug 'chr4/nginx.vim'
|
||||
|
||||
" Highlight indicator
|
||||
Plug 'machakann/vim-highlightedyank'
|
||||
|
||||
" Markdown preview in browser
|
||||
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
|
||||
|
||||
"" Markdown table formatter
|
||||
"Plug 'junegunn/vim-easy-align'
|
||||
|
||||
" Markdown formatting
|
||||
Plug 'godlygeek/tabular'
|
||||
Plug 'preservim/vim-markdown'
|
||||
|
||||
" React syntax highlighter
|
||||
|
||||
" i3 config checker
|
||||
Plug 'mboughaba/i3config.vim'
|
||||
|
||||
" Session restore
|
||||
Plug 'tpope/vim-obsession'
|
||||
|
||||
" Testing disable section
|
||||
"" Deprecated, replace by coc feature ?
|
||||
" Plug 'lervag/vimtex'
|
||||
" Plug 'ekalinin/Dockerfile.vim'
|
||||
|
||||
" Vim integration in tmux
|
||||
"Plug 'vimpostor/vim-tpipeline'
|
||||
call plug#end()
|
||||
|
||||
" Disable integrated providers
|
||||
let g:loaded_ruby_provider = 0
|
||||
let g:loaded_perl_provider = 0
|
||||
let g:loaded_node_provider = 0
|
||||
|
||||
syntax on
|
||||
|
||||
set noerrorbells
|
||||
filetype plugin indent on
|
||||
" show existing tab with 4 spaces width
|
||||
set tabstop=4 softtabstop=4
|
||||
" when indenting with '>', use 4 spaces width
|
||||
set shiftwidth=4
|
||||
" on pressng tab, insert 4 spaces
|
||||
set expandtab
|
||||
set smartindent
|
||||
set nu
|
||||
set nowrap
|
||||
set smartcase
|
||||
set noswapfile
|
||||
set nobackup
|
||||
set undodir=~/.config/nvim/undodir
|
||||
set undofile
|
||||
set incsearch
|
||||
|
||||
set splitright
|
||||
set splitbelow
|
||||
|
||||
" Remove the duplicate --INSERT-- information
|
||||
set noshowmode
|
||||
|
||||
" rg smart root founder and adds git ignore loading for faster execution
|
||||
if executable('rg')
|
||||
let g:rg_derive_root="true"
|
||||
endif
|
||||
|
||||
" let g:airline_powerline_fonts = 1
|
||||
|
||||
source ~/.config/nvim/coc.vim
|
||||
|
||||
let mapleader = " "
|
||||
|
||||
nnoremap <leader>h :wincmd h<CR>
|
||||
nnoremap <leader>j :wincmd j<CR>
|
||||
nnoremap <leader>k :wincmd k<CR>
|
||||
nnoremap <leader>l :wincmd l<CR>
|
||||
nnoremap <leader>u :UndotreeToggle<CR>
|
||||
|
||||
nnoremap <leader>1 1gt
|
||||
nnoremap <leader>2 2gt
|
||||
nnoremap <leader>3 3gt
|
||||
nnoremap <leader>4 4gt
|
||||
nnoremap <leader>5 5gt
|
||||
nnoremap <leader>6 6gt
|
||||
nnoremap <leader>7 7gt
|
||||
nnoremap <leader>8 8gt
|
||||
nnoremap <leader>9 9gt
|
||||
nnoremap <leader>0 10gt
|
||||
|
||||
nnoremap <C-p> <cmd>lua require"telescope-config".project_files()<cr>
|
||||
nnoremap <C-f> <cmd>Telescope live_grep<cr>
|
||||
|
||||
" Add folding shortcuts and settings
|
||||
set foldmethod=indent
|
||||
set foldnestmax=10
|
||||
set nofoldenable
|
||||
set foldlevel=99
|
||||
set signcolumn=no
|
||||
|
||||
" indentline configs
|
||||
let g:indentLine_enabled = 1
|
||||
let g:indentLine_char_list = ['|', '¦', '┆', '┊']
|
||||
let g:indentLine_setColors = 1
|
||||
let g:indentLine_color_gui = "#5C6370"
|
||||
let g:indentLine_showFirstIndentLevel = 1
|
||||
|
||||
" vimtex settings
|
||||
let g:tex_flavor = 'latex'
|
||||
let g:vimtex_view_method = 'zathura'
|
||||
let g:vimtex_compiler_latexmk = {
|
||||
\'build_dir': 'build',
|
||||
\}
|
||||
|
||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
|
||||
set background=dark
|
||||
set t_Co=256
|
||||
|
||||
" Ayu colors scheme settings
|
||||
set termguicolors
|
||||
let ayucolor="mirage"
|
||||
colorscheme ayu
|
||||
|
||||
" Syntastic default configuration
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{SyntasticStatuslineFlage()}
|
||||
set statusline+=%*
|
||||
|
||||
let g:syntastic_always_populate_loc_list = 1
|
||||
let g:syntastic_auto_loc_list = 1
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
" Neomutt configuration for nvim compatibility
|
||||
au BufRead /tmp/neomutt-* set tw=72
|
||||
|
||||
" Line wrapping shortcuts
|
||||
function! ToggleWrap()
|
||||
set wrap! linebreak! nolist!
|
||||
endfunction
|
||||
|
||||
nnoremap <leader>w :call ToggleWrap()<CR>
|
||||
|
||||
" Python configuration, Highlight self
|
||||
augroup python
|
||||
autocmd!
|
||||
autocmd FileType python
|
||||
\ syn keyword pythonSelf self
|
||||
\ | highlight def link pythonSelf Special
|
||||
|
||||
augroup end
|
||||
|
||||
" Markdown formatter macro
|
||||
nnoremap <leader>t :TableFormat<CR>
|
||||
|
||||
let g:coc_disable_startup_warning = 1
|
||||
set mouse=
|
||||
|
||||
" Lua config
|
||||
luafile $HOME/.config/nvim/lua/telescope-mappings.lua
|
||||
|
||||
" Add treesitter highlight
|
||||
lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}
|
5
.config/nvim/lua/.luarc.json
Normal file
5
.config/nvim/lua/.luarc.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"diagnostics.globals": [
|
||||
"vim"
|
||||
]
|
||||
}
|
@ -1,13 +1,9 @@
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
if vim.fn.argv(0) == 'p' then
|
||||
require("telescope-config").project_files()
|
||||
require("plugins/telescope/custom").project_files()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
if vim.fn.argv(0) == 'f' then
|
||||
require("telescope.builtin").live_grep()
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ map('', '<leader>u', ':UndotreeToggle<CR>')
|
||||
|
||||
--- Telescope ---
|
||||
-- List project files
|
||||
vim.keymap.set('', '<C-p>', function() require("telescope-config").project_files() end)
|
||||
vim.keymap.set('', '<C-p>', function() require("plugins/telescope/custom").project_files() end)
|
||||
|
||||
-- Grep through files in project
|
||||
vim.keymap.set('', '<C-f>', ":Telescope live_grep<CR>")
|
||||
|
63
.config/nvim/lua/options.lua
Normal file
63
.config/nvim/lua/options.lua
Normal file
@ -0,0 +1,63 @@
|
||||
--- Change default behaviour ---
|
||||
local tab_size = 2
|
||||
|
||||
-- Disable big separators
|
||||
vim.api.nvim_set_hl(0, "VertSplit", { link = "Conceal"})
|
||||
|
||||
-- Disable integrated providers
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
vim.g.loaded_perl_provider = 0
|
||||
vim.g.loaded_node_provider = 0
|
||||
|
||||
-- Disable error bell
|
||||
vim.opt.errorbells = false
|
||||
|
||||
-- Hide emptyline ~
|
||||
vim.opt.fillchars = { eob = " " }
|
||||
|
||||
--- Tab configuration ---
|
||||
-- Show tabs at tab_size spaces
|
||||
vim.opt.tabstop = tab_size
|
||||
vim.opt.softtabstop = tab_size
|
||||
|
||||
-- When indenting with '>', use tab_size spaces
|
||||
vim.opt.shiftwidth = tab_size
|
||||
|
||||
-- Insert 4 spaces instead of tab
|
||||
vim.opt.expandtab = true
|
||||
|
||||
--- Line formatting ---
|
||||
vim.opt.nu = true
|
||||
vim.opt.wrap = false
|
||||
|
||||
--- Search configuration ---
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.ignorecase = true
|
||||
|
||||
--- Window configuration ---
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
-- Remove duplicate -- INSERT --
|
||||
vim.opt.showmode = false
|
||||
|
||||
--- Operation configuration ---
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = vim.fn.expand('~').."/.config/nvim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
--- Folding behaviour configuration ---
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldnestmax = 10
|
||||
vim.opt.foldenable = false
|
||||
vim.opt.foldlevel = 99
|
||||
vim.opt.signcolumn = "no"
|
||||
|
||||
--- Miscellaneous ---
|
||||
-- rg smart root finder and adds git ignore loading for faster execution
|
||||
if vim.fn.executable("rg") == 1 then
|
||||
vim.g.rg_derive_root = true
|
||||
end
|
||||
|
||||
-- Disable mouse
|
||||
vim.opt.mouse = nil
|
18
.config/nvim/lua/plugins.lua
Normal file
18
.config/nvim/lua/plugins.lua
Normal file
@ -0,0 +1,18 @@
|
||||
return {
|
||||
"junegunn/fzf.vim", -- Fuzzy finder
|
||||
--"yuezk/vim-js", -- JS highlighter
|
||||
--{ "neoclide/coc.nvim", branch = "release" }, -- Language server host
|
||||
"tpope/vim-fugitive", -- Git integration
|
||||
{ "rrethy/vim-hexokinase", build = "make hexokinase" }, -- Color indicator
|
||||
"mbbill/undotree", -- Undo history and management
|
||||
"machakann/vim-highlightedyank", -- Yank highlighter
|
||||
--"skanehira/docker-compose.vim", -- Docker compose syntax highlight
|
||||
--"chr4/nginx.vim", -- Nginx syntax highlight
|
||||
--"godlygeek/tabular", -- Text alignment and table maker
|
||||
--"preservim/vim-markdown", -- Markdown formatter and highlighter
|
||||
--"tpope/vim-obsession", -- Session file
|
||||
--{
|
||||
-- "pearofducks/ansible-vim", -- Ansible highlighter
|
||||
-- build = "./UltiSnips/generate.sh"
|
||||
--}
|
||||
}
|
26
.config/nvim/lua/plugins/ayu.lua
Normal file
26
.config/nvim/lua/plugins/ayu.lua
Normal file
@ -0,0 +1,26 @@
|
||||
-- Color theme
|
||||
-- https://github.com/Shatur/neovim-ayu
|
||||
return {
|
||||
"Shatur/neovim-ayu",
|
||||
lazy = false,
|
||||
enabled = true,
|
||||
priority = 10000,
|
||||
config = function()
|
||||
require('ayu').setup({
|
||||
mirage = true,
|
||||
overrides = function()
|
||||
if vim.o.background == "dark" then
|
||||
return {
|
||||
Normal = {
|
||||
bg = '#0f1419',
|
||||
fg = '#cbccc6'
|
||||
},
|
||||
Comment = { fg = "#5c6773" }
|
||||
}
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
require('ayu').colorscheme()
|
||||
end
|
||||
}
|
43
.config/nvim/lua/plugins/bufferline.lua
Normal file
43
.config/nvim/lua/plugins/bufferline.lua
Normal file
@ -0,0 +1,43 @@
|
||||
-- Buffer line with tab page
|
||||
-- https://github.com/akinsho/bufferline.nvim
|
||||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "tabs",
|
||||
numbers = "ordinal",
|
||||
indicator = {
|
||||
style = "icon"
|
||||
},
|
||||
color_icons = true,
|
||||
show_close_icon = false,
|
||||
show_buffer_close_icons = false,
|
||||
show_duplicate_prefix = false,
|
||||
hover = {
|
||||
enabled = false
|
||||
},
|
||||
},
|
||||
highlights = {
|
||||
buffer_selected = {
|
||||
fg = "fg",
|
||||
bg = "bg",
|
||||
italic = false,
|
||||
},
|
||||
numbers_selected = {
|
||||
fg = "bg",
|
||||
bg = "fg"
|
||||
},
|
||||
indicator_selected = {
|
||||
fg = {
|
||||
attribute = "fg",
|
||||
highlight = "Identifier"
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
53
.config/nvim/lua/plugins/completions.lua
Normal file
53
.config/nvim/lua/plugins/completions.lua
Normal file
@ -0,0 +1,53 @@
|
||||
return {
|
||||
{
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
config = function()
|
||||
require("cmp").setup({
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
version = "v2.*",
|
||||
build = "make install_jsregexp",
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
-- { name = "nvim_lsp" },
|
||||
{ name = "luasnip" }, -- For luasnip users.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
13
.config/nvim/lua/plugins/indentline.lua.disabled
Normal file
13
.config/nvim/lua/plugins/indentline.lua.disabled
Normal file
@ -0,0 +1,13 @@
|
||||
-- Indent indicator
|
||||
-- https://github.com/Yggdroot/indentLine
|
||||
-- Should be revisited
|
||||
return {
|
||||
"yggdroot/indentline",
|
||||
config = function()
|
||||
vim.g.indentLine_enabled = 1
|
||||
vim.g.indentLine_char_list = {'|', '¦', '┆', '┊'}
|
||||
vim.g.indentLine_setColors = 1
|
||||
vim.g.indentLine_color_gui = "#5C6370"
|
||||
vim.g.indentLine_showFirstIndentLevel = 1
|
||||
end
|
||||
}
|
68
.config/nvim/lua/plugins/lsp-config.lua
Normal file
68
.config/nvim/lua/plugins/lsp-config.lua
Normal file
@ -0,0 +1,68 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
vim.keymap.set('n', '<leader>m', ":Mason<CR>", {})
|
||||
end
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
config = function()
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
"tsserver",
|
||||
"svelte"
|
||||
},
|
||||
automatic_installation = true
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.lua_ls.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
lspconfig.tsserver.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
lspconfig.svelte.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
lspconfig.rust_analyzer.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
lspconfig.docker_compose_language_service.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
|
||||
vim.keymap.set({'n', 'v'} , '<leader>ca', vim.lsp.buf.code_action, {})
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
config = function()
|
||||
require("telescope").setup {
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-- To get ui-select loaded and working with telescope, you need to call
|
||||
|
||||
-- load_extension, somewhere after setup function:
|
||||
require("telescope").load_extension("ui-select")
|
||||
end
|
||||
}
|
||||
}
|
36
.config/nvim/lua/plugins/lualine.lua
Normal file
36
.config/nvim/lua/plugins/lualine.lua
Normal file
@ -0,0 +1,36 @@
|
||||
-- Status line
|
||||
-- https://github.com/nvim-lualine/lualine.nvim
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
-- File and language icons
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
config = function()
|
||||
local custom_ayu_dark = require("lualine.themes.ayu_dark")
|
||||
custom_ayu_dark.normal.c.bg = "#080b0d"
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
theme = custom_ayu_dark,
|
||||
section_separators = { left = '', right = '' },
|
||||
component_separators = { left = '', right = '' },
|
||||
globalstatus = true
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
-- Only display the first mode letter (C>Command,N>Normal etc.)
|
||||
{'mode', fmt = function(str) return str:sub(1,1) end }
|
||||
},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {
|
||||
-- Show relative file path
|
||||
{'filename', path = 1}
|
||||
},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {},
|
||||
lualine_z = {'location'}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
23
.config/nvim/lua/plugins/neotree.lua
Normal file
23
.config/nvim/lua/plugins/neotree.lua
Normal file
@ -0,0 +1,23 @@
|
||||
-- File system explorer
|
||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim", -- Lua helper
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim"
|
||||
},
|
||||
config = function()
|
||||
vim.keymap.set('n', "<C-n>", ":Neotree filesystem toggle left<CR>")
|
||||
require("neo-tree").setup({
|
||||
window = {
|
||||
mappings = {
|
||||
["<C-t>"] = "open_tabnew",
|
||||
["<C-b>"] = "open_split",
|
||||
["<C-v>"] = "open_vsplit",
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
16
.config/nvim/lua/plugins/none-ls.lua
Normal file
16
.config/nvim/lua/plugins/none-ls.lua
Normal file
@ -0,0 +1,16 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
|
||||
end,
|
||||
}
|
14
.config/nvim/lua/plugins/telescope.lua
Normal file
14
.config/nvim/lua/plugins/telescope.lua
Normal file
@ -0,0 +1,14 @@
|
||||
-- File finder
|
||||
-- https://github.com/nvim-telescope/telescope.nvim
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim", -- Lua helper
|
||||
"jremmen/vim-ripgrep", -- Grep integration
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
config = function()
|
||||
require("plugins/telescope/mappings")
|
||||
end
|
||||
}
|
@ -3,6 +3,7 @@ require("telescope").setup{
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
-- Open selection in horizontal split
|
||||
["<C-b>"] = actions.select_horizontal,
|
||||
}
|
||||
}
|
17
.config/nvim/lua/plugins/treesitter.lua
Normal file
17
.config/nvim/lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,17 @@
|
||||
-- AST builder for parsers
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
enable = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
9
.config/nvim/lua/theming.lua
Normal file
9
.config/nvim/lua/theming.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
config = function()
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
--- LEGACY
|
||||
-- Change pane split styling
|
||||
vim.api.nvim_set_hl(0, "VertSplit", { link = "Conceal"})
|
||||
end
|
||||
}
|
Loading…
Reference in New Issue
Block a user