1
0
Fork 0

init files

This commit is contained in:
Felipe Contreras 2021-06-13 16:20:42 -04:00
parent b7ef9f18e9
commit db90b36096
3 changed files with 247 additions and 0 deletions

14
ginit.vim Normal file
View file

@ -0,0 +1,14 @@
"--- NeovimGTK
if exists('g:GtkGuiLoaded')
call rpcnotify(1, 'Gui', 'Font', 'Fira Code 11')
"call rpcnotify(1, 'Gui', 'Option', 'Tabline', 0)
else
"--- hack to fix empty buffer
if @% == ""
bd
endif
Guifont! Fira Code:h11
GuiTabline 0
GuiPopupmenu 0
GuiRenderLigatures 1
endif

118
init.lua Normal file
View file

@ -0,0 +1,118 @@
---- Aliases ----
local cmd = vim.cmd
local g = vim.g
local opt = vim.opt
local o = vim.o
---- General Config ----
opt.mouse = 'a'
opt.tabstop = 4
opt.shiftwidth = 4
opt.number = true
opt.breakindent = true
--vim.o.inccomand = 'nosplit'
opt.showmatch = true
opt.ignorecase = true
opt.smartcase = true
opt.joinspaces = false
opt.showmode = false
opt.hidden = true
opt.backup = false
opt.writebackup = false
opt.swapfile = false
opt.shortmess:append({ I = true })
-- whichwrap -- left/right keys can traverse up/down
--opt.whichwrap = {'<','>','[',']'}
opt.cmdheight = 2
opt.showcmd = true
opt.showcmd = true
g.mapleader = ' '
---- Terminal ----
cmd 'autocmd TermOpen * setlocal nonumber'
---- Theming ----
opt.termguicolors = true
opt.background = 'dark'
g.gruvbox_italic = true
cmd 'colorscheme gruvbox'
opt.listchars = {
eol = '' ,
tab = '▶▹',
nbsp = '',
extends = '',
trail = ''}
-- vim-airline config ---
g.airline_powerline_fonts = true
g.airline_theme = 'powerlineish'
g['airline#extensions#tabline#enabled'] = 1
g['airline#extensions#tabline#left_sep'] = ' '
g['airline#extensions#tabline#left_alt_sep'] = '|'
---- Maps ----
local function map(mode, lhs, rhs, opts)
local options = {noremap = true, silent = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
map('!','<C-BS>','<C-w>')
map('v','>','>gv')
map('v','<','<gv')
map('n','<C-L>',':nohlsearch<CR>')
---- Treesitter ----
local ts = require 'nvim-treesitter.configs'
ts.setup {ensure_installed = 'maintained', highlight = {enable = true, indent = true}}
---- LSP ----
local lsp = require 'lspconfig'
---- Plugins ----
---- ale
g.ale_linters = {
bash = {'shellcheck'},
c = {},
cpp = {},
css = {'stylelint'},
html = {'tidy'},
javascript = {'eslint'},
python = {'flake8'},
tex = {'texlab'},
vim = {'vint'},
zsh = {'shell', 'shellcheck'},
}
g.ale_sign_error = ''
g.ale_sign_warning = ''
g.ale_set_highlights = 1
map('n', '[W', '<Plug>(ale_first)')
map('n', '[w', '<Plug>(ale_previous_wrap)')
map('n', ']w', '<Plug>(ale_next_wrap)')
map('n', ']W', '<Plug>(ale_last)')
---- completion-nvim
-- Use completion-nvim in every buffer
g.completion_enable_snippet = 'UltiSnips'
opt.completeopt = {'menuone', 'noinsert', 'noselect'}
g.completion_chain_complete_list = {
default = {
{ complete_items = { 'lsp' } },
{ complete_items = { 'buffers' } },
{ mode = { '<c-p>' } },
{ mode = { '<c-n>' } }
},
}
cmd [[autocmd BufEnter * lua require'completion'.on_attach()]]
---- Ultisnips
g.UltiSnipsSnippetDirectories = {'UltiSnips', 'mysnippets'}
---- vim-signify
g.signify_vcs_list = {'git'}
---- vim-markdown
g.vim_markdown_no_default_key_mappings = 1
g.vim_markdown_folding_disabled = 1
g.vim_markdown_toml_frontmatter = 1
---- Telescope
map('n', '<Leader>f', ':Telescope fd<CR>')
map('n', '<Leader>b', ':Telescope buffers<CR>')
map('n', '<Leader>/', ':Telescope current_buffer_fuzzy_find<CR>')
--map('n', '<Leader>*', ':Telescope grep_string<CR>')
map('n', '<Leader>g', ':Telescope live_grep<CR>')
map('n', '<Leader>cg', ':Telescope grep_string<CR>')

115
init.vim.bak Normal file
View file

@ -0,0 +1,115 @@
scriptencoding utf-8
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 0
"---- General config ----
filetype plugin on
set mouse=a
set tabstop=4
set shiftwidth=4
set number
set breakindent
set inccommand=nosplit
set showmatch
set ignorecase
set smartcase
set nojoinspaces
set noshowmode
set hidden
set nobackup
set nowritebackup
set noswapfile
set shortmess+=I
set whichwrap=<,>,[,] "whichwrap -- left/right keys can traverse up/down
set cmdheight=2
set showcmd
let mapleader=' '
"---- Terminal ----
autocmd TermOpen * setlocal nonumber
"---- Eyecandy ----
set termguicolors
set background=dark
let g:gruvbox_italic = 1
colorscheme gruvbox
set listchars=eol:↲,tab:▶▹,nbsp:␣,extends:…,trail:•
"-- vim-airline config ---
let g:airline_powerline_fonts = 1
let g:airline_theme = 'powerlineish'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
" Plugins ----
"-- ale --
let g:ale_linters = {
\ 'bash': ['shellcheck'],
\ 'c': [],
\ 'cpp': [],
\ 'css': ['stylelint'],
\ 'html': ['tidy'],
\ 'javascript': ['eslint'],
\ 'python': ['flake8'],
\ 'tex': ['texlab'],
\ 'vim': ['vint'],
\ 'zsh': ['shell', 'shellcheck'],
\}
let g:ale_sign_error = '✘'
let g:ale_sign_warning = '▲'
let g:ale_set_highlights = 1
nmap <silent> [W <Plug>(ale_first)
nmap <silent> [w <Plug>(ale_previous_wrap)
nmap <silent> ]w <Plug>(ale_next_wrap)
nmap <silent> ]W <Plug>(ale_last)
"-- ncm2 --
augroup ncm2
autocmd BufEnter * call ncm2#enable_for_buffer()
autocmd User Ncm2PopupOpen set completeopt=noinsert,menuone,noselect
autocmd User Ncm2PopupClose set completeopt=menuone
augroup end
"-- Ultisnips --
let g:UltiSnipsSnippetDirectories=['UltiSnips', 'mysnippets']
"-- vim-signify ---
let g:signify_vcs_list = [ 'git' ]
"-- vim-markdown --
let g:vim_markdown_no_default_key_mappings = 1
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_toml_frontmatter = 1
"-- LeaderF --
packadd LeaderF
let g:Lf_ShowDevIcons=0
" Use <C-N> and <C-P> to navigate history
let g:Lf_CommandMap = {
\'<C-K>': ['<Up>'],
\'<C-J>': ['<Down>'],
\'<Up>' : ['<C-P>'],
\'<Down>' : ['<C-N>']}
let g:Lf_PreviewInPopup = 1
let g:Lf_PopupWidth = 0.9
let g:Lf_PopupHeight = 0.9
let g:Lf_WindowPosition = 'popup'
let g:Lf_PreviewResult = {
\ 'Line': 1,
\}
let g:Lf_ExternalCommand = "fd --type f --follow -E '.git' \"%s\" "
"nnoremap <leader>b :Leaderf buffer<cr>
nnoremap <leader>/ :LeaderfLine<cr>
nnoremap <leader>* :LeaderfLineCword<cr>
nnoremap <leader>g :Leaderf rg -F --regexMode<cr>
nnoremap <leader>cg :<C-U><C-R>=printf("Leaderf! rg -F -e% s ", expand("<cword>"))<CR><CR>
"-- denite.nvim --
"call denite#custom#var('directory_rec', 'command',
"\ ['fd', '--type', 'd', '--follow', '-e', '.git', ''])
"nnoremap <leader>cd :Denite -default-action=cd directory_rec:`getcwd()`<cr>
"---- Maps ----
imap <C-BS> <C-w>
cmap <C-BS> <C-w>
vmap > >gv
vmap < <gv
nnoremap <C-L> :nohlsearch<CR>