Skip to content

Commit

Permalink
Various changes
Browse files Browse the repository at this point in the history
  • Loading branch information
radoslav11 committed Dec 16, 2023
1 parent 332dfbc commit 5e4509c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
38 changes: 32 additions & 6 deletions init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Plug 'kassio/neoterm'
Plug 'nvim-tree/nvim-tree.lua'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate' }
Plug 'nvim-treesitter/nvim-treesitter-context'
Plug 'akinsho/toggleterm.nvim', {'tag' : '*'}

Plug 'nvim-lua/plenary.nvim'
Expand All @@ -28,18 +29,20 @@ Plug 'nvim-telescope/telescope-file-browser.nvim'
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-telescope/telescope-media-files.nvim'

Plug 'tmhedberg/SimpylFold'
" Plug 'jiangmiao/auto-pairs'

Plug 'searleser97/cpbooster.vim'
Plug 'dmdque/solidity.vim'

" Plug 'morhetz/gruvbox'
Plug 'morhetz/gruvbox'
Plug 'ellisonleao/gruvbox.nvim'
Plug 'sainnhe/gruvbox-material'

Plug 'tpope/vim-fugitive'

Plug 'rust-lang/rust.vim'
Plug 'czheo/mojo.vim'

Plug 'christoomey/vim-tmux-navigator'
call plug#end()

Expand Down Expand Up @@ -118,6 +121,9 @@ tmap <C-ESC> <C-\><C-N>
autocmd FileType c,cpp,java,noir setlocal commentstring=//\ %s

" Spell check for some languages
autocmd BufEnter,BufNewFile *.{txt,md,html,tex} setlocal spell spelllang=en_us

nmap <C-/> :Commentary<CR>
imap <C-/> <ESC>:Commentary<CR>
vmap <C-/> :Commentary<CR>
Expand Down Expand Up @@ -185,6 +191,9 @@ imap <F10> <ESC>:w<CR>:call ExecuteFile()<CR>
autocmd FileType python map <F9> <ESC>:w<CR>:call ExecuteFile()<CR>
autocmd FileType python imap <F9> <ESC>:w<CR>:call ExecuteFile()<CR>
" Folding
autocmd FileType python set foldmethod=indent

" Formatting tab
setlocal expandtab

Expand All @@ -199,7 +208,7 @@ let clang_format_style = "\'{
\IncludeBlocks: Preserve,
\SpaceBeforeCaseColon: false,
\SpaceBeforeRangeBasedForLoopColon: false,
\UseTab: Always,
\UseTab: Never,
\SpaceAfterTemplateKeyword: false,
\AlwaysBreakTemplateDeclarations: MultiLine
\}'"
Expand All @@ -215,6 +224,9 @@ let g:formatters_python = ['custom_black']

nmap <Tab> :Autoformat<CR>
" Rust formatting using default formatter
autocmd FileType rust nmap <Tab> :RustFmt<CR>
" It's annoying otherwise
source ~/.config/nvim/cyrilic.vim

Expand Down Expand Up @@ -258,6 +270,9 @@ nnoremap <silent> K :call ShowDocumentation()<CR>
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
let g:coc_snippet_next = "<c-k>"
let g:coc_snippet_prev = "<c-l>"

function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
Expand All @@ -266,6 +281,12 @@ function! ShowDocumentation()
endif
endfunction

map <F3> <ESC>:CocRestart <CR>
imap <F3> <ESC>:CocRestart <CR>
" Autopairs stuff
let b:coc_pairs_disabled = ['<', '`']

" Disable Copilot for large files
autocmd BufReadPre *
\ let f=getfsize(expand("<afile>"))
Expand All @@ -276,12 +297,17 @@ autocmd BufReadPre *
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true

" Autopairs stuff
let b:coc_pairs_disabled = ['<', '`']

" Disable auto commenting on new line
autocmd BufNewFile,BufRead * setlocal formatoptions-=cro

" Cursor line
highlight CursorLine cterm=NONE ctermbg=NONE ctermfg=NONE guibg=NONE guifg=NONE
set cursorline

" Spellcheck
set spelllang=en_us
set spell

" Add lua specific settings
" They are available in lua/init.lua
lua require('init')
3 changes: 2 additions & 1 deletion lua/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ require"nvim-treesitter.configs".setup{
enable = true,
-- disable slow treesitter highlight for large files
disable = function(_, buf)
local max_filesize = 100 * 1024 -- 100 KB
local max_filesize = 100 * 1024
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
Expand All @@ -109,3 +109,4 @@ require"nvim-treesitter.configs".setup{
additional_vim_regex_highlighting = false,
},
}
require("treesitter-context").setup()

0 comments on commit 5e4509c

Please sign in to comment.