diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore new file mode 100644 index 0000000..582346d --- /dev/null +++ b/.config/nvim/.gitignore @@ -0,0 +1,2 @@ +lazy-lock.json +undodir/** diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json deleted file mode 100644 index 5efe8ff..0000000 --- a/.config/nvim/coc-settings.json +++ /dev/null @@ -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"] - } - } -} diff --git a/.config/nvim/coc.vim b/.config/nvim/coc.vim deleted file mode 100644 index 74f01b9..0000000 --- a/.config/nvim/coc.vim +++ /dev/null @@ -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 ' to make sure tab is not mapped by -" other plugin before putting this into your config. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion. -inoremap coc#refresh() - -" Use to confirm completion, `u` means break undo chain at current -" position. Coc only does snippet and additional edit on confirm. -" could be remapped by other vim plugin, try `:verbose imap `. -if exists('*complete_info') - inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" -else - inoremap pumvisible() ? "\" : "\u\" -endif - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window. -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - 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 rn (coc-rename) - -" Formatting selected code. -xmap f (coc-format-selected) -nmap f (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: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" Apply AutoFix to problem on the current line. -nmap qf (coc-fix-current) - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server. -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of LS, ex: coc-tsserver -nmap (coc-range-select) -xmap (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', ) - -" 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 a :CocList diagnostics -" Manage extensions. -nnoremap e :CocList extensions -" Show commands. -nnoremap c :CocList commands -" Find symbol of current document. -nnoremap o :CocList outline -" Search workspace symbols. -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list. -nnoremap p :CocListResume - -inoremap coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\" -inoremap coc#pum#visible() ? coc#pum#stop() : "\\" -" remap for complete to use tab and -inoremap - \ coc#pum#visible() ? coc#pum#next(1): - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" -inoremap coc#refresh() - -inoremap coc#pum#visible() ? "=coc#pum#confirm()\ " : "\" - -hi CocSearch ctermfg=12 guifg=#18A3FF -hi CocMenuSel ctermbg=109 guibg=#13354A - diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 1daedb3..4755055 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -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 = "\[38;2;%lu;%lu;%lum" --vim.&t_8b = "\[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") diff --git a/.config/nvim/legacy.vim b/.config/nvim/legacy.vim deleted file mode 100644 index 69599bd..0000000 --- a/.config/nvim/legacy.vim +++ /dev/null @@ -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 h :wincmd h -nnoremap j :wincmd j -nnoremap k :wincmd k -nnoremap l :wincmd l -nnoremap u :UndotreeToggle - -nnoremap 1 1gt -nnoremap 2 2gt -nnoremap 3 3gt -nnoremap 4 4gt -nnoremap 5 5gt -nnoremap 6 6gt -nnoremap 7 7gt -nnoremap 8 8gt -nnoremap 9 9gt -nnoremap 0 10gt - -nnoremap lua require"telescope-config".project_files() -nnoremap Telescope live_grep - -" 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 = "\[38;2;%lu;%lu;%lum" -let &t_8b = "\[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 w :call ToggleWrap() - -" 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 t :TableFormat - -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}} diff --git a/.config/nvim/lua/.luarc.json b/.config/nvim/lua/.luarc.json new file mode 100644 index 0000000..1e1765c --- /dev/null +++ b/.config/nvim/lua/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.globals": [ + "vim" + ] +} \ No newline at end of file diff --git a/.config/nvim/lua/custom-args.lua b/.config/nvim/lua/custom-args.lua index 220b846..a4d9efb 100644 --- a/.config/nvim/lua/custom-args.lua +++ b/.config/nvim/lua/custom-args.lua @@ -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 diff --git a/.config/nvim/lua/keybindings.lua b/.config/nvim/lua/keybindings.lua index 337630e..fdea44e 100644 --- a/.config/nvim/lua/keybindings.lua +++ b/.config/nvim/lua/keybindings.lua @@ -36,7 +36,7 @@ map('', 'u', ':UndotreeToggle') --- Telescope --- -- List project files -vim.keymap.set('', '', function() require("telescope-config").project_files() end) +vim.keymap.set('', '', function() require("plugins/telescope/custom").project_files() end) -- Grep through files in project vim.keymap.set('', '', ":Telescope live_grep") diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua new file mode 100644 index 0000000..d069183 --- /dev/null +++ b/.config/nvim/lua/options.lua @@ -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 diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..0aa177e --- /dev/null +++ b/.config/nvim/lua/plugins.lua @@ -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" + --} +} diff --git a/.config/nvim/lua/plugins/ayu.lua b/.config/nvim/lua/plugins/ayu.lua new file mode 100644 index 0000000..08275d3 --- /dev/null +++ b/.config/nvim/lua/plugins/ayu.lua @@ -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 +} diff --git a/.config/nvim/lua/plugins/bufferline.lua b/.config/nvim/lua/plugins/bufferline.lua new file mode 100644 index 0000000..ea740e2 --- /dev/null +++ b/.config/nvim/lua/plugins/bufferline.lua @@ -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 +} diff --git a/.config/nvim/lua/plugins/completions.lua b/.config/nvim/lua/plugins/completions.lua new file mode 100644 index 0000000..83918a3 --- /dev/null +++ b/.config/nvim/lua/plugins/completions.lua @@ -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({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = 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, + }, +} diff --git a/.config/nvim/lua/plugins/indentline.lua.disabled b/.config/nvim/lua/plugins/indentline.lua.disabled new file mode 100644 index 0000000..f2cd946 --- /dev/null +++ b/.config/nvim/lua/plugins/indentline.lua.disabled @@ -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 +} diff --git a/.config/nvim/lua/plugins/lsp-config.lua b/.config/nvim/lua/plugins/lsp-config.lua new file mode 100644 index 0000000..d6d1262 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp-config.lua @@ -0,0 +1,68 @@ +return { + { + "williamboman/mason.nvim", + config = function() + require("mason").setup() + vim.keymap.set('n', 'm', ":Mason", {}) + 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'} , '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 + } +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..a90071f --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -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 +} diff --git a/.config/nvim/lua/plugins/neotree.lua b/.config/nvim/lua/plugins/neotree.lua new file mode 100644 index 0000000..92bf014 --- /dev/null +++ b/.config/nvim/lua/plugins/neotree.lua @@ -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', "", ":Neotree filesystem toggle left") + require("neo-tree").setup({ + window = { + mappings = { + [""] = "open_tabnew", + [""] = "open_split", + [""] = "open_vsplit", + } + } + }) + end +} diff --git a/.config/nvim/lua/plugins/none-ls.lua b/.config/nvim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..aeab2f5 --- /dev/null +++ b/.config/nvim/lua/plugins/none-ls.lua @@ -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", "gf", vim.lsp.buf.format, {}) + end, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..9687137 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -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 +} diff --git a/.config/nvim/lua/telescope-config.lua b/.config/nvim/lua/plugins/telescope/custom.lua similarity index 100% rename from .config/nvim/lua/telescope-config.lua rename to .config/nvim/lua/plugins/telescope/custom.lua diff --git a/.config/nvim/lua/telescope-mappings.lua b/.config/nvim/lua/plugins/telescope/mappings.lua similarity index 80% rename from .config/nvim/lua/telescope-mappings.lua rename to .config/nvim/lua/plugins/telescope/mappings.lua index 6359113..38b9fc8 100644 --- a/.config/nvim/lua/telescope-mappings.lua +++ b/.config/nvim/lua/plugins/telescope/mappings.lua @@ -3,6 +3,7 @@ require("telescope").setup{ defaults = { mappings = { i = { + -- Open selection in horizontal split [""] = actions.select_horizontal, } } diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..a172fa2 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -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, +} diff --git a/.config/nvim/lua/theming.lua b/.config/nvim/lua/theming.lua new file mode 100644 index 0000000..1594673 --- /dev/null +++ b/.config/nvim/lua/theming.lua @@ -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 +}