From 8dd168c37f5b2fcc691d4eb65c98b7c52248f6d3 Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Sun, 25 Jul 2021 20:31:32 -0400 Subject: [PATCH] Migrate init.vim to init.lua --- flake.lock | 30 ++-- home/default.nix | 6 +- home/nvim/init.vim | 139 ------------------ home/nvim/init2.lua | 118 ---------------- home/nvim/lua/init.lua | 313 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 332 insertions(+), 274 deletions(-) delete mode 100644 home/nvim/init.vim delete mode 100644 home/nvim/init2.lua create mode 100644 home/nvim/lua/init.lua diff --git a/flake.lock b/flake.lock index b0a503d..c726b46 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ ] }, "locked": { - "lastModified": 1627144340, - "narHash": "sha256-RzJ1fFLQ879J1okpH0WbYFY9qgHcglwVDl2bYqlRvw8=", + "lastModified": 1627267207, + "narHash": "sha256-chP4cF4yV0ZUI9E0zwm5KFmRJJ8sHnGrSaKzRKOMioU=", "owner": "nix-community", "repo": "home-manager", - "rev": "0423a7b40cd29aec0bb02fa30f61ffe60f5dfc19", + "rev": "addc78bea024c85860d60d9682a1ed2664fdf2f6", "type": "github" }, "original": { @@ -80,11 +80,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1627055776, - "narHash": "sha256-uwhJCub8IPlWc848xarUe2z9DoJb9ab0R8m0lR6Cn3g=", + "lastModified": 1627125518, + "narHash": "sha256-0FsL86dSiNDEjPDu9NGYgQ3CVhjQIZktMaZWzHxk+ms=", "owner": "neovim", "repo": "neovim", - "rev": "754ac5a834cb82f73ca552a9a55b90a40f9367f6", + "rev": "46009499afbb0232124072d775caa9552d0f71de", "type": "github" }, "original": { @@ -101,11 +101,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1627114287, - "narHash": "sha256-f5Qco89Dek3UhBcdSKzR0IUpJa8D79NG+vhk5o8zGcw=", + "lastModified": 1627200686, + "narHash": "sha256-+05Bku1+VKx2bC7/0oMazq0bIKWVyanhr/iy4sb7SzE=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "1f75888f034bdfba00d87a0cb7b54ae3380bcf62", + "rev": "9b49e4d4e64939540e530249c09b8d35fd1ce55d", "type": "github" }, "original": { @@ -116,11 +116,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1625333638, - "narHash": "sha256-M6J9RN60XJyv6nUfDFCwnz5aVjhe8+GJnV8Q9VpdQQQ=", + "lastModified": 1627212500, + "narHash": "sha256-KMUQCT3JSqznp+dR6BTvbwLqPFErjNlotVpkp/P/ZmM=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "41775780a0b6b32b3d32dcc32bb9bc6df809062d", + "rev": "03e7686c72345f237405c0b46b153dccd3ec9913", "type": "github" }, "original": { @@ -132,11 +132,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1626852498, - "narHash": "sha256-lOXUJvi0FJUXHTVSiC5qsMRtEUgqM4mGZpMESLuGhmo=", + "lastModified": 1627128856, + "narHash": "sha256-yw3lA8zyNFhj309lmxvNByEEymRT1rRy5oE+jEPnsP4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "16105403bdd843540cbef9c63fc0f16c1c6eaa70", + "rev": "dd14e5d78e90a2ccd6007e569820de9b4861a6c2", "type": "github" }, "original": { diff --git a/home/default.nix b/home/default.nix index 926990a..6821421 100644 --- a/home/default.nix +++ b/home/default.nix @@ -298,7 +298,9 @@ in viAlias = true; vimAlias = true; - extraConfig = builtins.readFile ./nvim/init.vim; + # home-manager doesn't yet support `init.lua` + extraConfig = "lua require('init')"; + plugins = with pkgs.vimPlugins; [ # gruvbox-nvim # TODO: Not working for some reason? # lush-nvim # required by gruvbox-nvim @@ -343,6 +345,6 @@ in }; - home.file.".config/nvim/init2.lua".source = ./nvim/init2.lua; + home.file.".config/nvim/lua".source = ./nvim/lua; } diff --git a/home/nvim/init.vim b/home/nvim/init.vim deleted file mode 100644 index 6582489..0000000 --- a/home/nvim/init.vim +++ /dev/null @@ -1,139 +0,0 @@ -set autoread -set cursorline -set encoding=utf-8 -set expandtab -set hlsearch -set ignorecase -set incsearch -set mouse=a -set nocompatible -set number relativenumber -set pastetoggle= -set shiftwidth=2 -set showcmd -set smartcase -set t_Co=256 -set tabstop=2 -set wildmenu - -" Disable swp and swo files -set noswapfile - -" Remember line number -au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif - -" Search down into subfolders -" Provides tab-completion for all file-related tasks -set path+=** - -filetype plugin indent on - -" Enable folding with the spacebar -nnoremap za - -" Replace visually selected -vnoremap "hy:%s/h//g - -" Custom Commands -command! JsonFormat execute "::%!jq '.'" - -" Shortcuts -map r :Rg -map f :Files -map g :GFiles -map n :NERDTreeToggle -map :tabn -map :tabp -map :tabnew - -" Copy/paste with OS clipboard -noremap y "+y -noremap p "+p - -" Indent YAML -au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab - -" Python indentation -au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix -let python_highlight_all=1 - -" Highlight whitespace -highlight ExtraWhitespace ctermbg=red guibg=red -match ExtraWhitespace /\s\+$/ - -" vim-go -let g:go_auto_sameids = 0 -let g:go_fmt_command = "goimports" -let g:go_fmt_experimental = 1 -let g:go_highlight_array_whitespace_error = 1 -let g:go_highlight_build_constraints = 1 -let g:go_highlight_chan_whitespace_error = 1 -let g:go_highlight_extra_types = 1 -let g:go_highlight_fields = 1 -let g:go_highlight_format_strings = 1 -let g:go_highlight_function_calls = 1 -let g:go_highlight_function_parameters = 1 -let g:go_highlight_functions = 1 -let g:go_highlight_generate_tags = 1 -let g:go_highlight_operators = 1 -let g:go_highlight_space_tab_error = 1 -let g:go_highlight_string_spellcheck = 1 -let g:go_highlight_trailing_whitespace_error = 0 -let g:go_highlight_types = 1 -let g:go_highlight_variable_assignments = 1 -let g:go_highlight_variable_declarations = 1 -let g:go_rename_command = 'gopls' -let g:go_metalinter_autosave=1 -let g:go_metalinter_autosave_enabled=['golint', 'govet'] - -" vim-terraform -let g:terraform_align=1 -let g:terraform_fmt_on_save=1 -let g:terraform_fold_sections=1 - -" rust.vim -let g:rustfmt_autosave = 1 - -" syntastic -set statusline+=%#warningmsg# -set statusline+=%{SyntasticStatuslineFlag()} -set statusline+=%* -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 - -" vim-markdown -let g:vim_markdown_override_foldtext=0 -let g:vim_markdown_no_default_key_mappings=1 -let g:vim_markdown_emphasis_multiline=0 -let g:vim_markdown_conceal=0 -let g:vim_markdown_frontmatter=1 -let g:vim_markdown_new_list_item_indent=0 - -" vim-prettier -let g:prettier#autoformat = 1 - -" completion-nvim -autocmd BufEnter * lua require'completion'.on_attach() - -" Use and to navigate through popup menu -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" - -" Set completeopt to have a better completion experience -set completeopt=menuone,noinsert,noselect - -" Avoid showing message extra message when using completion -set shortmess+=c - -" telescope-nvim -nnoremap ff Telescope find_files -nnoremap fg Telescope live_grep -nnoremap fb Telescope buffers -nnoremap fh Telescope help_tags - -imap (completion_smart_tab) -imap (completion_smart_s_tab) - -luafile ~/.config/nvim/init2.lua diff --git a/home/nvim/init2.lua b/home/nvim/init2.lua deleted file mode 100644 index 69e46d8..0000000 --- a/home/nvim/init2.lua +++ /dev/null @@ -1,118 +0,0 @@ --- colours -vim.cmd[[colorscheme tokyonight]] -vim.g.tokyonight_style = "night" -vim.g.tokyonight_italic_functions = true - --- status line -require('lualine').setup { - options = { - theme = 'tokyonight' - } -} - --- lsp -require'lspconfig'.bashls.setup{} -require'lspconfig'.gopls.setup{} -require'lspconfig'.pyright.setup{} -require'lspconfig'.rls.setup{} -require'lspconfig'.rnix.setup{} -require'lspconfig'.solargraph.setup{} -require'lspconfig'.terraformls.setup{} -require'lspconfig'.tflint.setup{} -require'lspconfig'.yamlls.setup{} - --- treesitter -require('nvim-treesitter.configs').setup({ - ensure_installed = "all", - - highlight = { - enable = true, - custom_captures = { - -- [""] = "", - -- ["keyword"] = "TSString", - }, - }, - - indent = { - enable = true - }, - - rainbow = { - enable = true, - extended_mode = true - }, -}) - ---folding -vim.api.nvim_exec([[ - set foldmethod=expr - set foldlevel=20 - set nofoldenable - set foldexpr=nvim_treesitter#foldexpr() -]], true) - --- trouble -require("trouble").setup { - { - position = "bottom", -- position of the list can be: bottom, top, left, right - height = 10, -- height of the trouble list when position is top or bottom - width = 50, -- width of the list when position is left or right - icons = true, -- use devicons for filenames - mode = "lsp_workspace_diagnostics", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist" - fold_open = "", -- icon used for open folds - fold_closed = "", -- icon used for closed folds - action_keys = { -- key mappings for actions in the trouble list - -- map to {} to remove a mapping, for example: - -- close = {}, - close = "q", -- close the list - cancel = "", -- cancel the preview and get back to your last window / buffer / cursor - refresh = "r", -- manually refresh - jump = {"", ""}, -- jump to the diagnostic or open / close folds - open_split = { "" }, -- open buffer in new split - open_vsplit = { "" }, -- open buffer in new vsplit - open_tab = { "" }, -- open buffer in new tab - jump_close = {"o"}, -- jump to the diagnostic and close the list - toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode - toggle_preview = "P", -- toggle auto_preview - hover = "K", -- opens a small popup with the full multiline message - preview = "p", -- preview the diagnostic location - close_folds = {"zM", "zm"}, -- close all folds - open_folds = {"zR", "zr"}, -- open all folds - toggle_fold = {"zA", "za"}, -- toggle fold of current file - previous = "k", -- preview item - next = "j" -- next item - }, - indent_lines = true, -- add an indent guide below the fold icons - auto_open = false, -- automatically open the list when you have diagnostics - auto_close = false, -- automatically close the list when you have no diagnostics - auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window - auto_fold = false, -- automatically fold a file trouble list at creation - signs = { - -- icons / text used for a diagnostic - error = "", - warning = "", - hint = "", - information = "", - other = "﫠" - }, - use_lsp_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client - } -} - --- twilight -require("twilight").setup { - dimming = { - alpha = 0.25, -- amount of dimming - -- we try to get the foreground from the highlight groups or fallback color - color = { "Normal", "#cccccc" }, - }, - context = 10, -- amount of lines we will try to show around the current line - expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types - "function", - "method", - "table", - "if_statement", - }, - exclude = {}, -- exclude these filetypes -} -vim.cmd[[autocmd BufEnter * :TwilightEnable]] diff --git a/home/nvim/lua/init.lua b/home/nvim/lua/init.lua new file mode 100644 index 0000000..8263181 --- /dev/null +++ b/home/nvim/lua/init.lua @@ -0,0 +1,313 @@ +------------------------------------------------------------------------------- +-- Options {{{1 --------------------------------------------------------------- +------------------------------------------------------------------------------- +vim.opt.autoindent = true -- maintain indent of current line +vim.opt.backup = false -- don't make backups before writing +vim.opt.belloff = 'all' -- never ring the bell for any reason +vim.opt.breakindent = true +vim.opt.completeopt = 'menuone' -- show menu even if there is only one candidate (for nvim-compe) +vim.opt.completeopt = vim.opt.completeopt + 'noselect' -- don't automatically select canditate (for nvim-compe) +vim.opt.cursorline = true -- highlight current line +vim.opt.expandtab = true -- always use spaces instead of tabs +vim.opt.fillchars = { + diff = '∙', -- BULLET OPERATOR (U+2219, UTF-8: E2 88 99) + eob = ' ', -- NO-BREAK SPACE (U+00A0, UTF-8: C2 A0) to suppress ~ at EndOfBuffer + vert = '┃', -- BOX DRAWINGS HEAVY VERTICAL (U+2503, UTF-8: E2 94 83) +} +vim.opt.hlsearch = true +vim.opt.ignorecase = true +vim.opt.incsearch = true +vim.opt.mouse = 'a' -- enable mouse +vim.opt.shiftwidth = 2 +vim.opt.showcmd = true +vim.opt.smartcase = true +vim.opt.tabstop = 2 +vim.opt.wildmenu = true + +vim.opt.modelines = 5 -- scan this many lines looking for modeline +vim.opt.number = true -- show line numbers in gutter +vim.opt.pumblend = 10 -- pseudo-transparency for popup-menu +vim.opt.relativenumber = true -- show relative numbers in gutter +vim.opt.scrolloff = 3 -- start scrolling 3 lines before edge of viewport + +vim.opt.spellcapcheck = '' -- don't check for capital letters at start of sentence +vim.opt.splitbelow = true -- open horizontal splits below current window +vim.opt.splitright = true -- open vertical splits to the right of the current window +vim.opt.suffixes = vim.opt.suffixes - '.h' -- don't sort header files at lower priority +vim.opt.swapfile = false -- don't create swap files +vim.opt.switchbuf = 'usetab' -- try to reuse windows/tabs when switching buffers +vim.opt.synmaxcol = 200 -- don't bother syntax highlighting long lines +vim.opt.tabstop = 2 -- spaces per tab +vim.opt.termguicolors = true -- use guifg/guibg instead of ctermfg/ctermbg in terminal +vim.opt.textwidth = 80 -- automatically hard wrap at 80 columns + +vim.opt.shell = 'bash' -- shell to use for `!`, `:!`, `system()` etc. +vim.opt.shiftround = false -- don't always indent by multiple of shiftwidth +vim.opt.shiftwidth = 2 -- spaces per tab (when shifting) +vim.opt.shortmess = vim.opt.shortmess + 'A' -- ignore annoying swapfile messages +vim.opt.shortmess = vim.opt.shortmess + 'I' -- no splash screen +vim.opt.shortmess = vim.opt.shortmess + 'O' -- file-read message overwrites previous +vim.opt.shortmess = vim.opt.shortmess + 'T' -- truncate non-file messages in middle +vim.opt.shortmess = vim.opt.shortmess + 'W' -- don't echo "[w]"/"[written]" when writing +vim.opt.shortmess = vim.opt.shortmess + 'a' -- use abbreviations in messages eg. `[RO]` instead of `[readonly]` +vim.opt.shortmess = vim.opt.shortmess + 'c' -- completion messages +vim.opt.shortmess = vim.opt.shortmess + 'o' -- overwrite file-written messages +vim.opt.shortmess = vim.opt.shortmess + 't' -- truncate file messages at start +vim.opt.showbreak = '↳ ' -- DOWNWARDS ARROW WITH TIP RIGHTWARDS (U+21B3, UTF-8: E2 86 B3) +vim.opt.showcmd = false -- don't show extra info at end of command line +vim.opt.sidescroll = 0 -- sidescroll in jumps because terminals are slow +vim.opt.sidescrolloff = 3 -- same as scrolloff, but for columns +vim.opt.smarttab = true -- / indent/dedent in leading whitespace + +-- Custom Commands +vim.cmd[[command! JsonFormat execute "::%!jq '.'"]] + +-- Tab shortcuts +vim.api.nvim_set_keymap("n", "", "tabnew", + {noremap = true} +) + +-- copy to OS clipboard +vim.api.nvim_set_keymap("v", "y", "\"+y", + {noremap = true} +) + +-- NERDTree +vim.api.nvim_set_keymap("n", "n", "NERDTreeToggle", + {silent = true, noremap = true} +) + +-- Folding +vim.api.nvim_set_keymap("n", "", "za", + {silent = true, noremap = true} +) + +--Set colorscheme +vim.o.termguicolors = true +vim.cmd[[colorscheme tokyonight]] +vim.g.tokyonight_style = "night" +vim.g.tokyonight_italic_functions = true + +------------------------------------------------------------------------------- +-- LSP {{{1 ------------------------------------------------------------------- +------------------------------------------------------------------------------- +require'lspconfig'.bashls.setup{} +require'lspconfig'.gopls.setup{} +require'lspconfig'.pyright.setup{} +require'lspconfig'.rls.setup{} +require'lspconfig'.rnix.setup{} +require'lspconfig'.solargraph.setup{} +require'lspconfig'.terraformls.setup{} +require'lspconfig'.tflint.setup{} +require'lspconfig'.yamlls.setup{} + + +------------------------------------------------------------------------------- +-- Plugins {{{1 --------------------------------------------------------------- +------------------------------------------------------------------------------- +-- status line +require('lualine').setup { + options = { + theme = 'tokyonight' + } +} + +-- treesitter +require('nvim-treesitter.configs').setup({ + ensure_installed = "all", + + highlight = { + enable = true, + custom_captures = { + -- [""] = "", + -- ["keyword"] = "TSString", + }, + }, + + indent = { + enable = true + }, + + rainbow = { + enable = true, + extended_mode = true + }, +}) + +-- folding +vim.api.nvim_exec([[ + set foldmethod=expr + set foldlevel=20 + set nofoldenable + set foldexpr=nvim_treesitter#foldexpr() +]], true) + +-- trouble +require("trouble").setup { + { + position = "bottom", -- position of the list can be: bottom, top, left, right + height = 10, -- height of the trouble list when position is top or bottom + width = 50, -- width of the list when position is left or right + icons = true, -- use devicons for filenames + mode = "lsp_workspace_diagnostics", -- "lsp_workspace_diagnostics", "lsp_document_diagnostics", "quickfix", "lsp_references", "loclist" + fold_open = "", -- icon used for open folds + fold_closed = "", -- icon used for closed folds + action_keys = { -- key mappings for actions in the trouble list + -- map to {} to remove a mapping, for example: + -- close = {}, + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = {"", ""}, -- jump to the diagnostic or open / close folds + open_split = { "" }, -- open buffer in new split + open_vsplit = { "" }, -- open buffer in new vsplit + open_tab = { "" }, -- open buffer in new tab + jump_close = {"o"}, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + close_folds = {"zM", "zm"}, -- close all folds + open_folds = {"zR", "zr"}, -- open all folds + toggle_fold = {"zA", "za"}, -- toggle fold of current file + previous = "k", -- preview item + next = "j" -- next item + }, + indent_lines = true, -- add an indent guide below the fold icons + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window + auto_fold = false, -- automatically fold a file trouble list at creation + signs = { + -- icons / text used for a diagnostic + error = "", + warning = "", + hint = "", + information = "", + other = "﫠" + }, + use_lsp_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client + } +} +vim.api.nvim_set_keymap("n", "xx", "Trouble", + {silent = true, noremap = true} +) +vim.api.nvim_set_keymap("n", "xw", "Trouble lsp_workspace_diagnostics", + {silent = true, noremap = true} +) +vim.api.nvim_set_keymap("n", "xd", "Trouble lsp_document_diagnostics", + {silent = true, noremap = true} +) +vim.api.nvim_set_keymap("n", "xl", "Trouble loclist", + {silent = true, noremap = true} +) +vim.api.nvim_set_keymap("n", "xq", "Trouble quickfix", + {silent = true, noremap = true} +) +vim.api.nvim_set_keymap("n", "gR", "Trouble lsp_references", + {silent = true, noremap = true} +) + +-- twilight +require("twilight").setup { + dimming = { + alpha = 0.25, -- amount of dimming + -- we try to get the foreground from the highlight groups or fallback color + color = { "Normal", "#cccccc" }, + }, + context = 10, -- amount of lines we will try to show around the current line + expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types + "function", + "method", + "table", + "if_statement", + }, + exclude = {}, -- exclude these filetypes +} +vim.cmd[[autocmd BufEnter * :TwilightEnable]] + +-- vim-go +vim.g.go_auto_sameids = 0 +vim.g.go_fmt_command = "goimports" +vim.g.go_fmt_experimental = 1 +vim.g.go_highlight_array_whitespace_error = 1 +vim.g.go_highlight_build_constraints = 1 +vim.g.go_highlight_chan_whitespace_error = 1 +vim.g.go_highlight_extra_types = 1 +vim.g.go_highlight_fields = 1 +vim.g.go_highlight_format_strings = 1 +vim.g.go_highlight_function_calls = 1 +vim.g.go_highlight_function_parameters = 1 +vim.g.go_highlight_functions = 1 +vim.g.go_highlight_generate_tags = 1 +vim.g.go_highlight_operators = 1 +vim.g.go_highlight_space_tab_error = 1 +vim.g.go_highlight_string_spellcheck = 1 +vim.g.go_highlight_trailing_whitespace_error = 0 +vim.g.go_highlight_types = 1 +vim.g.go_highlight_variable_assignments = 1 +vim.g.go_highlight_variable_declarations = 1 +vim.g.go_rename_command = 'gopls' +vim.g.go_metalinter_autosave = 1 +vim.g.go_metalinter_autosave_enabled = {'golint', 'govet'} + +-- vim-terraform +vim.g.terraform_align = 1 +vim.g.terraform_fmt_on_save = 1 +vim.g.terraform_fold_sections = 1 + +-- rust.vim +vim.g.rustfmt_autosave = 1 + +-- vim-markdown +vim.g.vim_markdown_override_foldtext = 0 +vim.g.vim_markdown_no_default_key_mappings = 1 +vim.g.vim_markdown_emphasis_multiline = 0 +vim.g.vim_markdown_conceal = 0 +vim.g.vim_markdown_frontmatter = 1 +vim.g.vim_markdown_new_list_item_indent = 0 + +-- vim-prettier +vim.g['prettier#autoformat'] = 1 + +-- telescope +vim.api.nvim_set_keymap("n", "ff", "Telescope find_files", + {silent = true, noremap = true} +) +vim.api.nvim_set_keymap("n", "fg", "Telescope live_grep", + {silent = true, noremap = true} +) + +-- syntastic +vim.g.syntastic_always_populate_loc_list = 1 +vim.g.syntastic_auto_loc_list = 1 +vim.g.syntastic_check_on_open = 1 +vim.g.syntastic_check_on_wq = 0 + +-- completion-nvim +vim.cmd[[autocmd BufEnter * lua require'completion'.on_attach()]] + +-- use tab as trigger keys +vim.cmd[[imap (completion_smart_tab)]] +vim.cmd[[imap (completion_smart_s_tab)]] + +-- Use and to navigate through popup menu +-- vim.cmd[[inoremap pumvisible() ? "\" : "\"]] +-- vim.cmd[[inoremap pumvisible() ? "\" : "\"]] + +-- Remember line number +vim.cmd[[au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]] + +--Replace visually selected +vim.cmd[[vnoremap "hy:%s/h//g]] + +-- Indent YAML +-- au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab + +-- Python indentation +-- au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix + +-- Highlight whitespace +vim.cmd[[highlight ExtraWhitespace ctermbg=red guibg=red]] +vim.cmd[[match ExtraWhitespace /\s\+$/]] +