summaryrefslogtreecommitdiff
path: root/neovim/.config/nvim
diff options
context:
space:
mode:
authorRafael Marçalo <raroma09@gmail.com>2023-06-09 02:51:32 +0100
committerRafael Marçalo <raroma09@gmail.com>2023-06-09 02:51:32 +0100
commitfe929b42a3daa19660ea62ba6405b52b2f19bf12 (patch)
tree93dc98b910d25ea8c66c93edbdd3a328045422a9 /neovim/.config/nvim
parentabc726c71e8f604f57069be2c513ad5b1a4a50a4 (diff)
Updated neovim configs and plugins
Diffstat (limited to 'neovim/.config/nvim')
-rw-r--r--neovim/.config/nvim/confs/coc.vim37
-rwxr-xr-x[-rw-r--r--]neovim/.config/nvim/confs/generic.vim27
-rw-r--r--neovim/.config/nvim/confs/gitgutter.vim6
-rw-r--r--neovim/.config/nvim/confs/gitmessenger.vim4
-rwxr-xr-xneovim/.config/nvim/confs/gitsigns.vim19
-rw-r--r--neovim/.config/nvim/confs/hexokinase.vim1
-rwxr-xr-xneovim/.config/nvim/confs/hover.vim25
-rwxr-xr-xneovim/.config/nvim/confs/keybinds.vim46
-rwxr-xr-xneovim/.config/nvim/confs/nvimlsp.vim79
-rwxr-xr-x[-rw-r--r--]neovim/.config/nvim/confs/nvimtree.vim43
-rw-r--r--neovim/.config/nvim/confs/taglist.vim3
-rw-r--r--neovim/.config/nvim/confs/whichkey.vim3
-rwxr-xr-x[-rw-r--r--]neovim/.config/nvim/init.vim47
13 files changed, 214 insertions, 126 deletions
diff --git a/neovim/.config/nvim/confs/coc.vim b/neovim/.config/nvim/confs/coc.vim
deleted file mode 100644
index 033d490..0000000
--- a/neovim/.config/nvim/confs/coc.vim
+++ /dev/null
@@ -1,37 +0,0 @@
-" Use tab for trigger completion with characters ahead and navigate.
-" NOTE: There's always complete item selected by default, you may want to enable
-" no select by `"suggest.noselect": true` in your configuration file.
-" 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>
- \ coc#pum#visible() ? coc#pum#next(1) :
- \ CheckBackspace() ? "\<Tab>" :
- \ coc#refresh()
-inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
-
-" Make <CR> to accept selected completion item or notify coc.nvim to format
-" <C-g>u breaks current undo, please make your own choice.
-inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
- \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
-
-function! CheckBackspace() abort
- let col = col('.') - 1
- return !col || getline('.')[col - 1] =~# '\s'
-endfunction
-
-" Use K to show documentation in preview window.
-nnoremap <silent> H :call ShowDocumentation()<CR>
-
-function! ShowDocumentation()
- if CocAction('hasProvider', 'hover')
- call CocActionAsync('doHover')
- else
- call feedkeys('H', 'in')
- 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)
diff --git a/neovim/.config/nvim/confs/generic.vim b/neovim/.config/nvim/confs/generic.vim
index 6e1795a..fa7547e 100644..100755
--- a/neovim/.config/nvim/confs/generic.vim
+++ b/neovim/.config/nvim/confs/generic.vim
@@ -14,11 +14,13 @@ set wildmode=longest,list,full
set relativenumber
set termguicolors
set complete=.,w,b,u,t
-set completeopt=menuone,noselect
+set completeopt=menu,menuone,noselect
set laststatus=1
-" Leader Key
-let mapleader="."
+" Highlight Colors
+highlight Pmenu ctermbg=none guibg=none
+highlight ColorColumn ctermbg=gray guibg=gray
+highlight GitSignsCurrentLineBlame ctermfg=lightgray guifg=lightgray
" Remove trailing whitespace on save
autocmd BufWritePre * %s/\s\+$//e
@@ -26,22 +28,5 @@ autocmd BufWritePre * %s/\s\+$//e
" Use system clipboard
set clipboard+=unnamedplus
-" Move between splits
-map <A-h> <C-w>h
-map <A-j> <C-w>j
-map <A-k> <C-w>k
-map <A-l> <C-w>l
-
" Splits position
-
-" Auto Indent
-map <Tab> gg=G
-
-" Check Spelling
-map <leader>lp :set spell spelllang=pt_pt <CR>
-map <leader>le :set spell spelllang=en_us <CR>
-map <leader>ls :set nospell <CR>
-
-" Custom Scripts
-map <F5> :!compiler '%' $(pwd) <CR>
-map <F4> :!clear && shellcheck % <CR>
+set splitbelow splitright
diff --git a/neovim/.config/nvim/confs/gitgutter.vim b/neovim/.config/nvim/confs/gitgutter.vim
deleted file mode 100644
index 91367c4..0000000
--- a/neovim/.config/nvim/confs/gitgutter.vim
+++ /dev/null
@@ -1,6 +0,0 @@
-set updatetime=100
-let g:gitgutter_highlight_lines = 1
-
-map <leader>h :GitGutterLineHighlightsToggle<CR>
-map <leader>c :GitGutterPreviewHunk<CR>
-map <leader>g :GitGutterToggle<CR>
diff --git a/neovim/.config/nvim/confs/gitmessenger.vim b/neovim/.config/nvim/confs/gitmessenger.vim
deleted file mode 100644
index 4935a7e..0000000
--- a/neovim/.config/nvim/confs/gitmessenger.vim
+++ /dev/null
@@ -1,4 +0,0 @@
-let g:git_messenger_floating_win_opts = { 'border': 'single' }
-let g:git_messenger_popup_content_margins = v:false
-
-nmap <leader>m <plug>(git-messenger)
diff --git a/neovim/.config/nvim/confs/gitsigns.vim b/neovim/.config/nvim/confs/gitsigns.vim
new file mode 100755
index 0000000..9e0106b
--- /dev/null
+++ b/neovim/.config/nvim/confs/gitsigns.vim
@@ -0,0 +1,19 @@
+lua <<EOF
+require('gitsigns').setup {
+ signs = {
+ add = { text = '+' },
+ change = { text = '~' },
+ delete = { text = '-' },
+ topdelete = { text = '-' },
+ changedelete = { text = '~-' },
+ untracked = { text = '┆' },
+ },
+ current_line_blame = true,
+ current_line_blame_opts = {
+ virt_text = true,
+ virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
+ delay = 10,
+ ignore_whitespace = false,
+ }
+}
+EOF
diff --git a/neovim/.config/nvim/confs/hexokinase.vim b/neovim/.config/nvim/confs/hexokinase.vim
deleted file mode 100644
index 4f1c7ae..0000000
--- a/neovim/.config/nvim/confs/hexokinase.vim
+++ /dev/null
@@ -1 +0,0 @@
-let g:Hexokinase_highlighters = ['backgroundfull']
diff --git a/neovim/.config/nvim/confs/hover.vim b/neovim/.config/nvim/confs/hover.vim
new file mode 100755
index 0000000..a955964
--- /dev/null
+++ b/neovim/.config/nvim/confs/hover.vim
@@ -0,0 +1,25 @@
+lua<<EOF
+require("hover").setup {
+ init = function()
+ -- Require providers
+ require("hover.providers.lsp")
+ end,
+ preview_opts = {
+ border = {
+ {"╭", "FloatBorder"},
+ {"─", "FloatBorder"},
+ {"╮", "FloatBorder"},
+ {"│", "FloatBorder"},
+ {"╯", "FloatBorder"},
+ {"─", "FloatBorder"},
+ {"╰", "FloatBorder"},
+ {"│", "FloatBorder"},
+ }
+ },
+
+ -- Whether the contents of a currently open hover window should be moved
+ -- to a :h preview-window when pressing the hover keymap.
+ preview_window = true,
+ title = false
+}
+EOF
diff --git a/neovim/.config/nvim/confs/keybinds.vim b/neovim/.config/nvim/confs/keybinds.vim
new file mode 100755
index 0000000..105bc3a
--- /dev/null
+++ b/neovim/.config/nvim/confs/keybinds.vim
@@ -0,0 +1,46 @@
+" Leader Key
+let mapleader="."
+
+" Limiter Column Color
+" https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bdc48fa11e46f867ea4d75fa59ee87a7f48be144
+map <leader>cc :set colorcolumn=100 <CR>
+
+" Move between splits
+map <A-h> <C-w>h
+map <A-j> <C-w>j
+map <A-k> <C-w>k
+map <A-l> <C-w>l
+
+" Auto Indent
+map <Tab> gg=G
+
+" Check Spelling
+map <leader>lp :set spell spelllang=pt_pt <CR>
+map <leader>le :set spell spelllang=en_us <CR>
+map <leader>ls :set nospell <CR>
+
+" Custom Scripts
+map <F5> :!compiler '%' $(pwd) <CR>
+map <F4> :!clear && shellcheck % <CR>
+
+" Git Hunk Preview
+map <leader>c :Gitsigns preview_hunk_inline<CR>
+
+" NvimTree
+nnoremap <leader>n :NvimTreeToggle<CR>
+nnoremap <leader>r :NvimTreeRefresh<CR>
+nnoremap <leader>f :NvimTreeFindFile<CR>
+
+" TeleScope
+nnoremap <leader>ff <cmd>Telescope find_files<cr>
+nnoremap <leader>fg <cmd>Telescope live_grep<cr>
+nnoremap <leader>fb <cmd>Telescope buffers<cr>
+nnoremap <leader>fh <cmd>Telescope help_tags<cr>
+
+lua <<EOF
+ -- Documentation view on hover
+ vim.keymap.set("n", "K", require("hover").hover, {desc = "hover.nvim"})
+
+ -- Rename Symbol
+ vim.api.nvim_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", { noremap = true })
+EOF
diff --git a/neovim/.config/nvim/confs/nvimlsp.vim b/neovim/.config/nvim/confs/nvimlsp.vim
new file mode 100755
index 0000000..c8319ef
--- /dev/null
+++ b/neovim/.config/nvim/confs/nvimlsp.vim
@@ -0,0 +1,79 @@
+lua <<EOF
+-- Set up nvim-cmp.
+local cmp = require('cmp')
+local lspkind = require('lspkind')
+
+cmp.setup({
+ formatting = {
+ format = lspkind.cmp_format({
+ mode = 'symbol_text',
+ preset = 'codicons',
+ maxwidth = 50,
+ ellipsis_char = '...',
+ before = function (_, vim_item)
+ return vim_item
+ end
+ })
+ },
+ 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.
+ ["<Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ ["<S-Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ }),
+ sources = cmp.config.sources({
+ { name = 'luasnip' },
+ { name = 'nvim_lsp' }
+ })
+})
+
+-- Set up lspconfig.
+require("mason").setup()
+
+local capabilities = require('cmp_nvim_lsp').default_capabilities()
+local masonlsp = require("mason-lspconfig")
+
+masonlsp.setup {
+ ensure_installed = { 'clangd', 'tsserver'},
+ automatic_installation = true,
+ handlers = {
+ function (server_name)
+ require("lspconfig")[server_name].setup {
+ capabilities = capabilities
+ }
+ end
+
+ -- Next, you can provide a dedicated handler for specific servers.
+ -- For example, a handler override for the `rust_analyzer`:
+ -- ["rust_analyzer"] = function ()
+ -- require("rust-tools").setup {}
+ -- end
+ }
+ }
+EOF
diff --git a/neovim/.config/nvim/confs/nvimtree.vim b/neovim/.config/nvim/confs/nvimtree.vim
index 5938fd0..8fb89bf 100644..100755
--- a/neovim/.config/nvim/confs/nvimtree.vim
+++ b/neovim/.config/nvim/confs/nvimtree.vim
@@ -1,5 +1,5 @@
lua << EOF
- require'nvim-tree'.setup()
+ require('nvim-tree').setup()
EOF
" vimrc
@@ -32,29 +32,26 @@ let g:nvim_tree_icons = {
\ 'default': '',
\ 'symlink': '',
\ 'git': {
- \ 'unstaged': "✗",
- \ 'staged': "✓",
- \ 'unmerged': "",
- \ 'renamed': "➜",
- \ 'untracked': "★",
- \ 'deleted': "",
- \ 'ignored': "◌"
- \ },
- \ 'folder': {
- \ 'arrow_open': "",
- \ 'arrow_closed': "",
- \ 'default': "",
- \ 'open': "",
- \ 'empty': "",
- \ 'empty_open': "",
- \ 'symlink': "",
- \ 'symlink_open': "",
- \ }
- \ }
+ \ 'unstaged': "✗",
+ \ 'staged': "✓",
+ \ 'unmerged': "",
+ \ 'renamed': "➜",
+ \ 'untracked': "★",
+ \ 'deleted': "",
+ \ 'ignored': "◌"
+ \ },
+ \ 'folder': {
+ \ 'arrow_open': "",
+ \ 'arrow_closed': "",
+ \ 'default': "",
+ \ 'open': "",
+ \ 'empty': "",
+ \ 'empty_open': "",
+ \ 'symlink': "",
+ \ 'symlink_open': "",
+ \ }
+ \ }
-nnoremap <leader>n :NvimTreeToggle<CR>
-nnoremap <leader>r :NvimTreeRefresh<CR>
-nnoremap <leader>f :NvimTreeFindFile<CR>
" More available functions:
" NvimTreeOpen
" NvimTreeClose
diff --git a/neovim/.config/nvim/confs/taglist.vim b/neovim/.config/nvim/confs/taglist.vim
deleted file mode 100644
index 139e663..0000000
--- a/neovim/.config/nvim/confs/taglist.vim
+++ /dev/null
@@ -1,3 +0,0 @@
-map <leader>t :TlistToggle<CR>
-
-let Tlist_Use_Right_Window = 1
diff --git a/neovim/.config/nvim/confs/whichkey.vim b/neovim/.config/nvim/confs/whichkey.vim
deleted file mode 100644
index 7525815..0000000
--- a/neovim/.config/nvim/confs/whichkey.vim
+++ /dev/null
@@ -1,3 +0,0 @@
-lua << EOF
- require("which-key").setup()
-EOF
diff --git a/neovim/.config/nvim/init.vim b/neovim/.config/nvim/init.vim
index 3bde524..a94ac50 100644..100755
--- a/neovim/.config/nvim/init.vim
+++ b/neovim/.config/nvim/init.vim
@@ -1,40 +1,31 @@
" Plugin Imports
call plug#begin('~/.config/nvim/plugged')
-" CoC
-Plug 'neoclide/coc.nvim', {'branch': 'release'}
-" GitGutter
-Plug 'airblade/vim-gitgutter'
-" GitMessenger
-Plug 'rhysd/git-messenger.vim'
" NVimTree
Plug 'kyazdani42/nvim-web-devicons'
Plug 'kyazdani42/nvim-tree.lua'
-" WhichKey
-Plug 'folke/which-key.nvim'
-" Hexokinase
-Plug 'RRethy/vim-hexokinase', { 'do': 'make hexokinase' }
" AutoPairs
Plug 'jiangmiao/auto-pairs'
-" TagList
-Plug 'vim-scripts/taglist.vim'
+" TeleScope
+Plug 'nvim-lua/plenary.nvim'
+Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.1' }
+" NvimLSP
+Plug 'neovim/nvim-lspconfig'
+Plug 'hrsh7th/cmp-nvim-lsp'
+Plug 'hrsh7th/nvim-cmp'
+Plug 'williamboman/mason.nvim'
+Plug 'williamboman/mason-lspconfig.nvim'
+Plug 'L3MON4D3/LuaSnip'
+Plug 'saadparwaiz1/cmp_luasnip'
+Plug 'onsails/lspkind.nvim'
+" Git Signs
+Plug 'lewis6991/gitsigns.nvim'
+" Hover
+Plug 'lewis6991/hover.nvim'
call plug#end()
" Configurations
-" Generic
-source ~/.config/nvim/confs/generic.vim
-" CoC
-source ~/.config/nvim/confs/coc.vim
-" GitGutter
-source ~/.config/nvim/confs/gitgutter.vim
-" GitMessenger
-source ~/.config/nvim/confs/gitmessenger.vim
-" NVimTree
-source ~/.config/nvim/confs/nvimtree.vim
-" WhichKey
-source ~/.config/nvim/confs/whichkey.vim
-" Hexokinase
-source ~/.config/nvim/confs/hexokinase.vim
-" Taglist
-source ~/.config/nvim/confs/taglist.vim
+for f in split(glob('~/.config/nvim/confs/*.vim'), '\n')
+ exe 'source' f
+endfor