Skip to content

Instantly share code, notes, and snippets.

@Fed0t
Last active August 26, 2024 19:34
Show Gist options
  • Save Fed0t/3791257af63f892c657eeb35f04f0ed9 to your computer and use it in GitHub Desktop.
Save Fed0t/3791257af63f892c657eeb35f04f0ed9 to your computer and use it in GitHub Desktop.
neovim ubuntu
syntax on
filetype plugin indent on
set encoding=UTF-8
set number
set cmdheight=1
set ruler
set incsearch
set cursorline
set ignorecase
set smartcase
set nohlsearch
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set noswapfile nobackup nowritebackup
set history=500
set timeoutlen=1000 ttimeoutlen=0
set updatetime=200
set signcolumn=yes
set showcmd
set clipboard^=unnamedplus,unnamed
set colorcolumn=80
set background=dark
set termguicolors
set mouse=a
set t_Co=256
set fillchars=horiz:━,horizup:┻,horizdown:┳,vert:┃,vertleft:┨,vertright:┣,verthoriz:╋
set backspace=indent,eol,start
set listchars=extends:→,precedes:←,nbsp:␣,trail:•,tab:▸\ ,eol:¬
set nostartofline
call plug#begin()
Plug 'petertriho/nvim-scrollbar'
Plug 'jbyuki/instant.nvim'
Plug 'kevinhwang91/nvim-ufo'
Plug 'kevinhwang91/promise-async'
Plug 'tpope/vim-commentary'
Plug 'lukas-reineke/indent-blankline.nvim'
Plug 'tpope/vim-surround'
Plug 'navarasu/onedark.nvim'
Plug 'dstein64/vim-startuptime'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'phpactor/phpactor', {'for': 'php', 'tag': '*', 'do': 'composer install --no-dev -o'}
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-treesitter/nvim-treesitter-textobjects'
Plug 'nvim-telescope/telescope.nvim'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'psliwka/vim-smoothie'
Plug 'ryanoasis/vim-devicons'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'nvim-lua/plenary.nvim'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/cmp-buffer'
Plug 'neovim/nvim-lspconfig'
Plug 'simrat39/rust-tools.nvim'
Plug 'utilyre/barbecue.nvim'
Plug 'SmiteshP/nvim-navic'
Plug 'romgrk/barbar.nvim'
Plug 'sindrets/diffview.nvim'
Plug 'dinhhuy258/vim-local-history', {'branch': 'master', 'do': ':UpdateRemotePlugins'}
Plug 'preservim/nerdtree'
Plug 'kdheepak/lazygit.nvim'
Plug 'puremourning/vimspector'
Plug 'norcalli/nvim-colorizer.lua'
Plug 'RaafatTurki/hex.nvim'
Plug 'huggingface/llm.nvim'
Plug 'nelsyeung/twig.vim'
Plug 'lumiliet/vim-twig'
call plug#end()
let g:transparent_enabled = v:true
let g:onedark_config = {
\ 'style': 'darker',
\}
colorscheme onedark
let g:airline_theme='onedark'
let g:airline_powerline_fonts = 1
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
let g:NERDTreeWinSize=60
let g:NERDTreeMinimalUI=1
let g:NERDTreeGitStatusWithFlags = 1
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:NERDTreeGitStatusNodeColorization = 1
let g:NERDTreeColorMapCustom = {
\ "Staged" : "#0ee375",
\ "Modified" : "#d9bf91",
\ "Renamed" : "#51C9FC",
\ "Untracked" : "#FCE77C",
\ "Unmerged" : "#FC51E6",
\ "Dirty" : "#FFBD61",
\ "Clean" : "#87939A",
\ "Ignored" : "#808080"
\ }
let g:NERDTreeIgnore = ['^node_modules$']
let g:coc_global_extensions = [
\ 'coc-marketplace', 'coc-tsserver', 'coc-json', 'coc-html',
\ 'coc-css', 'coc-python', 'coc-clangd','coc-phpactor',
\ 'coc-elixir', 'coc-eslint', 'coc-blade',
\ 'coc-rest', 'coc-git', 'coc-go', 'coc-highlight',
\ 'coc-lsp-wl', 'coc-markdownlint', 'coc-phpls',
\ 'coc-powershell', 'coc-rust-analyzer', 'coc-snippets',
\ 'coc-sourcekit', 'coc-actions', 'coc-spell-checker',
\ 'coc-texlab', 'coc-xml', 'coc-yaml', 'coc-yank',
\ 'coc-spell-checker', 'coc-cmake', 'coc-svg', 'coc-pairs', 'coc-vetur',
\ ]
let g:coc_filetype_map = {
\ 'html.swig': 'html',
\ 'wxss': 'css',
\ }
"COC
autocmd CursorHold * silent call CocActionAsync('highlight')
autocmd User CocStatusChange redrawstatus
nnoremap <F10> <cmd>call CocAction('format')<CR>
nmap <silent> rn <Plug>(coc-rename)
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
nnoremap <silent> K :call ShowDocumentation()<CR>
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gr <Plug>(coc-codeaction)
vmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
"BINDINGS
inoremap jj <ESC>
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>
nnoremap <Tab> >>
nnoremap <S-Tab> <<
inoremap <S-Tab> <C-d>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <F8> :TagbarToggle<CR>
nnoremap <F10> <cmd>call CocAction('format')<CR>
nmap <silent> rn <Plug>(coc-rename)
nnoremap <C-s> :update<cr>
nnoremap <C-p> <cmd>Telescope find_files<cr>
nnoremap <C-f> <cmd>Telescope live_grep<cr>
nnoremap <C-J> <cmd>BufferPrevious<CR>
nnoremap <C-K> <cmd>BufferNext<CR>
nnoremap <silent><C-x> <Cmd>BufferClose<CR>
nnoremap <F5> :LazyGit<CR>
nnoremap <F6> :DiffviewFileHistory<CR>
nnoremap <F7> :LocalHistoryToggle<CR>
nmap <F11> :DockerToolsToggle<CR>
nmap <Leader>} ysiw}
nnoremap <Leader>dd :call vimspector#Launch()<CR>
nnoremap <Leader>de :call vimspector#Reset()<CR>
nnoremap <Leader>dc :call vimspector#Continue()<CR>
nnoremap <Leader>do :call vimspector#StepOver()<CR>
nnoremap <Leader>dy :call vimspector#StepInto()<CR>
nnoremap <Leader>du :call vimspector#StepOut()<CR>
nnoremap <Leader>dt :call vimspector#ToggleBreakpoint()<CR>
nnoremap <Leader>dT :call vimspector#ClearBreakpoints()<CR>
"export XDEBUG_CONFIG="idekey=xdebug"
nmap <Leader>dk <Plug>VimspectorRestart
nmap <Leader>dh <Plug>VimspectorStepOut
nmap <Leader>dl <Plug>VimspectorStepInto
nmap <Leader>dj <Plug>VimspectorStepOver
autocmd BufEnter * silent! normal! g`"
autocmd BufEnter * silent! normal! :set cmdheight=1
autocmd BufReadPost,FileReadPost,BufEnter * normal zR
"LOAD EXTENSIONS
lua require('telescope').load_extension('lazygit')
lua require("colorizer").setup()
lua require("scrollbar").setup()
lua require("barbecue").setup({create_autocmd = true})
lua require("ibl").setup()
lua require("llm").setup({
\ backend = "ollama",
\ model = "codebooga:latest",
\ url = "http://localhost:11434/api/generate",
\ request_body = {
\ options = {
\ num_predict= 128,
\ temperature = 1.31,
\ repeat_penalty= 1.17,
\ top_p = 0.14,
\ top_k = 49,
\ },
\ },
\ enable_suggestions_on_startup = false,
\ fim = {
\ enabled = true,
\ prefix = "<PRE> ",
\ middle = " <MID>",
\ suffix = " <SUF>",
\ },
\ accept_keymap = "<S-Down>",
\ dismiss_keymap = "<S-Up>",
\})
lua require("hex").setup()
lua require('nvim-treesitter.configs').setup({
\ ensure_installed={'rust', 'typescript', 'scss', 'php', 'html', 'css', 'python', 'javascript'},
\ highlight={enable=true},
\ auto_install=true,
\ indent={enable=true},
\ rainbow = {enable = true,extended_mode = true,max_file_lines = nil},
\ textobjects={
\select={
\ enable=true,
\ lookahead=true,
\ keymaps={["af"] = "@function.outer", ["if"] = "@function.inner", ["ac"] = "@class.outer", ["ic"] = "@class.inner"}
\}
\}
\})
"LUA SECTION
lua << EOF
local cmp = require('cmp')
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
},
{
{
name = 'cmdline',
option = {
ignore_cmds = { 'Man', '!' }
}
}
})
})
vim.o.foldcolumn = '0'
vim.o.foldlevel = 999
vim.o.foldlevelstart = 999
vim.o.foldenable = true
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return {'treesitter', 'indent'}
end
})
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment