Last active
October 3, 2022 13:04
-
-
Save jellyninjadev/849802805cf05f493f97acf76fb660d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin() | |
Plug 'williamboman/mason.nvim' | |
Plug 'williamboman/mason-lspconfig.nvim' | |
Plug 'jose-elias-alvarez/null-ls.nvim' | |
"Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
Plug 'github/copilot.vim' | |
Plug 'hrsh7th/cmp-copilot' | |
Plug 'joshdick/onedark.vim' | |
Plug 'tpope/vim-fugitive' | |
"Plug 'airblade/vim-gitgutter' | |
"Plug 'vim-airline/vim-airline' | |
"Plug 'vim-airline/vim-airline-themes' | |
Plug 'nvim-lualine/lualine.nvim' | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'nvim-telescope/telescope.nvim' | |
Plug 'airblade/vim-rooter' | |
Plug 'rakr/vim-one' | |
Plug 'ellisonleao/gruvbox.nvim' | |
Plug 'sbdchd/neoformat' | |
Plug 'preservim/nerdtree' | |
Plug 'nvim-orgmode/orgmode' | |
Plug 'TimUntersberger/neogit' | |
Plug 'sindrets/diffview.nvim' | |
Plug 'smithbm2316/centerpad.nvim' | |
Plug 'lewis6991/gitsigns.nvim' | |
Plug 'lukas-reineke/indent-blankline.nvim' | |
Plug 'norcalli/nvim-colorizer.lua' | |
Plug 'numToStr/Comment.nvim' | |
Plug 'kyazdani42/nvim-web-devicons' " optional, for file icons | |
Plug 'kyazdani42/nvim-tree.lua' | |
Plug 'mfussenegger/nvim-dap' | |
Plug 'rcarriga/nvim-dap-ui' | |
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } | |
Plug 'nvim-telescope/telescope-dap.nvim' | |
"Plug 'fannheyward/telescope-coc.nvim' | |
Plug 'windwp/nvim-autopairs' | |
Plug 'L3MON4D3/LuaSnip', {'tag': 'v<CurrentMajor>.*'} | |
Plug 'saadparwaiz1/cmp_luasnip' | |
Plug 'catppuccin/nvim' | |
Plug 'mbbill/undotree' | |
Plug 'neovim/nvim-lspconfig' | |
Plug 'glepnir/lspsaga.nvim', { 'branch': 'main' } | |
Plug 'ray-x/lsp_signature.nvim' | |
Plug 'glepnir/dashboard-nvim' | |
Plug 'onsails/lspkind.nvim' | |
Plug 'hrsh7th/cmp-nvim-lsp' | |
Plug 'hrsh7th/cmp-buffer' | |
Plug 'hrsh7th/nvim-cmp' | |
Plug 'nvim-telescope/telescope-file-browser.nvim' | |
Plug 'akinsho/nvim-bufferline.lua' | |
Plug 'windwp/nvim-ts-autotag' | |
Plug 'folke/zen-mode.nvim' | |
Plug 'MunifTanjim/prettier.nvim' | |
call plug#end() | |
colorscheme gruvbox | |
augroup transparent_signs | |
autocmd! | |
autocmd ColorScheme * highlight Normal guibg=NONE ctermbg=NONE | |
autocmd ColorScheme * highlight SignColumn guibg=NONE ctermbg=NONE | |
autocmd ColorScheme * highlight ColorColumn guibg=NONE ctermbg=NONE | |
autocmd ColorScheme * highlight GitSignsAdd ctermbg=NONE guibg=NONE | |
autocmd ColorScheme * highlight GitSignsChange ctermbg=NONE guibg=NONE | |
autocmd ColorScheme * highlight GitSignsDelete ctermbg=NONE guibg=NONE | |
augroup END | |
set background=dark | |
let mapleader = " " | |
"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) | |
nnoremap <leader>pp <cmd>Telescope find_files<cr> | |
nnoremap <leader>n :NvimTreeToggle<cr> | |
nnoremap <leader>zm <cmd>Centerpad 30<cr> | |
nnoremap <leader>zo <cmd>Centerpad<cr> | |
nnoremap <Tab> <cmd>BufferLineCycleNext<cr> | |
nnoremap <S-Tab> <cmd>BufferLineCyclePrev<cr> | |
set cmdheight=1 | |
set tabstop=2 | |
set shiftwidth=2 | |
set softtabstop=0 | |
set autoindent | |
set smarttab | |
set foldmethod=expr | |
set foldexpr=nvim_treesitter#foldexpr() | |
set foldlevel=1 | |
set termguicolors | |
lua << EOF | |
vim.g.loaded = 1 | |
vim.g.loaded_netrwPlugin = 1 | |
require'mason'.setup() | |
require'mason-lspconfig'.setup() | |
require('telescope').setup{ | |
defaults = { | |
file_ignore_patterns = { "node_modules", ".git" }, | |
}, | |
extensions = { | |
fzf = { | |
fuzzy = true, -- false will only do exact matching | |
override_generic_sorter = true, -- override the generic sorter | |
override_file_sorter = true, -- override the file sorter | |
case_mode = "smart_case", -- or "ignore_case" or "respect_case" | |
-- the default case_mode is "smart_case" | |
}, | |
-- coc = { | |
-- theme = 'ivy', | |
-- prefer_locations = true, | |
-- }, | |
file_browser = { | |
theme = 'dropdown', | |
hijack_netrw = true | |
} | |
} | |
} | |
require'telescope'.load_extension('fzf') | |
require'telescope'.load_extension('dap') | |
--require'telescope'.load_extension('coc') | |
--require'telescope'.load_extension('file_browser') | |
require('orgmode').setup_ts_grammar() | |
require'nvim-treesitter.configs'.setup { | |
highlight = { | |
enable = true, | |
additional_vim_regex_highlighting = {'org'}, | |
}, | |
indent = { | |
enable = true, | |
}, | |
autotag = { | |
enable = true, | |
}, | |
autopairs = { | |
enable = true, | |
}, | |
ensure_installed = {'org'} | |
} | |
require('nvim-autopairs').setup { | |
disable_filetype = { "TelescopePrompt" , "vim" }, | |
} | |
require('orgmode').setup({ | |
org_agenda_files = {'~/org/*'}, | |
org_default_notes_file = '~/org/refile.org', | |
}) | |
require('neogit').setup{ | |
integrations = { | |
diffview = true | |
} | |
} | |
require('diffview').setup({ | |
use_icons = false | |
}) | |
require('gitsigns').setup { | |
current_line_blame = true, | |
signs = { | |
add = { | |
hl = "GitSignsAdd", | |
text = " ▎", | |
numhl = "GitSignsAddNr", | |
linehl = "GitSignsAddLn", | |
}, | |
change = { | |
hl = "GitSignsChange", | |
text = " ▎", | |
numhl = "GitSignsChangeNr", | |
linehl = "GitSignsChangeLn", | |
}, | |
delete = { | |
hl = "GitSignsDelete", | |
text = " ▎", | |
numhl = "GitSignsDeleteNr", | |
linehl = "GitSignsDeleteLn", | |
}, | |
topdelete = { | |
hl = "GitSignsDelete", | |
text = " ▎", | |
numhl = "GitSignsDeleteNr", | |
linehl = "GitSignsDeleteLn", | |
}, | |
changedelete = { | |
hl = "GitSignsChange", | |
text = " ▎", | |
numhl = "GitSignsChangeNr", | |
linehl = "GitSignsChangeLn", | |
}, | |
} | |
} | |
require('indent_blankline').setup { | |
show_current_context = true, | |
show_current_context_start = true | |
} | |
require'colorizer'.setup() | |
require'comment'.setup() | |
require'nvim-tree'.setup() | |
require'dapui'.setup() | |
local keymap = vim.keymap.set | |
local saga = require('lspsaga') | |
saga.init_lsp_saga({ | |
server_filetype_map = { | |
typescript = 'typescript' | |
} | |
}) | |
-- Lsp finder find the symbol definition implement reference | |
-- if there is no implement it will hide | |
-- when you use action in finder like open vsplit then you can | |
-- use <C-t> to jump back | |
keymap("n", "gh", "<cmd>Lspsaga lsp_finder<CR>", { silent = true }) | |
-- Code action | |
keymap({"n","v"}, "<leader>ca", "<cmd>Lspsaga code_action<CR>", { silent = true }) | |
-- Rename | |
keymap("n", "gr", "<cmd>Lspsaga rename<CR>", { silent = true }) | |
-- Peek Definition | |
-- you can edit the definition file in this flaotwindow | |
-- also support open/vsplit/etc operation check definition_action_keys | |
-- support tagstack C-t jump back | |
keymap("n", "gd", "<cmd>Lspsaga peek_definition<CR>", { silent = true }) | |
-- Show line diagnostics | |
keymap("n", "<leader>ld", "<cmd>Lspsaga show_line_diagnostics<CR>", { silent = true }) | |
-- Show cursor diagnostic | |
keymap("n", "<leader>cd", "<cmd>Lspsaga show_cursor_diagnostics<CR>", { silent = true }) | |
-- Diagnsotic jump can use `<c-o>` to jump back | |
keymap("n", "[e", "<cmd>Lspsaga diagnostic_jump_prev<CR>", { silent = true }) | |
keymap("n", "]e", "<cmd>Lspsaga diagnostic_jump_next<CR>", { silent = true }) | |
-- Only jump to error | |
keymap("n", "[E", function() | |
require("lspsaga.diagnostic").goto_prev({ severity = vim.diagnostic.severity.ERROR }) | |
end, { silent = true }) | |
keymap("n", "]E", function() | |
require("lspsaga.diagnostic").goto_next({ severity = vim.diagnostic.severity.ERROR }) | |
end, { silent = true }) | |
-- Outline | |
keymap("n","<leader>o", "<cmd>LSoutlineToggle<CR>",{ silent = true }) | |
-- Hover Doc | |
keymap("n", "K", "<cmd>Lspsaga hover_doc<CR>", { silent = true }) | |
-- Float terminal | |
keymap("n", "<A-d>", "<cmd>Lspsaga open_floaterm<CR>", { silent = true }) | |
-- if you want pass somc cli command into terminal you can do like this | |
-- open lazygit in lspsaga float terminal | |
keymap("n", "<A-g>", "<cmd>Lspsaga open_floaterm lazygit<CR>", { silent = true }) | |
-- close floaterm | |
keymap("t", "<A-d>", [[<C-\><C-n><cmd>Lspsaga close_floaterm<CR>]], { silent = true }) | |
local home = 'C:/Users/darkz' | |
local db = require('dashboard') | |
-- macos | |
db.preview_command = 'cat | lolcat -F 0.3' | |
-- linux | |
db.preview_command = 'ueberzug' | |
-- | |
db.preview_file_path = home .. '/.config/nvim/static/neovim.cat' | |
db.preview_file_height = 11 | |
db.preview_file_width = 70 | |
db.custom_center = { | |
{icon = ' ', | |
desc = 'Find File ', | |
action = 'Telescope find_files find_command=rg,--hidden,--files', | |
shortcut = 'SPC f f'}, | |
{icon = ' ', | |
desc = 'Recently latest session ', | |
shortcut = 'SPC s l', | |
action ='SessionLoad'}, | |
{icon = ' ', | |
desc ='File Browser ', | |
action = 'Telescope file_browser', | |
shortcut = 'SPC f b'}, | |
{icon = ' ', | |
desc = 'Recently opened files ', | |
action = 'DashboardFindHistory', | |
shortcut = 'SPC f h'}, | |
{icon = ' ', | |
desc = 'Find word ', | |
action = 'Telescope live_grep', | |
shortcut = 'SPC f w'}, | |
{icon = ' ', | |
desc = 'Open Personal dotfiles ', | |
action = 'Telescope dotfiles path=' .. home ..'/.dotfiles', | |
shortcut = 'SPC f d'}, | |
} | |
local lspkind = require('lspkind') | |
lspkind.init() | |
require('bufferline').setup { | |
options = { | |
always_show_bufferline = false, | |
show_buffer_close_icons = false, | |
show_close_icon = false | |
} | |
} | |
local luasnip = require('luasnip') | |
local cmp = require('cmp') | |
cmp.setup { | |
fields = {"kind", "abbr", "menu" }, | |
snipped = { | |
expand = function(args) | |
luasnip.lsp_expand(args.body) | |
end | |
}, | |
mapping = cmp.mapping.preset.insert({ | |
['<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>'] = cmp.mapping(function(fallback) | |
if cmp.visible() then | |
cmp.select_next_item() | |
elseif luasnip.expand_or_jumpable() then | |
luasnip.expand_or_jump() | |
else | |
fallback() | |
end | |
end, { 'i', 's' }), | |
['<S-Tab>'] = cmp.mapping(function(fallback) | |
if cmp.visible() then | |
cmp.select_prev_item() | |
elseif luasnip.jumpable(-1) then | |
luasnip.jump(-1) | |
else | |
fallback() | |
end | |
end, { 'i', 's' }), | |
}), | |
sources = cmp.config.sources({ | |
{ name = 'nvim_lsp' }, | |
{ name = 'copilot' }, | |
{ name = "luasnip" }, | |
{ name = 'buffer' }, | |
{ name = 'path' } | |
}), | |
formatting = { | |
format = lspkind.cmp_format({ | |
with_text = false, | |
max_width = 50 | |
}) | |
}, | |
window = { | |
completion = cmp.config.window.bordered(), | |
documentation = cmp.config.window.bordered() | |
}, | |
experimental = { | |
ghost_text = false, | |
native_menu = false | |
} | |
} | |
--vim.cmd [[ | |
-- set completeopt=menuone,noinsert,noselect | |
-- highlight! default link CmpItemKind CmdItemMenuDefault | |
--]] | |
local lualine = require('lualine') | |
lualine.setup { | |
options = { | |
icons_enabled = true, | |
theme = 'gruvbox_dark', | |
component_separators = { left = '', right = ''}, | |
section_separators = { left = '', right = ''}, | |
disabled_filetypes = {} | |
}, | |
sections = { | |
lualine_a = { 'mode' }, | |
lualine_b = { 'branch' }, | |
lualine_c = { { | |
'filename', | |
file_status = true, -- displays file status (readonly status, modified status) | |
path = 0 -- 0 = just filename, 1 = relative path, 2 = absolute path | |
} }, | |
lualine_x = { | |
{ 'diagnostics', sources = { "nvim_diagnostic" }, symbols = { error = ' ', warn = ' ', info = ' ', | |
hint = ' ' } }, | |
'encoding', | |
'filetype' | |
}, | |
lualine_y = { 'progress' }, | |
lualine_z = { 'location' } | |
}, | |
inactive_sections = { | |
lualine_a = {}, | |
lualine_b = {}, | |
lualine_c = { { | |
'filename', | |
file_status = true, -- displays file status (readonly status, modified status) | |
path = 1 -- 0 = just filename, 1 = relative path, 2 = absolute path | |
} }, | |
lualine_x = { 'location' }, | |
lualine_y = {}, | |
lualine_z = {} | |
}, | |
tabline = {}, | |
extensions = { 'fugitive' } | |
} | |
require('null-ls').setup { | |
on_attach = function(client, bufnr) | |
if client.server_capabilities.documentFormattingProvider then | |
vim.cmd("nnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.formatting()<CR>") | |
-- format on save | |
vim.cmd("autocmd BufWritePost <buffer> lua vim.lsp.buf.formatting()") | |
end | |
if client.server_capabilities.documentRangeFormattingProvider then | |
vim.cmd("xnoremap <silent><buffer> <Leader>f :lua vim.lsp.buf.range_formatting({})<CR>") | |
end | |
end, | |
sources = { | |
require('null-ls').builtins.diagnostics.eslint_d.with({ | |
diagnostics_format = "[eslint] [#{m}]\n(#{c})", | |
}), | |
require('null-ls').builtins.code_actions.gitsigns, | |
} | |
} | |
require('prettier').setup { | |
bin = 'prettierd' | |
} | |
local opts = { noremap=true, silent=true } | |
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts) | |
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) | |
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) | |
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) | |
local on_attach = function(client, bufnr) | |
-- Enable completion triggered by <c-x><c-o> | |
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') | |
-- Mappings. | |
-- See `:help vim.lsp.*` for documentation on any of the below functions | |
local bufopts = { noremap=true, silent=true, buffer=bufnr } | |
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) | |
-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) | |
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) | |
-- vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) | |
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) | |
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts) | |
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts) | |
vim.keymap.set('n', '<space>wl', function() | |
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) | |
end, bufopts) | |
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) | |
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) | |
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) | |
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) | |
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) | |
require('lsp_signature').on_attach({ | |
bind = true, -- This is mandatory, otherwise border config won't get registered. | |
handler_opts = { | |
border = 'single' -- double, single, shadow, none | |
} | |
}, bufnr) | |
vim.keymap.set('i', '<C-k>', '<Cmd>Lspsaga signature_help<CR>', opts) | |
end | |
require('lspconfig').tsserver.setup { | |
on_attach = on_attach, | |
flags = lsp_flags | |
} | |
EOF | |
" Run jest for current project | |
command! -nargs=0 Jest :call CocAction('runCommand', 'jest.projectTest') | |
" Run jest for current file | |
command! -nargs=0 JestFile :call CocAction('runCommand', 'jest.fileTest', [%]) | |
" Run jest for current test | |
command! -nargs=0 JestTest :call CocAction('runCommand', 'jest.singleTest')<CR> | |
" Init jest in current cwd | |
command! -nargs=0 JestInit :call CocAction('runCommand', 'jest.init') | |
command! -nargs=0 Dap :lua require'dapui'.toggle()<CR> | |
command! -nargs=0 DapRepl :lua require'dap'.repl.open()<CR> | |
command! -nargs=0 DapBreak :lua require'dap'.toggle_breakpoint()<CR> | |
command! -nargs=0 DapContinue :lua require'dap'.continue()<CR> | |
command! -nargs=0 DapStepOver :lua require'dap'.step_over()<CR> | |
command! -nargs=0 DapStepInto :lua require'dap'.step_into()<CR> | |
command! -nargs=0 DapStepOut :lua require'dap'.step_out()<CR> | |
command! -nargs=0 DapStop :lua require'dap'.disconnect()<CR> | |
command! -nargs=0 DapRestart :lua require'dap'.restart()<CR> | |
autocmd BufWritePre *.js Neoformat | |
autocmd BufWritePre *.jsx Neoformat | |
autocmd BufWritePre *.ts Neoformat | |
autocmd BufWritePre *.tsx Neoformat | |
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif | |
set updatetime=300 | |
set signcolumn=yes:1 | |
" 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 <c-space> to trigger completion. | |
"if has('nvim') | |
" inoremap <silent><expr> <c-space> coc#refresh() | |
"else | |
" inoremap <silent><expr> <c-@> coc#refresh() | |
"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) | |
set nu | |
set nohlsearch | |
set hidden | |
set nowrap | |
set noswapfile | |
set nobackup | |
set undodir=~/.nvim/undos | |
set undofile | |
set incsearch | |
set scrolloff=8 | |
set colorcolumn=80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment