2021-05-14 03:47:48 +00:00
|
|
|
let g:mapleader = "\<Space>"
|
|
|
|
let g:maplocalleader = ','
|
|
|
|
|
|
|
|
set termguicolors
|
|
|
|
syntax on
|
2020-10-22 18:16:44 +00:00
|
|
|
|
2020-06-18 05:58:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
set hidden
|
|
|
|
|
2020-06-19 02:07:10 +00:00
|
|
|
|
2020-09-04 05:42:17 +00:00
|
|
|
" Always show the signcolumn
|
|
|
|
if has("patch-8.1.1564")
|
|
|
|
" Recently vim can merge signcolumn and number column into one
|
|
|
|
set signcolumn=number
|
|
|
|
else
|
|
|
|
set signcolumn=yes
|
|
|
|
endif
|
2020-06-18 05:58:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
call plug#begin(stdpath('data') . '/plugged')
|
2020-10-22 18:16:44 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
Plug 'neovim/nvim-lspconfig'
|
2020-10-22 18:16:44 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
2020-08-29 18:38:14 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
Plug 'windwp/nvim-autopairs'
|
2020-10-22 18:16:44 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
Plug 'terrortylor/nvim-comment'
|
2020-06-18 05:58:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
Plug 'kyazdani42/nvim-tree.lua'
|
2020-06-19 02:07:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
Plug 'glepnir/dashboard-nvim'
|
2020-06-18 05:58:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
Plug 'hoob3rt/lualine.nvim'
|
2020-06-18 05:58:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
" One Dark Pro
|
|
|
|
Plug 'joshdick/onedark.vim'
|
2020-06-18 05:58:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
" Plug 'liuchengxu/vim-which-key'
|
2020-06-18 05:58:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
" TODO: Configure this
|
|
|
|
Plug 'mfussenegger/nvim-dap'
|
2020-06-18 05:58:10 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
" Autocomplete
|
|
|
|
Plug 'hrsh7th/nvim-compe'
|
|
|
|
Plug 'hrsh7th/vim-vsnip'
|
|
|
|
Plug 'hrsh7th/vim-vsnip-integ'
|
2020-09-04 05:42:17 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
" Telescope Config
|
|
|
|
Plug 'nvim-lua/popup.nvim'
|
|
|
|
Plug 'nvim-lua/plenary.nvim'
|
|
|
|
Plug 'nvim-telescope/telescope.nvim'
|
2021-03-30 21:14:57 +00:00
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
" Barbar Config
|
|
|
|
Plug 'kyazdani42/nvim-web-devicons'
|
|
|
|
Plug 'romgrk/barbar.nvim'
|
2021-02-16 02:42:32 +00:00
|
|
|
|
2020-06-18 05:58:10 +00:00
|
|
|
call plug#end()
|
|
|
|
|
2021-05-14 03:47:48 +00:00
|
|
|
" --Telescope Keybinds--
|
|
|
|
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
|
|
|
|
nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>
|
|
|
|
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
|
|
|
|
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
|
|
|
|
|
|
|
|
|
|
|
|
" Compe Keybinds
|
|
|
|
inoremap <silent><expr> <C-Space> compe#complete()
|
|
|
|
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
|
|
|
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
|
|
|
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
|
|
|
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
|
|
|
|
|
|
|
" Which Key Keybinds
|
|
|
|
" nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
|
|
|
|
" nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
|
|
|
|
|
|
|
|
" Nvim Tree Keybinds
|
|
|
|
let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default
|
|
|
|
let g:nvim_tree_gitignore = 1 "0 by default
|
|
|
|
let g:nvim_tree_auto_open = 1 "0 by default, opens the tree when typing `vim $DIR` or `vim`
|
|
|
|
let g:nvim_tree_auto_close = 1 "0 by default, closes the tree when it's the last window
|
|
|
|
let g:nvim_tree_auto_ignore_ft = [ 'startify', 'dashboard' ] "empty by default, don't auto open tree on specific filetypes.
|
|
|
|
let g:nvim_tree_quit_on_open = 1 "0 by default, closes the tree when you open a file
|
|
|
|
let g:nvim_tree_follow = 1 "0 by default, this option allows the cursor to be updated when entering a buffer
|
|
|
|
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_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options
|
|
|
|
let g:nvim_tree_tab_open = 1 "0 by default, will open the tree when entering a new tab and the tree was previously open
|
|
|
|
let g:nvim_tree_width_allow_resize = 1 "0 by default, will not resize the tree when opening a file
|
|
|
|
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_lsp_diagnostics = 1 "0 by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics
|
|
|
|
let g:nvim_tree_special_files = [ 'README.md', 'Makefile', 'MAKEFILE' ] " List of filenames that gets highlighted with NvimTreeSpecialFile
|
|
|
|
let g:nvim_tree_show_icons = {
|
|
|
|
\ 'git': 1,
|
|
|
|
\ 'folders': 1,
|
|
|
|
\ 'files': 1,
|
|
|
|
\ }
|
|
|
|
"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
|
|
|
|
|
|
|
|
" 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': {
|
|
|
|
\ 'default': "",
|
|
|
|
\ 'open': "",
|
|
|
|
\ 'empty': "",
|
|
|
|
\ 'empty_open': "",
|
|
|
|
\ 'symlink': "",
|
|
|
|
\ 'symlink_open': "",
|
|
|
|
\ },
|
|
|
|
\ 'lsp': {
|
|
|
|
\ 'hint': "",
|
|
|
|
\ 'info': "",
|
|
|
|
\ 'warning': "",
|
|
|
|
\ 'error': "",
|
|
|
|
\ }
|
|
|
|
\ }
|
|
|
|
|
|
|
|
nnoremap <C-n> :NvimTreeToggle<CR>
|
|
|
|
nnoremap <leader>r :NvimTreeRefresh<CR>
|
|
|
|
nnoremap <leader>n :NvimTreeFindFile<CR>
|
|
|
|
" NvimTreeOpen and NvimTreeClose are also available if you need them
|
|
|
|
|
|
|
|
|
|
|
|
" a list of groups can be found at `:help nvim_tree_highlight`
|
|
|
|
highlight NvimTreeFolderIcon guibg=blue
|
|
|
|
|
|
|
|
colorscheme onedark
|
|
|
|
|
|
|
|
lua << EOF
|
|
|
|
|
|
|
|
-- NVIM 0.5 LSP Setup
|
|
|
|
|
|
|
|
local nvim_lsp = require'lspconfig'
|
|
|
|
nvim_lsp.pyright.setup{}
|
|
|
|
nvim_lsp.rust_analyzer.setup{}
|
|
|
|
|
|
|
|
-- Tree Sitter Config
|
|
|
|
|
|
|
|
require'nvim-treesitter.configs'.setup {
|
|
|
|
highlight = { enable = true },
|
|
|
|
indent = { enable = true },
|
|
|
|
autotag = { enable = true },
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Telescope Defaults
|
|
|
|
require'telescope'.setup {
|
|
|
|
defaults = {
|
|
|
|
find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
|
|
|
|
prompt_position = "bottom",
|
|
|
|
prompt_prefix = " ",
|
|
|
|
border = {},
|
|
|
|
borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'},
|
|
|
|
color_devicons = true,
|
|
|
|
use_less = true,
|
|
|
|
set_env = {['COLORTERM'] = 'truecolor'},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Barbar Keybinds
|
|
|
|
vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>', { noremap = true, silent = true })
|
|
|
|
vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', { noremap = true, silent = true })
|
|
|
|
vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>', { noremap = true, silent = true })
|
|
|
|
|
|
|
|
-- Autopairs setup
|
|
|
|
require'nvim-autopairs'.setup()
|
|
|
|
|
|
|
|
-- Comments
|
|
|
|
require'nvim_comment'.setup()
|
|
|
|
|
|
|
|
-- Autocomplete
|
|
|
|
vim.o.completeopt = "menuone,noselect"
|
|
|
|
|
|
|
|
require'compe'.setup {
|
|
|
|
enabled = true;
|
|
|
|
autocomplete = true;
|
|
|
|
debug = false;
|
|
|
|
min_length = 1;
|
|
|
|
preselect = 'enable';
|
|
|
|
throttle_time = 80;
|
|
|
|
source_timeout = 200;
|
|
|
|
incomplete_delay = 400;
|
|
|
|
max_abbr_width = 100;
|
|
|
|
max_kind_width = 100;
|
|
|
|
max_menu_width = 100;
|
|
|
|
documentation = true;
|
|
|
|
|
|
|
|
source = {
|
|
|
|
path = true;
|
|
|
|
buffer = true;
|
|
|
|
calc = true;
|
|
|
|
nvim_lsp = true;
|
|
|
|
nvim_lua = true;
|
|
|
|
vsnip = true;
|
|
|
|
ultisnips = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
local t = function(str)
|
|
|
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
|
|
|
end
|
|
|
|
|
|
|
|
local check_back_space = function()
|
|
|
|
local col = vim.fn.col('.') - 1
|
|
|
|
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Use (s-)tab to:
|
|
|
|
--- move to prev/next item in completion menuone
|
|
|
|
--- jump to prev/next snippet's placeholder
|
|
|
|
_G.tab_complete = function()
|
|
|
|
if vim.fn.pumvisible() == 1 then
|
|
|
|
return t "<C-n>"
|
|
|
|
elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
|
|
|
return t "<Plug>(vsnip-expand-or-jump)"
|
|
|
|
elseif check_back_space() then
|
|
|
|
return t "<Tab>"
|
|
|
|
else
|
|
|
|
return vim.fn['compe#complete']()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
_G.s_tab_complete = function()
|
|
|
|
if vim.fn.pumvisible() == 1 then
|
|
|
|
return t "<C-p>"
|
|
|
|
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
|
|
|
return t "<Plug>(vsnip-jump-prev)"
|
|
|
|
else
|
|
|
|
return t "<S-Tab>"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
|
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
|
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
|
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
|
|
|
|
|
|
|
|
|
|
-- lualine Config
|
|
|
|
require'lualine'.setup {
|
|
|
|
options = {
|
|
|
|
theme = "onedark"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Dashboard config
|
|
|
|
vim.g.dashboard_default_executive = 'telescope'
|
|
|
|
vim.g.dashboard_custom_section = {
|
|
|
|
a = {description = {' Find File '}, command = 'Telescope find_files'},
|
|
|
|
b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'},
|
|
|
|
c = {description = {' Load Last Session '}, command = 'SessionLoad'},
|
|
|
|
d = {description = {' Find Word '}, command = 'Telescope live_grep'},
|
|
|
|
e = {description = {' Settings '}, command = ':e ~/.config/nvim/init.vim'}
|
|
|
|
-- e = {description = {' Marks '}, command = 'Telescope marks'}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOF
|