diff options
author | rafa_99 <raroma09@gmail.com> | 2022-03-07 00:24:47 +0000 |
---|---|---|
committer | rafa_99 <raroma09@gmail.com> | 2022-03-07 00:24:47 +0000 |
commit | 9242b5813390e0ed319cf57eef3d0d8cb54b2a97 (patch) | |
tree | 5669f3a7eadaa8aba7cc0afaef28f6148167d277 /neovim/.config | |
parent | 831c78da37d726105b481ae2d5889a23cd28224b (diff) |
Updated Neovim Configs
Diffstat (limited to 'neovim/.config')
-rw-r--r-- | neovim/.config/nvim/confs/bufferline.vim | 6 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/completion.vim | 62 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/generic.vim | 35 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/gitgutter.vim | 4 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/gitmessenger.vim | 2 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/lualine.vim | 3 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/nvimtree.vim | 66 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/telescope.vim | 4 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/trouble.vim | 3 | ||||
-rw-r--r-- | neovim/.config/nvim/confs/whichkey.vim | 3 | ||||
-rw-r--r-- | neovim/.config/nvim/init.vim | 182 |
11 files changed, 247 insertions, 123 deletions
diff --git a/neovim/.config/nvim/confs/bufferline.vim b/neovim/.config/nvim/confs/bufferline.vim new file mode 100644 index 0000000..e0313fe --- /dev/null +++ b/neovim/.config/nvim/confs/bufferline.vim @@ -0,0 +1,6 @@ +lua << EOF + require("bufferline").setup{} +EOF + +nnoremap <silent>[b :BufferLineCycleNext<CR> +nnoremap <silent>b] :BufferLineCyclePrev<CR> diff --git a/neovim/.config/nvim/confs/completion.vim b/neovim/.config/nvim/confs/completion.vim new file mode 100644 index 0000000..1bfc08e --- /dev/null +++ b/neovim/.config/nvim/confs/completion.vim @@ -0,0 +1,62 @@ +lua << EOF +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) + +local lspconfig = require('lspconfig') + +-- Enable some language servers with the additional completion capabilities offered by nvim-cmp +local servers = { 'clangd', 'pyright', 'tsserver', 'html', 'cssls' } +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + -- on_attach = my_custom_on_attach, + capabilities = capabilities, + } +end + +-- luasnip setup +local luasnip = require 'luasnip' + +-- nvim-cmp setup +local cmp = require 'cmp' +cmp.setup { + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, +mapping = { + ['<C-p>'] = cmp.mapping.select_prev_item(), + ['<C-n>'] = cmp.mapping.select_next_item(), + ['<C-d>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.close(), + ['<CR>'] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + ['<Tab>'] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end +end, +['<S-Tab>'] = function(fallback) +if cmp.visible() then + cmp.select_prev_item() +elseif luasnip.jumpable(-1) then + luasnip.jump(-1) +else + fallback() +end + end, + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, + } +EOF diff --git a/neovim/.config/nvim/confs/generic.vim b/neovim/.config/nvim/confs/generic.vim new file mode 100644 index 0000000..e9fadcc --- /dev/null +++ b/neovim/.config/nvim/confs/generic.vim @@ -0,0 +1,35 @@ +set number +set ignorecase +set viminfo="" +set autoindent +set smartindent +set smarttab +set ruler +set autochdir +set mouse=a +" set guicursor= +set inccommand=split +set incsearch +set wildmode=longest,list,full +set relativenumber +set termguicolors +set completeopt=menuone,noselect + + +" Remove trailing whitespace on save +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 +set splitbelow splitright + +" Custom Maps +map <Tab> gg=G diff --git a/neovim/.config/nvim/confs/gitgutter.vim b/neovim/.config/nvim/confs/gitgutter.vim new file mode 100644 index 0000000..ae24c10 --- /dev/null +++ b/neovim/.config/nvim/confs/gitgutter.vim @@ -0,0 +1,4 @@ +set updatetime=100 +map <C-l> :GitGutterLineHighlightsToggle<CR> +map <C-h> :GitGutterPreviewHunk<CR> +map <C-g> :GitGutterToggle<CR> diff --git a/neovim/.config/nvim/confs/gitmessenger.vim b/neovim/.config/nvim/confs/gitmessenger.vim new file mode 100644 index 0000000..0b15db6 --- /dev/null +++ b/neovim/.config/nvim/confs/gitmessenger.vim @@ -0,0 +1,2 @@ +let g:git_messenger_floating_win_opts = { 'border': 'single' } +let g:git_messenger_popup_content_margins = v:false diff --git a/neovim/.config/nvim/confs/lualine.vim b/neovim/.config/nvim/confs/lualine.vim new file mode 100644 index 0000000..93d98ff --- /dev/null +++ b/neovim/.config/nvim/confs/lualine.vim @@ -0,0 +1,3 @@ +lua << END +require('lualine').setup() +END diff --git a/neovim/.config/nvim/confs/nvimtree.vim b/neovim/.config/nvim/confs/nvimtree.vim new file mode 100644 index 0000000..625721d --- /dev/null +++ b/neovim/.config/nvim/confs/nvimtree.vim @@ -0,0 +1,66 @@ +lua << EOF +require'nvim-tree'.setup() +EOF + +" vimrc +let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open +let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons). +let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories. +let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options +let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names +let g:nvim_tree_group_empty = 1 " 0 by default, compact folders that only contain a single folder into one node in the file tree +let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font. +let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target. +let g:nvim_tree_respect_buf_cwd = 1 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree. +let g:nvim_tree_create_in_closed_folder = 1 "0 by default, When creating files, sets the path of a file when cursor is on a closed folder to the parent folder when 0, and inside the folder when 1. +let g:nvim_tree_special_files = { 'README.md': 1, 'Makefile': 1, 'MAKEFILE': 1 } " List of filenames that gets highlighted with NvimTreeSpecialFile +let g:nvim_tree_show_icons = { + \ 'git': 1, + \ 'folders': 0, + \ 'files': 0, + \ 'folder_arrows': 0, + \ } +"If 0, do not show the icons for one of 'git' 'folder' and 'files' +"1 by default, notice that if 'files' is 1, it will only display +"if nvim-web-devicons is installed and on your runtimepath. +"if folder is 1, you can also tell folder_arrows 1 to show small arrows next to the folder icons. +"but this will not work when you set indent_markers (because of UI conflict) + +" default will show icon by default if no icon is provided +" default shows no icon by default +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': "", + \ } + \ } + +nnoremap <C-n> :NvimTreeToggle<CR> +nnoremap <leader>r :NvimTreeRefresh<CR> +nnoremap <leader>n :NvimTreeFindFile<CR> +" More available functions: +" NvimTreeOpen +" NvimTreeClose +" NvimTreeFocus +" NvimTreeFindFileToggle +" NvimTreeResize + +" a list of groups can be found at `:help nvim_tree_highlight` +highlight NvimTreeFolderIcon guibg=blue diff --git a/neovim/.config/nvim/confs/telescope.vim b/neovim/.config/nvim/confs/telescope.vim new file mode 100644 index 0000000..46efcf3 --- /dev/null +++ b/neovim/.config/nvim/confs/telescope.vim @@ -0,0 +1,4 @@ +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> diff --git a/neovim/.config/nvim/confs/trouble.vim b/neovim/.config/nvim/confs/trouble.vim new file mode 100644 index 0000000..4f3bfce --- /dev/null +++ b/neovim/.config/nvim/confs/trouble.vim @@ -0,0 +1,3 @@ +lua << EOF + require("trouble").setup() +EOF diff --git a/neovim/.config/nvim/confs/whichkey.vim b/neovim/.config/nvim/confs/whichkey.vim new file mode 100644 index 0000000..796894c --- /dev/null +++ b/neovim/.config/nvim/confs/whichkey.vim @@ -0,0 +1,3 @@ +lua << EOF + require("which-key").setup() +EOF diff --git a/neovim/.config/nvim/init.vim b/neovim/.config/nvim/init.vim index 56d58fb..7770abd 100644 --- a/neovim/.config/nvim/init.vim +++ b/neovim/.config/nvim/init.vim @@ -1,128 +1,64 @@ -" Call plugins folder +" Plugin Imports call plug#begin('~/.config/nvim/plugged') -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' -Plug 'jiangmiao/auto-pairs' -Plug 'luochen1990/rainbow' + +" Completion +Plug 'neovim/nvim-lspconfig' +Plug 'hrsh7th/nvim-cmp' +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'saadparwaiz1/cmp_luasnip' +Plug 'L3MON4D3/LuaSnip' +" LuaLine +Plug 'nvim-lualine/lualine.nvim' +Plug 'kyazdani42/nvim-web-devicons' +" TreeSitter +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +" Trouble +Plug 'kyazdani42/nvim-web-devicons' +Plug 'folke/trouble.nvim' +" GitGutter Plug 'airblade/vim-gitgutter' +" GitMessenger +Plug 'rhysd/git-messenger.vim' +" Telescope +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim' +" NVimTree +Plug 'kyazdani42/nvim-web-devicons' +Plug 'kyazdani42/nvim-tree.lua' +" WhichKey +Plug 'folke/which-key.nvim' +" BufferLine +Plug 'kyazdani42/nvim-web-devicons' +Plug 'akinsho/bufferline.nvim' +" VimSneak +Plug 'justinmk/vim-sneak' +" VimIlluminate +Plug 'RRethy/vim-illuminate' +" Hexokinase Plug 'RRethy/vim-hexokinase' -Plug 'vim-scripts/taglist.vim' -Plug 'scrooloose/nerdtree' -Plug 'neovim/nvim-lspconfig' -Plug 'hrsh7th/nvim-compe' -Plug 'vim-scripts/DoxygenToolkit.vim' -call plug#end() - -" Keybinds Index -" F4 -> Checks shellcode -" F5 -> Compile current program with compiler script -" Control + P -> Runs portuguese spelling check -" Control + E -> Runs english spelling check -" Control + S -> Disables any spelling check -" Alt + H,J,K,L -> Movement between splits -" Control + T -> Opens up NERDTree -" Control + Z -> Toggles Tag List from current program -" Control + C -> Runs doxygen documentation program -" - -" Custom Settings -set number -set ignorecase -set viminfo="" -set autoindent -set smartindent -set smarttab -set ruler -set autochdir -" set guicursor= -set inccommand=split -set incsearch -set wildmode=longest,list,full -set relativenumber -set termguicolors -set completeopt=menuone,noselect - -" Autocommands -map <F5> :!compiler '%' <CR> -map <F4> :!clear && shellcheck % <CR> -map <C-p> :set spell spelllang=pt_pt <CR> -map <C-e> :set spell spelllang=en_us <CR> -map <C-s> :set nospell <CR> -map <Tab> gg=G - -" Remove trailing whitespace on save -autocmd BufWritePre * %s/\s\+$//e - -" Use system clipboard -set clipboard+=unnamedplus - -" Keybinds for splits -" 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 -set splitbelow splitright - -" Plugins Configuration -" Airline Theme -let g:airline_theme='wombat' -let g:airline_powerline_fonts = 1 -" Rainbow Vim -let g:rainbow_active = 1 -" Vim gitgutter -set updatetime=100 -map <C-l> :GitGutterLineHighlightsToggle<CR> -map <C-h> :GitGutterPreviewHunk<CR> -map <C-g> :GitGutterToggle<CR> -" Vim Hexokinase -let g:Hexokinase_highlighters = ['backgroundfull'] -" Tag List -map <C-t> :TlistToggle<CR> -" NERDTree -map <C-n> :NERDTreeToggle<CR> -" DoxygenToolkit -map <C-c> :Dox<CR> - -" LSP Configuration -lua << EOF - --- Setup module settings before setting up modules -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - -require'lspconfig'.clangd.setup{} -require'lspconfig'.pyright.setup{} -require'lspconfig'.tsserver.setup{} -require'lspconfig'.html.setup{ capabilities = capabilities } -require'lspconfig'.cssls.setup{} -require'lspconfig'.omnisharp.setup{ cmd = { (os.getenv("XDG_DATA_HOME")) .. "/omnisharp/run", "--languageserver" , "--hostPID", tostring(vim.fn.getpid()) }} -EOF +" AutoPairs +Plug 'jiangmiao/auto-pairs' -"" LSP Autocomplete -let g:compe = {} -let g:compe.enabled = v:true -let g:compe.autocomplete = v:true -let g:compe.debug = v:false -let g:compe.min_length = 1 -let g:compe.preselect = 'enable' -let g:compe.throttle_time = 80 -let g:compe.source_timeout = 200 -let g:compe.resolve_timeout = 800 -let g:compe.incomplete_delay = 400 -let g:compe.max_abbr_width = 100 -let g:compe.max_kind_width = 100 -let g:compe.max_menu_width = 100 -let g:compe.documentation = v:true +call plug#end() -let g:compe.source = {} -let g:compe.source.path = v:true -let g:compe.source.buffer = v:true -let g:compe.source.calc = v:true -let g:compe.source.nvim_lsp = v:true -let g:compe.source.nvim_lua = v:true -let g:compe.source.vsnip = v:true -let g:compe.source.ultisnips = v:true -let g:compe.source.luasnip = v:true -let g:compe.source.emoji = v:true +" Configurations +" Generic +source confs/generic.vim +" Completion +source confs/completion.vim +" LuaLine +source confs/lualine.vim +" Trouble +source confs/trouble.vim +" GitGutter +source confs/gitgutter.vim +" GitMessenger +source confs/gitmessenger.vim +" Telescope +source confs/telescope.vim +" NVimTree +source confs/nvimtree.vim +" WhichKey +source confs/whichkey.vim +" Bufferline +source confs/bufferline.vim |